OSDN Git Service

Merge branch 'master' of git://github.com/monaka/binutils
[pf3gnuchains/pf3gnuchains3x.git] / tk / generic / tkInt.h
1 /*
2  * tkInt.h --
3  *
4  *      Declarations for things used internally by the Tk
5  *      procedures but not exported outside the module.
6  *
7  * Copyright (c) 1990-1994 The Regents of the University of California.
8  * Copyright (c) 1994-1997 Sun Microsystems, Inc.
9  * Copyright (c) 1998 by Scriptics Corporation.
10  *
11  * See the file "license.terms" for information on usage and redistribution
12  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13  *
14  * RCS: $Id$ 
15  */
16
17 #ifndef _TKINT
18 #define _TKINT
19
20 #ifndef _TK
21 #include "tk.h"
22 #endif
23 #ifndef _TCL
24 #include "tcl.h"
25 #endif
26 #ifndef _TKPORT
27 #include <tkPort.h>
28 #endif
29
30 /*
31  * Opaque type declarations:
32  */
33
34 typedef struct TkColormap TkColormap;
35 typedef struct TkGrabEvent TkGrabEvent;
36 typedef struct TkpCursor_ *TkpCursor;
37 typedef struct TkRegion_ *TkRegion;
38 typedef struct TkStressedCmap TkStressedCmap;
39 typedef struct TkBindInfo_ *TkBindInfo;
40
41 /*
42  * Procedure types.
43  */
44
45 typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData,
46         Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin,
47         KeySym keySym));
48 typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData));
49
50 /*
51  * One of the following structures is maintained for each cursor in
52  * use in the system.  This structure is used by tkCursor.c and the
53  * various system specific cursor files.
54  */
55
56 typedef struct TkCursor {
57     Tk_Cursor cursor;           /* System specific identifier for cursor. */
58     Display *display;           /* Display containing cursor. Needed for
59                                  * disposal and retrieval of cursors. */
60     int resourceRefCount;       /* Number of active uses of this cursor (each
61                                  * active use corresponds to a call to
62                                  * Tk_AllocPreserveFromObj or Tk_Preserve).
63                                  * If this count is 0, then this structure
64                                  * is no longer valid and it isn't present
65                                  * in a hash table: it is being kept around
66                                  * only because there are objects referring
67                                  * to it.  The structure is freed when
68                                  * resourceRefCount and objRefCount are
69                                  * both 0. */
70     int objRefCount;            /* Number of Tcl objects that reference
71                                  * this structure.. */
72     Tcl_HashTable *otherTable;  /* Second table (other than idTable) used
73                                  * to index this entry. */
74     Tcl_HashEntry *hashPtr;     /* Entry in otherTable for this structure
75                                  * (needed when deleting). */
76     Tcl_HashEntry *idHashPtr;   /* Entry in idTable for this structure
77                                  * (needed when deleting). */
78     struct TkCursor *nextPtr;   /* Points to the next TkCursor structure with
79                                  * the same name.  Cursors with the same
80                                  * name but different displays are chained
81                                  * together off a single hash table entry. */
82 } TkCursor;
83
84 /*
85  * This defines whether we should try to use XIM over-the-spot style
86  * input.  Allow users to override it.  It is a much more elegant use
87  * of XIM, but uses a bit more memory.
88  */
89
90 #ifndef TK_XIM_SPOT
91 #   define TK_XIM_SPOT  1
92 #endif
93
94 /*
95  * The following structure is kept one-per-TkDisplay to maintain information
96  * about the caret (cursor location) on this display.  This is used to
97  * dictate global focus location (Windows Accessibility guidelines) and to
98  * position the IME or XIM over-the-spot window.
99  */
100
101 typedef struct TkCaret {
102     struct TkWindow *winPtr;    /* the window on which we requested caret
103                                  * placement */
104     int x;                      /* relative x coord of the caret */
105     int y;                      /* relative y coord of the caret */
106     int height;                 /* specified height of the window */
107 } TkCaret;
108
109 /*
110  * One of the following structures is maintained for each display
111  * containing a window managed by Tk.  In part, the structure is 
112  * used to store thread-specific data, since each thread will have 
113  * its own TkDisplay structure.
114  */
115
116 typedef struct TkDisplay {
117     Display *display;           /* Xlib's info about display. */
118     struct TkDisplay *nextPtr;  /* Next in list of all displays. */
119     char *name;                 /* Name of display (with any screen
120                                  * identifier removed).  Malloc-ed. */
121     Time lastEventTime;         /* Time of last event received for this
122                                  * display. */
123
124     /*
125      * Information used primarily by tk3d.c:
126      */
127
128     int borderInit;             /* 0 means borderTable needs initializing. */
129     Tcl_HashTable borderTable;  /* Maps from color name to TkBorder 
130                                  * structure. */
131
132     /*
133      * Information used by tkAtom.c only:
134      */
135
136     int atomInit;               /* 0 means stuff below hasn't been
137                                  * initialized yet. */
138     Tcl_HashTable nameTable;    /* Maps from names to Atom's. */
139     Tcl_HashTable atomTable;    /* Maps from Atom's back to names. */
140
141     /*
142      * Information used primarily by tkBind.c:
143      */
144
145     int bindInfoStale;          /* Non-zero means the variables in this
146                                  * part of the structure are potentially
147                                  * incorrect and should be recomputed. */
148     unsigned int modeModMask;   /* Has one bit set to indicate the modifier
149                                  * corresponding to "mode shift".  If no
150                                  * such modifier, than this is zero. */
151     unsigned int metaModMask;   /* Has one bit set to indicate the modifier
152                                  * corresponding to the "Meta" key.  If no
153                                  * such modifier, then this is zero. */
154     unsigned int altModMask;    /* Has one bit set to indicate the modifier
155                                  * corresponding to the "Meta" key.  If no
156                                  * such modifier, then this is zero. */
157     enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
158                                 /* Indicates how to interpret lock modifier. */
159     int numModKeyCodes;         /* Number of entries in modKeyCodes array
160                                  * below. */
161     KeyCode *modKeyCodes;       /* Pointer to an array giving keycodes for
162                                  * all of the keys that have modifiers
163                                  * associated with them.  Malloc'ed, but
164                                  * may be NULL. */
165
166     /*
167      * Information used by tkBitmap.c only:
168      */
169   
170     int bitmapInit;             /* 0 means tables above need initializing. */
171     int bitmapAutoNumber;       /* Used to number bitmaps. */
172     Tcl_HashTable bitmapNameTable;    
173                                 /* Maps from name of bitmap to the first 
174                                  * TkBitmap record for that name. */
175     Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
176                                  * structure for the bitmap. */
177     Tcl_HashTable bitmapDataTable;    
178                                 /* Used by Tk_GetBitmapFromData to map from
179                                  * a collection of in-core data about a 
180                                  * bitmap to a reference giving an auto-
181                                  * matically-generated name for the bitmap. */
182
183     /*
184      * Information used by tkCanvas.c only:
185      */
186
187     int numIdSearches;          
188     int numSlowSearches;
189
190     /*
191      * Used by tkColor.c only:
192      */
193
194     int colorInit;              /* 0 means color module needs initializing. */
195     TkStressedCmap *stressPtr;  /* First in list of colormaps that have
196                                  * filled up, so we have to pick an
197                                  * approximate color. */
198     Tcl_HashTable colorNameTable;
199                                 /* Maps from color name to TkColor structure
200                                  * for that color. */
201     Tcl_HashTable colorValueTable;
202                                 /* Maps from integer RGB values to TkColor
203                                  * structures. */
204
205     /*
206      * Used by tkCursor.c only:
207      */
208
209     int cursorInit;             /* 0 means cursor module need initializing. */
210     Tcl_HashTable cursorNameTable;
211                                 /* Maps from a string name to a cursor to the
212                                  * TkCursor record for the cursor. */
213     Tcl_HashTable cursorDataTable;
214                                 /* Maps from a collection of in-core data
215                                  * about a cursor to a TkCursor structure. */
216     Tcl_HashTable cursorIdTable;
217                                 /* Maps from a cursor id to the TkCursor
218                                  * structure for the cursor. */
219     char cursorString[20];      /* Used to store a cursor id string. */
220     Font cursorFont;            /* Font to use for standard cursors.
221                                  * None means font not loaded yet. */
222
223     /*
224      * Information used by tkError.c only:
225      */
226
227     struct TkErrorHandler *errorPtr;
228                                 /* First in list of error handlers
229                                  * for this display.  NULL means
230                                  * no handlers exist at present. */
231     int deleteCount;            /* Counts # of handlers deleted since
232                                  * last time inactive handlers were
233                                  * garbage-collected.  When this number
234                                  * gets big, handlers get cleaned up. */
235
236     /*
237      * Used by tkEvent.c only:
238      */
239
240     struct TkWindowEvent *delayedMotionPtr;
241                                 /* Points to a malloc-ed motion event
242                                  * whose processing has been delayed in
243                                  * the hopes that another motion event
244                                  * will come along right away and we can
245                                  * merge the two of them together.  NULL
246                                  * means that there is no delayed motion
247                                  * event. */
248
249     /*
250      * Information used by tkFocus.c only:
251      */
252
253     int focusDebug;             /* 1 means collect focus debugging 
254                                  * statistics. */
255     struct TkWindow *implicitWinPtr;
256                                 /* If the focus arrived at a toplevel window
257                                  * implicitly via an Enter event (rather
258                                  * than via a FocusIn event), this points
259                                  * to the toplevel window.  Otherwise it is
260                                  * NULL. */
261     struct TkWindow *focusPtr;  /* Points to the window on this display that
262                                  * should be receiving keyboard events.  When
263                                  * multiple applications on the display have
264                                  * the focus, this will refer to the
265                                  * innermost window in the innermost
266                                  * application.  This information isn't used
267                                  * under Unix or Windows, but it's needed on
268                                  * the Macintosh. */
269
270     /*
271      * Information used by tkGC.c only:
272      */
273     
274     Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
275                                  * describing a GC with those values. */
276     Tcl_HashTable gcIdTable;    /* Maps from a GC to a TkGC. */ 
277     int gcInit;                 /* 0 means the tables below need 
278                                  * initializing. */
279
280     /*
281      * Information used by tkGeometry.c only:
282      */
283
284     Tcl_HashTable maintainHashTable;
285                                 /* Hash table that maps from a master's 
286                                  * Tk_Window token to a list of slaves
287                                  * managed by that master. */
288     int geomInit;    
289
290     /*
291      * Information used by tkGet.c only:
292      */
293   
294     Tcl_HashTable uidTable;     /* Stores all Tk_Uid  used in a thread. */
295     int uidInit;                /* 0 means uidTable needs initializing. */
296
297     /*
298      * Information used by tkGrab.c only:
299      */
300
301     struct TkWindow *grabWinPtr;
302                                 /* Window in which the pointer is currently
303                                  * grabbed, or NULL if none. */
304     struct TkWindow *eventualGrabWinPtr;
305                                 /* Value that grabWinPtr will have once the
306                                  * grab event queue (below) has been
307                                  * completely emptied. */
308     struct TkWindow *buttonWinPtr;
309                                 /* Window in which first mouse button was
310                                  * pressed while grab was in effect, or NULL
311                                  * if no such press in effect. */
312     struct TkWindow *serverWinPtr;
313                                 /* If no application contains the pointer then
314                                  * this is NULL.  Otherwise it contains the
315                                  * last window for which we've gotten an
316                                  * Enter or Leave event from the server (i.e.
317                                  * the last window known to have contained
318                                  * the pointer).  Doesn't reflect events
319                                  * that were synthesized in tkGrab.c. */
320     TkGrabEvent *firstGrabEventPtr;
321                                 /* First in list of enter/leave events
322                                  * synthesized by grab code.  These events
323                                  * must be processed in order before any other
324                                  * events are processed.  NULL means no such
325                                  * events. */
326     TkGrabEvent *lastGrabEventPtr;
327                                 /* Last in list of synthesized events, or NULL
328                                  * if list is empty. */
329     int grabFlags;              /* Miscellaneous flag values.  See definitions
330                                  * in tkGrab.c. */
331
332     /*
333      * Information used by tkGrid.c only:
334      */
335
336     int gridInit;               /* 0 means table below needs initializing. */
337     Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to 
338                                  * corresponding Grid structures. */
339
340     /*
341      * Information used by tkImage.c only:
342      */
343
344     int imageId;                /* Value used to number image ids. */
345
346     /*
347      * Information used by tkMacWinMenu.c only:
348      */
349
350     int postCommandGeneration;  
351
352     /*
353      * Information used by tkOption.c only.
354      */
355
356
357
358     /*
359      * Information used by tkPack.c only.
360      */
361
362     int packInit;              /* 0 means table below needs initializing. */
363     Tcl_HashTable packerHashTable;
364                                /* Maps from Tk_Window tokens to 
365                                 * corresponding Packer structures. */
366     
367
368     /*
369      * Information used by tkPlace.c only.
370      */
371
372     int placeInit;              /* 0 means tables below need initializing. */
373     Tcl_HashTable masterTable;  /* Maps from Tk_Window toke to the Master
374                                  * structure for the window, if it exists. */
375     Tcl_HashTable slaveTable;   /* Maps from Tk_Window toke to the Slave
376                                  * structure for the window, if it exists. */
377
378     /*
379      * Information used by tkSelect.c and tkClipboard.c only:
380      */
381
382     struct TkSelectionInfo *selectionInfoPtr;
383                                 /* First in list of selection information
384                                  * records.  Each entry contains information
385                                  * about the current owner of a particular
386                                  * selection on this display. */
387     Atom multipleAtom;          /* Atom for MULTIPLE.  None means
388                                  * selection stuff isn't initialized. */
389     Atom incrAtom;              /* Atom for INCR. */
390     Atom targetsAtom;           /* Atom for TARGETS. */
391     Atom timestampAtom;         /* Atom for TIMESTAMP. */
392     Atom textAtom;              /* Atom for TEXT. */
393     Atom compoundTextAtom;      /* Atom for COMPOUND_TEXT. */
394     Atom applicationAtom;       /* Atom for TK_APPLICATION. */
395     Atom windowAtom;            /* Atom for TK_WINDOW. */
396     Atom clipboardAtom;         /* Atom for CLIPBOARD. */
397     Atom utf8Atom;              /* Atom for UTF8_STRING. */
398
399     Tk_Window clipWindow;       /* Window used for clipboard ownership and to
400                                  * retrieve selections between processes. NULL
401                                  * means clipboard info hasn't been
402                                  * initialized. */
403     int clipboardActive;        /* 1 means we currently own the clipboard
404                                  * selection, 0 means we don't. */
405     struct TkMainInfo *clipboardAppPtr;
406                                 /* Last application that owned clipboard. */
407     struct TkClipboardTarget *clipTargetPtr;
408                                 /* First in list of clipboard type information
409                                  * records.  Each entry contains information
410                                  * about the buffers for a given selection
411                                  * target. */
412
413     /*
414      * Information used by tkSend.c only:
415      */
416
417     Tk_Window commTkwin;        /* Window used for communication
418                                  * between interpreters during "send"
419                                  * commands.  NULL means send info hasn't
420                                  * been initialized yet. */
421     Atom commProperty;          /* X's name for comm property. */
422     Atom registryProperty;      /* X's name for property containing
423                                  * registry of interpreter names. */
424     Atom appNameProperty;       /* X's name for property used to hold the
425                                  * application name on each comm window. */
426
427     /*
428      * Information used by tkXId.c only:
429      */
430
431     struct TkIdStack *idStackPtr;
432                                 /* First in list of chunks of free resource
433                                  * identifiers, or NULL if there are no free
434                                  * resources. */
435     XID (*defaultAllocProc) _ANSI_ARGS_((Display *display));
436                                 /* Default resource allocator for display. */
437     struct TkIdStack *windowStackPtr;
438                                 /* First in list of chunks of window
439                                  * identifers that can't be reused right
440                                  * now. */
441     Tcl_TimerToken idCleanupScheduled;
442                                 /* If set, it means a call to WindowIdCleanup
443                                  * has already been scheduled, 0 means it
444                                  * hasn't. */
445
446     /*
447      * Information used by tkUnixWm.c and tkWinWm.c only:
448      */
449
450     struct TkWmInfo *firstWmPtr;  /* Points to first top-level window. */
451     struct TkWmInfo *foregroundWmPtr;    
452                                 /* Points to the foreground window. */
453
454     /*
455      * Information maintained by tkWindow.c for use later on by tkXId.c:
456      */
457
458
459     int destroyCount;           /* Number of Tk_DestroyWindow operations
460                                  * in progress. */
461     unsigned long lastDestroyRequest;
462                                 /* Id of most recent XDestroyWindow request;
463                                  * can re-use ids in windowStackPtr when
464                                  * server has seen this request and event
465                                  * queue is empty. */
466
467     /*
468      * Information used by tkVisual.c only:
469      */
470
471     TkColormap *cmapPtr;        /* First in list of all non-default colormaps
472                                  * allocated for this display. */
473
474     /*
475      * Miscellaneous information:
476      */
477
478 #ifdef TK_USE_INPUT_METHODS
479     XIM inputMethod;            /* Input method for this display */
480 #if TK_XIM_SPOT
481     XFontSet inputXfs;          /* XFontSet cached for over-the-spot XIM. */
482 #endif
483 #endif /* TK_USE_INPUT_METHODS */
484     Tcl_HashTable winTable;     /* Maps from X window ids to TkWindow ptrs. */
485
486     int refCount;               /* Reference count of how many Tk applications
487                                  * are using this display. Used to clean up
488                                  * the display when we no longer have any
489                                  * Tk applications using it.
490                                  */
491     /*
492      * The following field were all added for Tk8.3
493      */
494     int mouseButtonState;       /* current mouse button state for this
495                                  * display */
496     Window warpWindow;
497     int warpX;
498     int warpY;
499
500     /*
501      * The following field(s) were all added for Tk8.4
502      */
503     long deletionEpoch;         /* Incremented by window deletions */
504     unsigned int flags;         /* Various flag values:  these are all
505                                  * defined in below. */
506     TkCaret caret;              /* information about the caret for this
507                                  * display.  This is not a pointer. */
508 } TkDisplay;
509
510 /*
511  * Flag values for TkDisplay flags.
512  *  TK_DISPLAY_COLLAPSE_MOTION_EVENTS:  (default on)
513  *      Indicates that we should collapse motion events on this display
514  *  TK_DISPLAY_USE_IM:                  (default on, set via tk.tcl)
515  *      Whether to use input methods for this display
516  *  TK_DISPLAY_XIM_SPOT:                (default off)
517  *      Indicates that we should use over-the-spot XIM on this display
518  *  TK_DISPLAY_WM_TRACING:              (default off)
519  *      Whether we should do wm tracing on this display.
520  *  TK_DISPLAY_IN_WARP:                 (default off)
521  *      Indicates that we are in a pointer warp
522  */
523
524 #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS       (1 << 0)
525 #define TK_DISPLAY_USE_IM                       (1 << 1)
526 #define TK_DISPLAY_XIM_SPOT                     (1 << 2)
527 #define TK_DISPLAY_WM_TRACING                   (1 << 3)
528 #define TK_DISPLAY_IN_WARP                      (1 << 4)
529
530 /*
531  * One of the following structures exists for each error handler
532  * created by a call to Tk_CreateErrorHandler.  The structure
533  * is managed by tkError.c.
534  */
535
536 typedef struct TkErrorHandler {
537     TkDisplay *dispPtr;         /* Display to which handler applies. */
538     unsigned long firstRequest; /* Only errors with serial numbers
539                                  * >= to this are considered. */
540     unsigned long lastRequest;  /* Only errors with serial numbers
541                                  * <= to this are considered.  This
542                                  * field is filled in when XUnhandle
543                                  * is called.  -1 means XUnhandle
544                                  * hasn't been called yet. */
545     int error;                  /* Consider only errors with this
546                                  * error_code (-1 means consider
547                                  * all errors). */
548     int request;                /* Consider only errors with this
549                                  * major request code (-1 means
550                                  * consider all major codes). */
551     int minorCode;              /* Consider only errors with this
552                                  * minor request code (-1 means
553                                  * consider all minor codes). */
554     Tk_ErrorProc *errorProc;    /* Procedure to invoke when a matching
555                                  * error occurs.  NULL means just ignore
556                                  * errors. */
557     ClientData clientData;      /* Arbitrary value to pass to
558                                  * errorProc. */
559     struct TkErrorHandler *nextPtr;
560                                 /* Pointer to next older handler for
561                                  * this display, or NULL for end of
562                                  * list. */
563 } TkErrorHandler;
564
565
566 /*
567  * One of the following structures exists for each event handler
568  * created by calling Tk_CreateEventHandler.  This information
569  * is used by tkEvent.c only.
570  */
571
572 typedef struct TkEventHandler {
573     unsigned long mask;         /* Events for which to invoke
574                                  * proc. */
575     Tk_EventProc *proc;         /* Procedure to invoke when an event
576                                  * in mask occurs. */
577     ClientData clientData;      /* Argument to pass to proc. */
578     struct TkEventHandler *nextPtr;
579                                 /* Next in list of handlers
580                                  * associated with window (NULL means
581                                  * end of list). */
582 } TkEventHandler;
583
584 /*
585  * Tk keeps one of the following data structures for each main
586  * window (created by a call to TkCreateMainWindow).  It stores
587  * information that is shared by all of the windows associated
588  * with a particular main window.
589  */
590
591 typedef struct TkMainInfo {
592     int refCount;               /* Number of windows whose "mainPtr" fields
593                                  * point here.  When this becomes zero, can
594                                  * free up the structure (the reference
595                                  * count is zero because windows can get
596                                  * deleted in almost any order;  the main
597                                  * window isn't necessarily the last one
598                                  * deleted). */
599     struct TkWindow *winPtr;    /* Pointer to main window. */
600     Tcl_Interp *interp;         /* Interpreter associated with application. */
601     Tcl_HashTable nameTable;    /* Hash table mapping path names to TkWindow
602                                  * structs for all windows related to this
603                                  * main window.  Managed by tkWindow.c. */
604     Tk_BindingTable bindingTable;
605                                 /* Used in conjunction with "bind" command
606                                  * to bind events to Tcl commands. */
607     TkBindInfo bindInfo;        /* Information used by tkBind.c on a per
608                                  * application basis. */
609     struct TkFontInfo *fontInfoPtr;
610                                 /* Information used by tkFont.c on a per
611                                  * application basis. */
612
613     /*
614      * Information used only by tkFocus.c and tk*Embed.c:
615      */
616
617     struct TkToplevelFocusInfo *tlFocusPtr;
618                                 /* First in list of records containing focus
619                                  * information for each top-level in the
620                                  * application.  Used only by tkFocus.c. */
621     struct TkDisplayFocusInfo *displayFocusPtr;
622                                 /* First in list of records containing focus
623                                  * information for each display that this
624                                  * application has ever used.  Used only
625                                  * by tkFocus.c. */
626
627     struct ElArray *optionRootPtr;
628                                 /* Top level of option hierarchy for this
629                                  * main window.  NULL means uninitialized.
630                                  * Managed by tkOption.c. */
631     Tcl_HashTable imageTable;   /* Maps from image names to Tk_ImageMaster
632                                  * structures.  Managed by tkImage.c. */
633     int strictMotif;            /* This is linked to the tk_strictMotif
634                                  * global variable. */
635     struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
636                                  * this process. */
637 } TkMainInfo;
638
639 /*
640  * Tk keeps the following data structure for each of it's builtin
641  * bitmaps.  This structure is only used by tkBitmap.c and other
642  * platform specific bitmap files.
643  */
644
645 typedef struct {
646     CONST char *source;         /* Bits for bitmap. */
647     int width, height;          /* Dimensions of bitmap. */
648     int native;                 /* 0 means generic (X style) bitmap,
649                                  * 1 means native style bitmap. */
650 } TkPredefBitmap;
651
652 /*
653  * Tk keeps one of the following structures for each window.
654  * Some of the information (like size and location) is a shadow
655  * of information managed by the X server, and some is special
656  * information used here, such as event and geometry management
657  * information.  This information is (mostly) managed by tkWindow.c.
658  * WARNING: the declaration below must be kept consistent with the
659  * Tk_FakeWin structure in tk.h.  If you change one, be sure to
660  * change the other!!
661  */
662
663 typedef struct TkWindow {
664
665     /*
666      * Structural information:
667      */
668
669     Display *display;           /* Display containing window. */
670     TkDisplay *dispPtr;         /* Tk's information about display
671                                  * for window. */
672     int screenNum;              /* Index of screen for window, among all
673                                  * those for dispPtr. */
674     Visual *visual;             /* Visual to use for window.  If not default,
675                                  * MUST be set before X window is created. */
676     int depth;                  /* Number of bits/pixel. */
677     Window window;              /* X's id for window.   NULL means window
678                                  * hasn't actually been created yet, or it's
679                                  * been deleted. */
680     struct TkWindow *childList; /* First in list of child windows,
681                                  * or NULL if no children.  List is in
682                                  * stacking order, lowest window first.*/
683     struct TkWindow *lastChildPtr;
684                                 /* Last in list of child windows (highest
685                                  * in stacking order), or NULL if no
686                                  * children. */
687     struct TkWindow *parentPtr; /* Pointer to parent window (logical
688                                  * parent, not necessarily X parent).  NULL
689                                  * means either this is the main window, or
690                                  * the window's parent has already been
691                                  * deleted. */
692     struct TkWindow *nextPtr;   /* Next higher sibling (in stacking order)
693                                  * in list of children with same parent.  NULL
694                                  * means end of list. */
695     TkMainInfo *mainPtr;        /* Information shared by all windows
696                                  * associated with a particular main
697                                  * window.  NULL means this window is
698                                  * a rogue that isn't associated with
699                                  * any application (at present, this
700                                  * only happens for the dummy windows
701                                  * used for "send" communication).  */
702
703     /*
704      * Name and type information for the window:
705      */
706
707     char *pathName;             /* Path name of window (concatenation
708                                  * of all names between this window and
709                                  * its top-level ancestor).  This is a
710                                  * pointer into an entry in
711                                  * mainPtr->nameTable.  NULL means that
712                                  * the window hasn't been completely
713                                  * created yet. */
714     Tk_Uid nameUid;             /* Name of the window within its parent
715                                  * (unique within the parent). */
716     Tk_Uid classUid;            /* Class of the window.  NULL means window
717                                  * hasn't been given a class yet. */
718
719     /*
720      * Geometry and other attributes of window.  This information
721      * may not be updated on the server immediately;  stuff that
722      * hasn't been reflected in the server yet is called "dirty".
723      * At present, information can be dirty only if the window
724      * hasn't yet been created.
725      */
726
727     XWindowChanges changes;     /* Geometry and other info about
728                                  * window. */
729     unsigned int dirtyChanges;  /* Bits indicate fields of "changes"
730                                  * that are dirty. */
731     XSetWindowAttributes atts;  /* Current attributes of window. */
732     unsigned long dirtyAtts;    /* Bits indicate fields of "atts"
733                                  * that are dirty. */
734
735     unsigned int flags;         /* Various flag values:  these are all
736                                  * defined in tk.h (confusing, but they're
737                                  * needed there for some query macros). */
738
739     /*
740      * Information kept by the event manager (tkEvent.c):
741      */
742
743     TkEventHandler *handlerList;/* First in list of event handlers
744                                  * declared for this window, or
745                                  * NULL if none. */
746 #ifdef TK_USE_INPUT_METHODS
747     XIC inputContext;           /* XIM input context. */
748 #endif /* TK_USE_INPUT_METHODS */
749
750     /*
751      * Information used for event bindings (see "bind" and "bindtags"
752      * commands in tkCmds.c):
753      */
754
755     ClientData *tagPtr;         /* Points to array of tags used for bindings
756                                  * on this window.  Each tag is a Tk_Uid.
757                                  * Malloc'ed.  NULL means no tags. */
758     int numTags;                /* Number of tags at *tagPtr. */
759
760     /*
761      * Information used by tkOption.c to manage options for the
762      * window.
763      */
764
765     int optionLevel;            /* -1 means no option information is
766                                  * currently cached for this window.
767                                  * Otherwise this gives the level in
768                                  * the option stack at which info is
769                                  * cached. */
770     /*
771      * Information used by tkSelect.c to manage the selection.
772      */
773
774     struct TkSelHandler *selHandlerList;
775                                 /* First in list of handlers for
776                                  * returning the selection in various
777                                  * forms. */
778
779     /*
780      * Information used by tkGeometry.c for geometry management.
781      */
782
783     Tk_GeomMgr *geomMgrPtr;     /* Information about geometry manager for
784                                  * this window. */
785     ClientData geomData;        /* Argument for geometry manager procedures. */
786     int reqWidth, reqHeight;    /* Arguments from last call to
787                                  * Tk_GeometryRequest, or 0's if
788                                  * Tk_GeometryRequest hasn't been
789                                  * called. */
790     int internalBorderLeft;     /* Width of internal border of window
791                                  * (0 means no internal border).  Geometry
792                                  * managers should not normally place children
793                                  * on top of the border. 
794                                  * Fields for the other three sides are found 
795                                  * below. */
796
797     /*
798      * Information maintained by tkWm.c for window manager communication.
799      */
800
801     struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also
802                                  * for special Unix menubar and wrapper
803                                  * windows), points to structure with
804                                  * wm-related info (see tkWm.c).  For
805                                  * other windows, this is NULL. */
806
807     /*
808      * Information used by widget classes.
809      */
810
811     Tk_ClassProcs *classProcsPtr;
812     ClientData instanceData;
813
814     /*
815      * Platform specific information private to each port.
816      */
817
818     struct TkWindowPrivate *privatePtr;
819
820     /*
821      * More information used by tkGeometry.c for geometry management.
822      */
823
824     /* The remaining fields of internal border. */
825     int internalBorderRight; 
826     int internalBorderTop;
827     int internalBorderBottom;
828     
829     int minReqWidth;            /* Minimum requested width. */
830     int minReqHeight;           /* Minimum requested height. */
831 } TkWindow;
832
833 /*
834  * The following structure is used as a two way map between integers
835  * and strings, usually to map between an internal C representation
836  * and the strings used in Tcl.
837  */
838
839 typedef struct TkStateMap {
840     int numKey;                 /* Integer representation of a value. */
841     char *strKey;               /* String representation of a value. */
842 } TkStateMap;
843
844 /*
845  * This structure is used by the Mac and Window porting layers as
846  * the internal representation of a clip_mask in a GC.
847  */
848
849 typedef struct TkpClipMask {
850     int type;                   /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
851     union {
852         Pixmap pixmap;
853         TkRegion region;
854     } value;
855 } TkpClipMask;
856
857 #define TKP_CLIP_PIXMAP 0
858 #define TKP_CLIP_REGION 1
859
860 /*
861  * Pointer to first entry in list of all displays currently known.
862  */
863
864 extern TkDisplay *tkDisplayList;
865
866 /*
867  * Return values from TkGrabState:
868  */
869
870 #define TK_GRAB_NONE            0
871 #define TK_GRAB_IN_TREE         1
872 #define TK_GRAB_ANCESTOR        2
873 #define TK_GRAB_EXCLUDED        3
874
875 /*
876  * The macro below is used to modify a "char" value (e.g. by casting
877  * it to an unsigned character) so that it can be used safely with
878  * macros such as isspace.
879  */
880
881 #define UCHAR(c) ((unsigned char) (c))
882
883 /*
884  * The following symbol is used in the mode field of FocusIn events
885  * generated by an embedded application to request the input focus from
886  * its container.
887  */
888
889 #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
890
891 /*
892  * The following special modifier mask bits are defined, to indicate
893  * logical modifiers such as Meta and Alt that may float among the
894  * actual modifier bits.
895  */
896
897 #define META_MASK       (AnyModifier<<1)
898 #define ALT_MASK        (AnyModifier<<2)
899
900 /*
901  * Object types not declared in tkObj.c need to be mentioned here so
902  * they can be properly registered with Tcl:
903  */
904
905 extern Tcl_ObjType tkBorderObjType;
906 extern Tcl_ObjType tkBitmapObjType;
907 extern Tcl_ObjType tkColorObjType;
908 extern Tcl_ObjType tkCursorObjType;
909 extern Tcl_ObjType tkFontObjType;
910 extern Tcl_ObjType tkOptionObjType;
911 extern Tcl_ObjType tkStateKeyObjType;
912
913 /*
914  * Miscellaneous variables shared among Tk modules but not exported
915  * to the outside world:
916  */
917
918 extern Tk_SmoothMethod          tkBezierSmoothMethod;
919 extern Tk_ImageType             tkBitmapImageType;
920 extern Tk_PhotoImageFormat      tkImgFmtGIF;
921 extern void                     (*tkHandleEventProc) _ANSI_ARGS_((
922                                     XEvent* eventPtr));
923 extern Tk_PhotoImageFormat      tkImgFmtPPM;
924 extern TkMainInfo               *tkMainWindowList;
925 extern Tk_ImageType             tkPhotoImageType;
926 extern Tcl_HashTable            tkPredefBitmapTable;
927 extern int                      tkSendSerial;
928
929 #include "tkIntDecls.h"
930
931 #ifdef BUILD_tk
932 # undef TCL_STORAGE_CLASS
933 # define TCL_STORAGE_CLASS DLLEXPORT
934 #endif
935
936 /*
937  * Internal procedures shared among Tk modules but not exported
938  * to the outside world:
939  */
940
941 EXTERN int              Tk_BellObjCmd _ANSI_ARGS_((ClientData clientData,
942                             Tcl_Interp *interp, int objc, 
943                             Tcl_Obj *CONST objv[]));
944 EXTERN int              Tk_BindObjCmd _ANSI_ARGS_((ClientData clientData,
945                             Tcl_Interp *interp, int objc,
946                             Tcl_Obj *CONST objv[]));
947 EXTERN int              Tk_BindtagsObjCmd _ANSI_ARGS_((ClientData clientData,
948                             Tcl_Interp *interp, int objc,
949                             Tcl_Obj *CONST objv[]));
950 EXTERN int              Tk_ButtonObjCmd _ANSI_ARGS_((ClientData clientData,
951                             Tcl_Interp *interp, int objc,
952                             Tcl_Obj *CONST objv[]));
953 EXTERN int              Tk_CanvasObjCmd _ANSI_ARGS_((ClientData clientData,
954                             Tcl_Interp *interp, int argc,
955                             Tcl_Obj *CONST objv[]));
956 EXTERN int              Tk_CheckbuttonObjCmd _ANSI_ARGS_((
957                             ClientData clientData,
958                             Tcl_Interp *interp, int objc,
959                             Tcl_Obj *CONST objv[]));
960 EXTERN int              Tk_ClipboardObjCmd _ANSI_ARGS_((
961                             ClientData clientData, Tcl_Interp *interp,
962                             int objc, Tcl_Obj *CONST objv[]));
963 EXTERN int              Tk_ChooseColorObjCmd _ANSI_ARGS_((
964                             ClientData clientData, Tcl_Interp *interp,
965                             int objc, Tcl_Obj *CONST objv[]));
966 EXTERN int              Tk_ChooseDirectoryObjCmd _ANSI_ARGS_((
967                             ClientData clientData, Tcl_Interp *interp,
968                             int objc, Tcl_Obj *CONST objv[]));
969 EXTERN int              Tk_ChooseFontObjCmd _ANSI_ARGS_((ClientData clientData,
970                             Tcl_Interp *interp, int objc, 
971                             Tcl_Obj *CONST objv[]));
972 EXTERN int              Tk_DestroyObjCmd _ANSI_ARGS_((ClientData clientData,
973                             Tcl_Interp *interp, int objc, 
974                             Tcl_Obj *CONST objv[]));
975 EXTERN int              Tk_EntryObjCmd _ANSI_ARGS_((ClientData clientData,
976                             Tcl_Interp *interp, int objc, 
977                             Tcl_Obj *CONST objv[]));
978 EXTERN int              Tk_EventObjCmd _ANSI_ARGS_((ClientData clientData,
979                             Tcl_Interp *interp, int objc,
980                             Tcl_Obj *CONST objv[]));
981 EXTERN int              Tk_FileeventCmd _ANSI_ARGS_((ClientData clientData,
982                             Tcl_Interp *interp, int argc, char **argv));
983 EXTERN int              Tk_FrameObjCmd _ANSI_ARGS_((ClientData clientData,
984                             Tcl_Interp *interp, int objc,
985                             Tcl_Obj *CONST objv[]));
986 EXTERN int              Tk_FocusObjCmd _ANSI_ARGS_((ClientData clientData,
987                             Tcl_Interp *interp, int objc, 
988                             Tcl_Obj *CONST objv[]));
989 EXTERN int              Tk_FontObjCmd _ANSI_ARGS_((ClientData clientData,
990                             Tcl_Interp *interp, int objc, 
991                             Tcl_Obj *CONST objv[]));
992 EXTERN int              Tk_GetOpenFileObjCmd _ANSI_ARGS_((
993                             ClientData clientData,
994                             Tcl_Interp *interp, int objc, 
995                             Tcl_Obj *CONST objv[]));
996 EXTERN int              Tk_GetSaveFileObjCmd _ANSI_ARGS_((
997                             ClientData clientData,
998                             Tcl_Interp *interp, int objc, 
999                             Tcl_Obj *CONST objv[]));
1000 EXTERN int              Tk_GrabObjCmd _ANSI_ARGS_((ClientData clientData,
1001                             Tcl_Interp *interp, int objc,
1002                             Tcl_Obj *CONST objv[]));
1003 EXTERN int              Tk_GridObjCmd _ANSI_ARGS_((ClientData clientData,
1004                             Tcl_Interp *interp, int objc,
1005                             Tcl_Obj *CONST objv[]));
1006 EXTERN int              Tk_ImageObjCmd _ANSI_ARGS_((ClientData clientData,
1007                             Tcl_Interp *interp, int objc, 
1008                             Tcl_Obj *CONST objv[]));
1009 EXTERN int              Tk_LabelObjCmd _ANSI_ARGS_((ClientData clientData,
1010                             Tcl_Interp *interp, int objc,
1011                             Tcl_Obj *CONST objv[]));
1012 EXTERN int              Tk_LabelframeObjCmd _ANSI_ARGS_((ClientData clientData,
1013                             Tcl_Interp *interp, int objc,
1014                             Tcl_Obj *CONST objv[]));
1015 EXTERN int              Tk_ListboxObjCmd _ANSI_ARGS_((ClientData clientData,
1016                             Tcl_Interp *interp, int objc,
1017                             Tcl_Obj *CONST objv[]));
1018 EXTERN int              Tk_LowerObjCmd _ANSI_ARGS_((ClientData clientData,
1019                             Tcl_Interp *interp, int objc,
1020                             Tcl_Obj *CONST objv[]));
1021 EXTERN int              Tk_MenubuttonObjCmd _ANSI_ARGS_((ClientData clientData,
1022                             Tcl_Interp *interp, int objc, 
1023                             Tcl_Obj *CONST objv[]));
1024 EXTERN int              Tk_MessageBoxObjCmd _ANSI_ARGS_((ClientData clientData,
1025                             Tcl_Interp *interp, int objc, 
1026                             Tcl_Obj *CONST objv[]));
1027 EXTERN int              Tk_MessageObjCmd _ANSI_ARGS_((ClientData clientData,
1028                             Tcl_Interp *interp, int objc,
1029                             Tcl_Obj *CONST objv[]));
1030 EXTERN int              Tk_PanedWindowObjCmd _ANSI_ARGS_((
1031                             ClientData clientData,
1032                             Tcl_Interp *interp, int objc,
1033                             Tcl_Obj *CONST objv[]));
1034 EXTERN int              Tk_OptionObjCmd _ANSI_ARGS_((ClientData clientData,
1035                             Tcl_Interp *interp, int objc,
1036                             Tcl_Obj *CONST objv[]));
1037 EXTERN int              Tk_PackObjCmd _ANSI_ARGS_((ClientData clientData,
1038                             Tcl_Interp *interp, int objc,
1039                             Tcl_Obj *CONST objv[]));
1040 EXTERN int              Tk_PlaceObjCmd _ANSI_ARGS_((ClientData clientData,
1041                             Tcl_Interp *interp, int objc,
1042                             Tcl_Obj *CONST objv[]));
1043 EXTERN int              Tk_RadiobuttonObjCmd _ANSI_ARGS_((
1044                             ClientData clientData,
1045                             Tcl_Interp *interp, int objc,
1046                             Tcl_Obj *CONST objv[]));
1047 EXTERN int              Tk_RaiseObjCmd _ANSI_ARGS_((ClientData clientData,
1048                             Tcl_Interp *interp, int objc,
1049                             Tcl_Obj *CONST objv[]));
1050 EXTERN int              Tk_ScaleObjCmd _ANSI_ARGS_((ClientData clientData,
1051                             Tcl_Interp *interp, int objc, 
1052                             Tcl_Obj *CONST objv[]));
1053 EXTERN int              Tk_ScrollbarCmd _ANSI_ARGS_((ClientData clientData,
1054                             Tcl_Interp *interp, int argc, CONST char **argv));
1055 EXTERN int              Tk_SelectionObjCmd _ANSI_ARGS_((ClientData clientData,
1056                             Tcl_Interp *interp, int objc,
1057                             Tcl_Obj *CONST objv[]));
1058 EXTERN int              Tk_SendCmd _ANSI_ARGS_((ClientData clientData,
1059                             Tcl_Interp *interp, int argc, CONST char **argv));
1060 EXTERN int              Tk_SendObjCmd _ANSI_ARGS_((ClientData clientData,
1061                             Tcl_Interp *interp, int objc, 
1062                             Tcl_Obj *CONST objv[]));
1063 EXTERN int              Tk_SpinboxObjCmd _ANSI_ARGS_((ClientData clientData,
1064                             Tcl_Interp *interp, int objc, 
1065                             Tcl_Obj *CONST objv[]));
1066 EXTERN int              Tk_TextCmd _ANSI_ARGS_((ClientData clientData,
1067                             Tcl_Interp *interp, int argc, CONST char **argv));
1068 EXTERN int              Tk_TkObjCmd _ANSI_ARGS_((ClientData clientData,
1069                             Tcl_Interp *interp, int objc,
1070                             Tcl_Obj *CONST objv[]));
1071 EXTERN int              Tk_TkwaitObjCmd _ANSI_ARGS_((ClientData clientData,
1072                             Tcl_Interp *interp, int objc,
1073                             Tcl_Obj *CONST objv[]));
1074 EXTERN int              Tk_ToplevelObjCmd _ANSI_ARGS_((ClientData clientData,
1075                             Tcl_Interp *interp, int objc,
1076                             Tcl_Obj *CONST objv[]));
1077 EXTERN int              Tk_UpdateObjCmd _ANSI_ARGS_((ClientData clientData,
1078                             Tcl_Interp *interp, int objc, 
1079                             Tcl_Obj *CONST objv[]));
1080 EXTERN int              Tk_WinfoObjCmd _ANSI_ARGS_((ClientData clientData,
1081                             Tcl_Interp *interp, int objc,
1082                             Tcl_Obj *CONST objv[]));
1083 EXTERN int              Tk_WmObjCmd _ANSI_ARGS_((ClientData clientData,
1084                             Tcl_Interp *interp, int objc,
1085                             Tcl_Obj *CONST objv[]));
1086
1087 EXTERN void             TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
1088                             int devId, CONST char *buffer, long size));
1089
1090 EXTERN void             TkEventInit _ANSI_ARGS_((void));
1091
1092 EXTERN void             TkRegisterObjTypes _ANSI_ARGS_((void));
1093
1094 EXTERN int              TkCreateMenuCmd _ANSI_ARGS_((Tcl_Interp *interp));
1095 EXTERN int              TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
1096                             Tcl_Interp *interp, int argc, CONST char **argv));
1097
1098 EXTERN int              TkpTestembedCmd _ANSI_ARGS_((ClientData clientData,
1099                             Tcl_Interp *interp, int argc, CONST char **argv));
1100 EXTERN int              TkCanvasGetCoordObj _ANSI_ARGS_((Tcl_Interp *interp,
1101                             Tk_Canvas canvas, Tcl_Obj *obj,
1102                             double *doublePtr));
1103 EXTERN int              TkCanvasDashParseProc _ANSI_ARGS_((
1104                             ClientData clientData, Tcl_Interp *interp,
1105                             Tk_Window tkwin, CONST char *value, char *widgRec,
1106                             int offset));
1107 EXTERN char *           TkCanvasDashPrintProc _ANSI_ARGS_((
1108                             ClientData clientData, Tk_Window tkwin,
1109                             char *widgRec, int offset,
1110                             Tcl_FreeProc **freeProcPtr));
1111 EXTERN int              TkGetDoublePixels _ANSI_ARGS_((Tcl_Interp *interp,
1112                             Tk_Window tkwin, CONST char *string,
1113                             double *doublePtr));
1114 EXTERN CONST Tk_OptionSpec *
1115                         TkGetOptionSpec _ANSI_ARGS_((CONST char *name,
1116                             Tk_OptionTable optionTable));
1117 EXTERN int              TkOffsetParseProc _ANSI_ARGS_((
1118                             ClientData clientData, Tcl_Interp *interp,
1119                             Tk_Window tkwin, CONST char *value, char *widgRec,
1120                             int offset));
1121 EXTERN char *           TkOffsetPrintProc _ANSI_ARGS_((
1122                             ClientData clientData, Tk_Window tkwin,
1123                             char *widgRec, int offset,
1124                             Tcl_FreeProc **freeProcPtr));
1125 EXTERN int              TkOrientParseProc _ANSI_ARGS_((
1126                             ClientData clientData, Tcl_Interp *interp,
1127                             Tk_Window tkwin, CONST char *value,
1128                             char *widgRec, int offset));
1129 EXTERN char *           TkOrientPrintProc _ANSI_ARGS_((
1130                             ClientData clientData, Tk_Window tkwin,
1131                             char *widgRec, int offset,
1132                             Tcl_FreeProc **freeProcPtr));
1133 EXTERN int              TkPixelParseProc _ANSI_ARGS_((
1134                             ClientData clientData, Tcl_Interp *interp,
1135                             Tk_Window tkwin, CONST char *value, char *widgRec,
1136                             int offset));
1137 EXTERN char *           TkPixelPrintProc _ANSI_ARGS_((
1138                             ClientData clientData, Tk_Window tkwin,
1139                             char *widgRec, int offset,
1140                             Tcl_FreeProc **freeProcPtr));
1141 EXTERN int              TkPostscriptImage _ANSI_ARGS_((Tcl_Interp *interp,
1142                             Tk_Window tkwin, Tk_PostscriptInfo psInfo,
1143                             XImage *ximage, int x, int y, int width,
1144                             int height));
1145 EXTERN int              TkSmoothParseProc _ANSI_ARGS_((ClientData clientData,
1146                             Tcl_Interp *interp, Tk_Window tkwin,
1147                             CONST char *value, char *recordPtr, int offset));
1148 EXTERN char *           TkSmoothPrintProc _ANSI_ARGS_((ClientData clientData,
1149                             Tk_Window tkwin, char *recordPtr, int offset,
1150                             Tcl_FreeProc **freeProcPtr));
1151 EXTERN int              TkStateParseProc _ANSI_ARGS_((
1152                             ClientData clientData, Tcl_Interp *interp,
1153                             Tk_Window tkwin, CONST char *value,
1154                             char *widgRec, int offset));
1155 EXTERN char *           TkStatePrintProc _ANSI_ARGS_((
1156                             ClientData clientData, Tk_Window tkwin,
1157                             char *widgRec, int offset,
1158                             Tcl_FreeProc **freeProcPtr));
1159 EXTERN int              TkTileParseProc _ANSI_ARGS_((
1160                             ClientData clientData, Tcl_Interp *interp,
1161                             Tk_Window tkwin, CONST char *value, char *widgRec,
1162                             int offset));
1163 EXTERN char *           TkTilePrintProc _ANSI_ARGS_((
1164                             ClientData clientData, Tk_Window tkwin,
1165                             char *widgRec, int offset,
1166                             Tcl_FreeProc **freeProcPtr));
1167
1168 /* 
1169  * Unsupported commands.
1170  */
1171 EXTERN int              TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
1172                             Tcl_Interp *interp, int argc, CONST char **argv));
1173
1174 # undef TCL_STORAGE_CLASS
1175 # define TCL_STORAGE_CLASS DLLIMPORT
1176
1177 #endif  /* _TKINT */