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