Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:32:08

0001 /*
0002  * tkInt.h --
0003  *
0004  *  Declarations for things used internally by the Tk functions but not
0005  *  exported outside the module.
0006  *
0007  * Copyright (c) 1990-1994 The Regents of the University of California.
0008  * Copyright (c) 1994-1997 Sun Microsystems, Inc.
0009  * Copyright (c) 1998 Scriptics Corporation.
0010  *
0011  * See the file "license.terms" for information on usage and redistribution of
0012  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
0013  */
0014 
0015 #ifndef _TKINT
0016 #define _TKINT
0017 
0018 #ifndef _TKPORT
0019 #include "tkPort.h"
0020 #endif
0021 
0022 #define TK_OPTION_ENUM_VAR      ((int)(sizeof(Tk_OptionType)&(sizeof(int)-1))<<6)
0023 
0024 /*
0025  * Ensure WORDS_BIGENDIAN is defined correctly:
0026  * Needs to happen here in addition to configure to work with fat compiles on
0027  * Darwin (where configure runs only once for multiple architectures).
0028  */
0029 
0030 #include <stdio.h>
0031 #ifdef HAVE_SYS_TYPES_H
0032 #    include <sys/types.h>
0033 #endif
0034 #ifdef HAVE_SYS_PARAM_H
0035 #    include <sys/param.h>
0036 #endif
0037 #ifdef BYTE_ORDER
0038 #    ifdef BIG_ENDIAN
0039 #    if BYTE_ORDER == BIG_ENDIAN
0040 #        undef WORDS_BIGENDIAN
0041 #        define WORDS_BIGENDIAN 1
0042 #    endif
0043 #    endif
0044 #    ifdef LITTLE_ENDIAN
0045 #    if BYTE_ORDER == LITTLE_ENDIAN
0046 #        undef WORDS_BIGENDIAN
0047 #    endif
0048 #    endif
0049 #endif
0050 
0051 /*
0052  * Used to tag functions that are only to be visible within the module being
0053  * built and not outside it (where this is supported by the linker).
0054  */
0055 
0056 #ifndef MODULE_SCOPE
0057 #   ifdef __cplusplus
0058 #   define MODULE_SCOPE extern "C"
0059 #   else
0060 #   define MODULE_SCOPE extern
0061 #   endif
0062 #endif
0063 
0064 #ifndef JOIN
0065 #  define JOIN(a,b) JOIN1(a,b)
0066 #  define JOIN1(a,b) a##b
0067 #endif
0068 
0069 #ifndef TCL_UNUSED
0070 #   if defined(__cplusplus)
0071 #   define TCL_UNUSED(T) T
0072 #   elif defined(__GNUC__) && (__GNUC__ > 2)
0073 #   define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused))
0074 #   else
0075 #   define TCL_UNUSED(T) T JOIN(dummy, __LINE__)
0076 #   endif
0077 #endif
0078 
0079 #if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
0080 # if TCL_UTF_MAX > 3
0081 #   define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c)
0082 #   define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c)
0083 # else
0084 #   define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString)
0085 #   define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString)
0086 # endif
0087 #endif
0088 
0089 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
0090 #   define TKFLEXARRAY
0091 #elif defined(__GNUC__) && (__GNUC__ > 2)
0092 #   define TKFLEXARRAY 0
0093 #else
0094 #   define TKFLEXARRAY 1
0095 #endif
0096 
0097 #ifndef Tcl_GetParent
0098 #   define Tcl_GetParent Tcl_GetMaster
0099 #endif
0100 
0101 /*
0102  * Macros used to cast between pointers and integers (e.g. when storing an int
0103  * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
0104  * to/from pointer from/to integer of different size".
0105  */
0106 
0107 #if !defined(INT2PTR) && !defined(PTR2INT)
0108 #   if defined(HAVE_INTPTR_T) || defined(intptr_t)
0109 #   define INT2PTR(p) ((void*)(intptr_t)(p))
0110 #   define PTR2INT(p) ((int)(intptr_t)(p))
0111 #   else
0112 #   define INT2PTR(p) ((void*)(p))
0113 #   define PTR2INT(p) ((int)(p))
0114 #   endif
0115 #endif
0116 #if !defined(UINT2PTR) && !defined(PTR2UINT)
0117 #   if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
0118 #   define UINT2PTR(p) ((void*)(uintptr_t)(p))
0119 #   define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
0120 #   else
0121 #   define UINT2PTR(p) ((void*)(p))
0122 #   define PTR2UINT(p) ((unsigned int)(p))
0123 #   endif
0124 #endif
0125 
0126 #ifndef TCL_Z_MODIFIER
0127 #   if defined(_WIN64)
0128 #   define TCL_Z_MODIFIER   "I"
0129 #   elif defined(__GNUC__) && !defined(_WIN32)
0130 #   define TCL_Z_MODIFIER   "z"
0131 #   else
0132 #   define TCL_Z_MODIFIER   ""
0133 #   endif
0134 #endif /* !TCL_Z_MODIFIER */
0135 
0136 /*
0137  * Opaque type declarations:
0138  */
0139 
0140 typedef struct TkColormap TkColormap;
0141 typedef struct TkFontAttributes TkFontAttributes;
0142 typedef struct TkGrabEvent TkGrabEvent;
0143 typedef struct TkpCursor_ *TkpCursor;
0144 typedef struct TkRegion_ *TkRegion;
0145 typedef struct TkStressedCmap TkStressedCmap;
0146 typedef struct TkBindInfo_ *TkBindInfo;
0147 typedef struct Busy *TkBusy;
0148 
0149 /*
0150  * One of the following structures is maintained for each cursor in use in the
0151  * system. This structure is used by tkCursor.c and the various system-
0152  * specific cursor files.
0153  */
0154 
0155 typedef struct TkCursor {
0156     Tk_Cursor cursor;       /* System specific identifier for cursor. */
0157     Display *display;       /* Display containing cursor. Needed for
0158                  * disposal and retrieval of cursors. */
0159     int resourceRefCount;   /* Number of active uses of this cursor (each
0160                  * active use corresponds to a call to
0161                  * Tk_AllocPreserveFromObj or Tk_Preserve). If
0162                  * this count is 0, then this structure is no
0163                  * longer valid and it isn't present in a hash
0164                  * table: it is being kept around only because
0165                  * there are objects referring to it. The
0166                  * structure is freed when resourceRefCount
0167                  * and objRefCount are both 0. */
0168     int objRefCount;        /* Number of Tcl objects that reference this
0169                  * structure.. */
0170     Tcl_HashTable *otherTable;  /* Second table (other than idTable) used to
0171                  * index this entry. */
0172     Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure
0173                  * (needed when deleting). */
0174     Tcl_HashEntry *idHashPtr;   /* Entry in idTable for this structure (needed
0175                  * when deleting). */
0176     struct TkCursor *nextPtr;   /* Points to the next TkCursor structure with
0177                  * the same name. Cursors with the same name
0178                  * but different displays are chained together
0179                  * off a single hash table entry. */
0180 } TkCursor;
0181 
0182 /*
0183  * The following structure is kept one-per-TkDisplay to maintain information
0184  * about the caret (cursor location) on this display. This is used to dictate
0185  * global focus location (Windows Accessibility guidelines) and to position
0186  * the IME or XIM over-the-spot window.
0187  */
0188 
0189 typedef struct TkCaret {
0190     struct TkWindow *winPtr;    /* The window on which we requested caret
0191                  * placement. */
0192     int x;          /* Relative x coord of the caret. */
0193     int y;          /* Relative y coord of the caret. */
0194     int height;         /* Specified height of the window. */
0195 } TkCaret;
0196 
0197 /*
0198  * One of the following structures is maintained for each display containing a
0199  * window managed by Tk. In part, the structure is used to store thread-
0200  * specific data, since each thread will have its own TkDisplay structure.
0201  */
0202 
0203 typedef struct TkDisplay {
0204     Display *display;       /* Xlib's info about display. */
0205     struct TkDisplay *nextPtr;  /* Next in list of all displays. */
0206     char *name;         /* Name of display (with any screen identifier
0207                  * removed). Malloc-ed. */
0208     Time lastEventTime;     /* Time of last event received for this
0209                  * display. */
0210 
0211     /*
0212      * Information used primarily by tk3d.c:
0213      */
0214 
0215     int borderInit;     /* 0 means borderTable needs initializing. */
0216     Tcl_HashTable borderTable;  /* Maps from color name to TkBorder
0217                  * structure. */
0218 
0219     /*
0220      * Information used by tkAtom.c only:
0221      */
0222 
0223     int atomInit;       /* 0 means stuff below hasn't been initialized
0224                  * yet. */
0225     Tcl_HashTable nameTable;    /* Maps from names to Atom's. */
0226     Tcl_HashTable atomTable;    /* Maps from Atom's back to names. */
0227 
0228     /*
0229      * Information used primarily by tkBind.c:
0230      */
0231 
0232     int bindInfoStale;      /* Non-zero means the variables in this part
0233                  * of the structure are potentially incorrect
0234                  * and should be recomputed. */
0235     unsigned int modeModMask;   /* Has one bit set to indicate the modifier
0236                  * corresponding to "mode shift". If no such
0237                  * modifier, than this is zero. */
0238     unsigned int metaModMask;   /* Has one bit set to indicate the modifier
0239                  * corresponding to the "Meta" key. If no such
0240                  * modifier, then this is zero. */
0241     unsigned int altModMask;    /* Has one bit set to indicate the modifier
0242                  * corresponding to the "Meta" key. If no such
0243                  * modifier, then this is zero. */
0244     enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
0245                 /* Indicates how to interpret lock
0246                  * modifier. */
0247     int numModKeyCodes;     /* Number of entries in modKeyCodes array
0248                  * below. */
0249     KeyCode *modKeyCodes;   /* Pointer to an array giving keycodes for all
0250                  * of the keys that have modifiers associated
0251                  * with them. Malloc'ed, but may be NULL. */
0252 
0253     /*
0254      * Information used by tkBitmap.c only:
0255      */
0256 
0257     int bitmapInit;     /* 0 means tables above need initializing. */
0258     int bitmapAutoNumber;   /* Used to number bitmaps. */
0259     Tcl_HashTable bitmapNameTable;
0260                 /* Maps from name of bitmap to the first
0261                  * TkBitmap record for that name. */
0262     Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
0263                  * structure for the bitmap. */
0264     Tcl_HashTable bitmapDataTable;
0265                 /* Used by Tk_GetBitmapFromData to map from a
0266                  * collection of in-core data about a bitmap
0267                  * to a reference giving an automatically-
0268                  * generated name for the bitmap. */
0269 
0270     /*
0271      * Information used by tkCanvas.c only:
0272      */
0273 
0274     int numIdSearches;
0275     int numSlowSearches;
0276 
0277     /*
0278      * Used by tkColor.c only:
0279      */
0280 
0281     int colorInit;      /* 0 means color module needs initializing. */
0282     TkStressedCmap *stressPtr;  /* First in list of colormaps that have filled
0283                  * up, so we have to pick an approximate
0284                  * color. */
0285     Tcl_HashTable colorNameTable;
0286                 /* Maps from color name to TkColor structure
0287                  * for that color. */
0288     Tcl_HashTable colorValueTable;
0289                 /* Maps from integer RGB values to TkColor
0290                  * structures. */
0291 
0292     /*
0293      * Used by tkCursor.c only:
0294      */
0295 
0296     int cursorInit;     /* 0 means cursor module need initializing. */
0297     Tcl_HashTable cursorNameTable;
0298                 /* Maps from a string name to a cursor to the
0299                  * TkCursor record for the cursor. */
0300     Tcl_HashTable cursorDataTable;
0301                 /* Maps from a collection of in-core data
0302                  * about a cursor to a TkCursor structure. */
0303     Tcl_HashTable cursorIdTable;
0304                 /* Maps from a cursor id to the TkCursor
0305                  * structure for the cursor. */
0306     char cursorString[20];  /* Used to store a cursor id string. */
0307     Font cursorFont;        /* Font to use for standard cursors. None
0308                  * means font not loaded yet. */
0309 
0310     /*
0311      * Information used by tkError.c only:
0312      */
0313 
0314     struct TkErrorHandler *errorPtr;
0315                 /* First in list of error handlers for this
0316                  * display. NULL means no handlers exist at
0317                  * present. */
0318     int deleteCount;        /* Counts # of handlers deleted since last
0319                  * time inactive handlers were garbage-
0320                  * collected. When this number gets big,
0321                  * handlers get cleaned up. */
0322 
0323     /*
0324      * Used by tkEvent.c only:
0325      */
0326 
0327     struct TkWindowEvent *delayedMotionPtr;
0328                 /* Points to a malloc-ed motion event whose
0329                  * processing has been delayed in the hopes
0330                  * that another motion event will come along
0331                  * right away and we can merge the two of them
0332                  * together. NULL means that there is no
0333                  * delayed motion event. */
0334 
0335     /*
0336      * Information used by tkFocus.c only:
0337      */
0338 
0339     int focusDebug;     /* 1 means collect focus debugging
0340                  * statistics. */
0341     struct TkWindow *implicitWinPtr;
0342                 /* If the focus arrived at a toplevel window
0343                  * implicitly via an Enter event (rather than
0344                  * via a FocusIn event), this points to the
0345                  * toplevel window. Otherwise it is NULL. */
0346     struct TkWindow *focusPtr;  /* Points to the window on this display that
0347                  * should be receiving keyboard events. When
0348                  * multiple applications on the display have
0349                  * the focus, this will refer to the innermost
0350                  * window in the innermost application. This
0351                  * information isn't used on Windows, but it's
0352                  * needed on the Mac, and also on X11 when XIM
0353                  * processing is being done. */
0354 
0355     /*
0356      * Information used by tkGC.c only:
0357      */
0358 
0359     Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
0360                  * describing a GC with those values. */
0361     Tcl_HashTable gcIdTable;    /* Maps from a GC to a TkGC. */
0362     int gcInit;         /* 0 means the tables below need
0363                  * initializing. */
0364 
0365     /*
0366      * Information used by tkGeometry.c only:
0367      */
0368 
0369     Tcl_HashTable maintainHashTable;
0370                 /* Hash table that maps from a container's
0371                  * Tk_Window token to a list of windows managed
0372                  * by that container. */
0373     int geomInit;
0374 
0375     /*
0376      * Information used by tkGrid.c, tkPack.c, tkPlace.c, tkPointer.c,
0377      * and ttkMacOSXTheme.c:
0378      */
0379 
0380 #define TkGetContainer(tkwin) (Tk_TopWinHierarchy((TkWindow *)tkwin) ? NULL : \
0381     (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
0382      ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr))
0383 
0384     /*
0385      * Information used by tkGet.c only:
0386      */
0387 
0388     Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */
0389     int uidInit;        /* 0 means uidTable needs initializing. */
0390 
0391     /*
0392      * Information used by tkGrab.c only:
0393      */
0394 
0395     struct TkWindow *grabWinPtr;/* Window in which the pointer is currently
0396                  * grabbed, or NULL if none. */
0397     struct TkWindow *eventualGrabWinPtr;
0398                 /* Value that grabWinPtr will have once the
0399                  * grab event queue (below) has been
0400                  * completely emptied. */
0401     struct TkWindow *buttonWinPtr;
0402                 /* Window in which first mouse button was
0403                  * pressed while grab was in effect, or NULL
0404                  * if no such press in effect. */
0405     struct TkWindow *serverWinPtr;
0406                 /* If no application contains the pointer then
0407                  * this is NULL. Otherwise it contains the
0408                  * last window for which we've gotten an Enter
0409                  * or Leave event from the server (i.e. the
0410                  * last window known to have contained the
0411                  * pointer). Doesn't reflect events that were
0412                  * synthesized in tkGrab.c. */
0413     TkGrabEvent *firstGrabEventPtr;
0414                 /* First in list of enter/leave events
0415                  * synthesized by grab code. These events must
0416                  * be processed in order before any other
0417                  * events are processed. NULL means no such
0418                  * events. */
0419     TkGrabEvent *lastGrabEventPtr;
0420                 /* Last in list of synthesized events, or NULL
0421                  * if list is empty. */
0422     int grabFlags;      /* Miscellaneous flag values. See definitions
0423                  * in tkGrab.c. */
0424 
0425     /*
0426      * Information used by tkGrid.c only:
0427      */
0428 
0429     int gridInit;       /* 0 means table below needs initializing. */
0430     Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding
0431                  * Grid structures. */
0432 
0433     /*
0434      * Information used by tkImage.c only:
0435      */
0436 
0437     int imageId;        /* Value used to number image ids. */
0438 
0439     /*
0440      * Information used by tkMacWinMenu.c only:
0441      */
0442 
0443     int postCommandGeneration;
0444 
0445     /*
0446      * Information used by tkPack.c only.
0447      */
0448 
0449     int packInit;       /* 0 means table below needs initializing. */
0450     Tcl_HashTable packerHashTable;
0451                 /* Maps from Tk_Window tokens to corresponding
0452                  * Packer structures. */
0453 
0454     /*
0455      * Information used by tkPlace.c only.
0456      */
0457 
0458     int placeInit;      /* 0 means tables below need initializing. */
0459     Tcl_HashTable masterTable;  /* Maps from Tk_Window toke to the Master
0460                  * structure for the window, if it exists. */
0461     Tcl_HashTable slaveTable;   /* Maps from Tk_Window toke to the Slave
0462                  * structure for the window, if it exists. */
0463 
0464     /*
0465      * Information used by tkSelect.c and tkClipboard.c only:
0466      */
0467 
0468     struct TkSelectionInfo *selectionInfoPtr;
0469                 /* First in list of selection information
0470                  * records. Each entry contains information
0471                  * about the current owner of a particular
0472                  * selection on this display. */
0473     Atom multipleAtom;      /* Atom for MULTIPLE. None means selection
0474                  * stuff isn't initialized. */
0475     Atom incrAtom;      /* Atom for INCR. */
0476     Atom targetsAtom;       /* Atom for TARGETS. */
0477     Atom timestampAtom;     /* Atom for TIMESTAMP. */
0478     Atom textAtom;      /* Atom for TEXT. */
0479     Atom compoundTextAtom;  /* Atom for COMPOUND_TEXT. */
0480     Atom applicationAtom;   /* Atom for TK_APPLICATION. */
0481     Atom windowAtom;        /* Atom for TK_WINDOW. */
0482     Atom clipboardAtom;     /* Atom for CLIPBOARD. */
0483     Atom utf8Atom;      /* Atom for UTF8_STRING. */
0484     Atom atomPairAtom;          /* Atom for ATOM_PAIR. */
0485 
0486     Tk_Window clipWindow;   /* Window used for clipboard ownership and to
0487                  * retrieve selections between processes. NULL
0488                  * means clipboard info hasn't been
0489                  * initialized. */
0490     int clipboardActive;    /* 1 means we currently own the clipboard
0491                  * selection, 0 means we don't. */
0492     struct TkMainInfo *clipboardAppPtr;
0493                 /* Last application that owned clipboard. */
0494     struct TkClipboardTarget *clipTargetPtr;
0495                 /* First in list of clipboard type information
0496                  * records. Each entry contains information
0497                  * about the buffers for a given selection
0498                  * target. */
0499 
0500     /*
0501      * Information used by tkSend.c only:
0502      */
0503 
0504     Tk_Window commTkwin;    /* Window used for communication between
0505                  * interpreters during "send" commands. NULL
0506                  * means send info hasn't been initialized
0507                  * yet. */
0508     Atom commProperty;      /* X's name for comm property. */
0509     Atom registryProperty;  /* X's name for property containing registry
0510                  * of interpreter names. */
0511     Atom appNameProperty;   /* X's name for property used to hold the
0512                  * application name on each comm window. */
0513 
0514     /*
0515      * Information used by tkUnixWm.c and tkWinWm.c only:
0516      */
0517 
0518     struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */
0519     struct TkWmInfo *foregroundWmPtr;
0520                 /* Points to the foreground window. */
0521 
0522     /*
0523      * Information used by tkVisual.c only:
0524      */
0525 
0526     TkColormap *cmapPtr;    /* First in list of all non-default colormaps
0527                  * allocated for this display. */
0528 
0529     /*
0530      * Miscellaneous information:
0531      */
0532 
0533 #ifdef TK_USE_INPUT_METHODS
0534     XIM inputMethod;        /* Input method for this display. */
0535     XIMStyle inputStyle;    /* Input style selected for this display. */
0536     XFontSet inputXfs;      /* XFontSet cached for over-the-spot XIM. */
0537 #endif /* TK_USE_INPUT_METHODS */
0538     Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
0539 
0540     int refCount;       /* Reference count of how many Tk applications
0541                  * are using this display. Used to clean up
0542                  * the display when we no longer have any Tk
0543                  * applications using it. */
0544 
0545     /*
0546      * The following field were all added for Tk8.3
0547      */
0548 
0549     int mouseButtonState;   /* Current mouse button state for this
0550                  * display. NOT USED as of 8.6.10 */
0551     Window mouseButtonWindow;   /* Window the button state was set in, added
0552                  * in Tk 8.4. */
0553     Tk_Window warpWindow;
0554     Tk_Window warpMainwin;  /* For finding the root window for warping
0555                  * purposes. */
0556     int warpX;
0557     int warpY;
0558 
0559     /*
0560      * The following field(s) were all added for Tk8.4
0561      */
0562 
0563     unsigned int flags;     /* Various flag values: these are all defined
0564                  * in below. */
0565     TkCaret caret;      /* Information about the caret for this
0566                  * display. This is not a pointer. */
0567 
0568     int iconDataSize;       /* Size of default iconphoto image data. */
0569     unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
0570 #ifdef TK_USE_INPUT_METHODS
0571     int ximGeneration;          /* Used to invalidate XIC */
0572 #endif /* TK_USE_INPUT_METHODS */
0573 } TkDisplay;
0574 
0575 /*
0576  * Flag values for TkDisplay flags.
0577  *  TK_DISPLAY_COLLAPSE_MOTION_EVENTS:  (default on)
0578  *  Indicates that we should collapse motion events on this display
0579  *  TK_DISPLAY_USE_IM:          (default on, set via tk.tcl)
0580  *  Whether to use input methods for this display
0581  *  TK_DISPLAY_WM_TRACING:      (default off)
0582  *  Whether we should do wm tracing on this display.
0583  *  TK_DISPLAY_IN_WARP:         (default off)
0584  *  Indicates that we are in a pointer warp
0585  */
0586 
0587 #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS   (1 << 0)
0588 #define TK_DISPLAY_USE_IM           (1 << 1)
0589 #define TK_DISPLAY_WM_TRACING           (1 << 3)
0590 #define TK_DISPLAY_IN_WARP          (1 << 4)
0591 #define TK_DISPLAY_USE_XKB          (1 << 5)
0592 
0593 /*
0594  * One of the following structures exists for each error handler created by a
0595  * call to Tk_CreateErrorHandler. The structure is managed by tkError.c.
0596  */
0597 
0598 typedef struct TkErrorHandler {
0599     TkDisplay *dispPtr;     /* Display to which handler applies. */
0600     unsigned long firstRequest; /* Only errors with serial numbers >= to this
0601                  * are considered. */
0602     unsigned long lastRequest;  /* Only errors with serial numbers <= to this
0603                  * are considered. This field is filled in
0604                  * when XUnhandle is called. -1 means
0605                  * XUnhandle hasn't been called yet. */
0606     int error;          /* Consider only errors with this error_code
0607                  * (-1 means consider all errors). */
0608     int request;        /* Consider only errors with this major
0609                  * request code (-1 means consider all major
0610                  * codes). */
0611     int minorCode;      /* Consider only errors with this minor
0612                  * request code (-1 means consider all minor
0613                  * codes). */
0614     Tk_ErrorProc *errorProc;    /* Function to invoke when a matching error
0615                  * occurs. NULL means just ignore errors. */
0616     ClientData clientData;  /* Arbitrary value to pass to errorProc. */
0617     struct TkErrorHandler *nextPtr;
0618                 /* Pointer to next older handler for this
0619                  * display, or NULL for end of list. */
0620 } TkErrorHandler;
0621 
0622 /*
0623  * One of the following structures exists for each event handler created by
0624  * calling Tk_CreateEventHandler. This information is used by tkEvent.c only.
0625  */
0626 
0627 typedef struct TkEventHandler {
0628     unsigned long mask;     /* Events for which to invoke proc. */
0629     Tk_EventProc *proc;     /* Function to invoke when an event in mask
0630                  * occurs. */
0631     ClientData clientData;  /* Argument to pass to proc. */
0632     struct TkEventHandler *nextPtr;
0633                 /* Next in list of handlers associated with
0634                  * window (NULL means end of list). */
0635 } TkEventHandler;
0636 
0637 /*
0638  * Tk keeps one of the following data structures for each main window (created
0639  * by a call to TkCreateMainWindow). It stores information that is shared by
0640  * all of the windows associated with a particular main window.
0641  */
0642 
0643 typedef struct TkMainInfo {
0644     int refCount;       /* Number of windows whose "mainPtr" fields
0645                  * point here. When this becomes zero, can
0646                  * free up the structure (the reference count
0647                  * is zero because windows can get deleted in
0648                  * almost any order; the main window isn't
0649                  * necessarily the last one deleted). */
0650     struct TkWindow *winPtr;    /* Pointer to main window. */
0651     Tcl_Interp *interp;     /* Interpreter associated with application. */
0652     Tcl_HashTable nameTable;    /* Hash table mapping path names to TkWindow
0653                  * structs for all windows related to this
0654                  * main window. Managed by tkWindow.c. */
0655     long deletionEpoch;     /* Incremented by window deletions. */
0656     Tk_BindingTable bindingTable;
0657                 /* Used in conjunction with "bind" command to
0658                  * bind events to Tcl commands. */
0659     TkBindInfo bindInfo;    /* Information used by tkBind.c on a per
0660                  * application basis. */
0661     struct TkFontInfo *fontInfoPtr;
0662                 /* Information used by tkFont.c on a per
0663                  * application basis. */
0664 
0665     /*
0666      * Information used only by tkFocus.c and tk*Embed.c:
0667      */
0668 
0669     struct TkToplevelFocusInfo *tlFocusPtr;
0670                 /* First in list of records containing focus
0671                  * information for each top-level in the
0672                  * application. Used only by tkFocus.c. */
0673     struct TkDisplayFocusInfo *displayFocusPtr;
0674                 /* First in list of records containing focus
0675                  * information for each display that this
0676                  * application has ever used. Used only by
0677                  * tkFocus.c. */
0678 
0679     struct ElArray *optionRootPtr;
0680                 /* Top level of option hierarchy for this main
0681                  * window. NULL means uninitialized. Managed
0682                  * by tkOption.c. */
0683     Tcl_HashTable imageTable;   /* Maps from image names to Tk_ImageModel
0684                  * structures. Managed by tkImage.c. */
0685     int strictMotif;        /* This is linked to the tk_strictMotif global
0686                  * variable. */
0687     int alwaysShowSelection;    /* This is linked to the
0688                  * ::tk::AlwaysShowSelection variable. */
0689     struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
0690                  * this process. */
0691     Tcl_HashTable busyTable;    /* Information used by [tk busy] command. */
0692     Tcl_ObjCmdProc *tclUpdateObjProc;
0693                 /* Saved Tcl [update] command, used to restore
0694                  * Tcl's version of [update] after Tk is shut
0695                  * down */
0696     unsigned int ttkNbTabsStickBit;
0697                 /* Information used by ttk::notebook. */
0698 } TkMainInfo;
0699 
0700 /*
0701  * Tk keeps the following data structure for each of it's builtin bitmaps.
0702  * This structure is only used by tkBitmap.c and other platform specific
0703  * bitmap files.
0704  */
0705 
0706 typedef struct {
0707     const void *source;     /* Bits for bitmap. */
0708     int width, height;      /* Dimensions of bitmap. */
0709     int native;         /* 0 means generic (X style) bitmap, 1 means
0710                  * native style bitmap. */
0711 } TkPredefBitmap;
0712 
0713 /*
0714  * Tk keeps one of the following structures for each window. Some of the
0715  * information (like size and location) is a shadow of information managed by
0716  * the X server, and some is special information used here, such as event and
0717  * geometry management information. This information is (mostly) managed by
0718  * tkWindow.c. WARNING: the declaration below must be kept consistent with the
0719  * Tk_FakeWin structure in tk.h. If you change one, be sure to change the
0720  * other!
0721  */
0722 
0723 typedef struct TkWindow {
0724     /*
0725      * Structural information:
0726      */
0727 
0728     Display *display;       /* Display containing window. */
0729     TkDisplay *dispPtr;     /* Tk's information about display for
0730                  * window. */
0731     int screenNum;      /* Index of screen for window, among all those
0732                  * for dispPtr. */
0733     Visual *visual;     /* Visual to use for window. If not default,
0734                  * MUST be set before X window is created. */
0735     int depth;          /* Number of bits/pixel. */
0736     Window window;      /* X's id for window. None means window hasn't
0737                  * actually been created yet, or it's been
0738                  * deleted. */
0739     struct TkWindow *childList; /* First in list of child windows, or NULL if
0740                  * no children. List is in stacking order,
0741                  * lowest window first.*/
0742     struct TkWindow *lastChildPtr;
0743                 /* Last in list of child windows (highest in
0744                  * stacking order), or NULL if no children. */
0745     struct TkWindow *parentPtr; /* Pointer to parent window (logical parent,
0746                  * not necessarily X parent). NULL means
0747                  * either this is the main window, or the
0748                  * window's parent has already been deleted. */
0749     struct TkWindow *nextPtr;   /* Next higher sibling (in stacking order) in
0750                  * list of children with same parent. NULL
0751                  * means end of list. */
0752     TkMainInfo *mainPtr;    /* Information shared by all windows
0753                  * associated with a particular main window.
0754                  * NULL means this window is a rogue that is
0755                  * not associated with any application (at
0756                  * present, this only happens for the dummy
0757                  * windows used for "send" communication). */
0758 
0759     /*
0760      * Name and type information for the window:
0761      */
0762 
0763     char *pathName;     /* Path name of window (concatenation of all
0764                  * names between this window and its top-level
0765                  * ancestor). This is a pointer into an entry
0766                  * in mainPtr->nameTable. NULL means that the
0767                  * window hasn't been completely created
0768                  * yet. */
0769     Tk_Uid nameUid;     /* Name of the window within its parent
0770                  * (unique within the parent). */
0771     Tk_Uid classUid;        /* Class of the window. NULL means window
0772                  * hasn't been given a class yet. */
0773 
0774     /*
0775      * Geometry and other attributes of window. This information may not be
0776      * updated on the server immediately; stuff that hasn't been reflected in
0777      * the server yet is called "dirty". At present, information can be dirty
0778      * only if the window hasn't yet been created.
0779      */
0780 
0781     XWindowChanges changes; /* Geometry and other info about window. */
0782     unsigned int dirtyChanges;  /* Bits indicate fields of "changes" that are
0783                  * dirty. */
0784     XSetWindowAttributes atts;  /* Current attributes of window. */
0785     unsigned long dirtyAtts;    /* Bits indicate fields of "atts" that are
0786                  * dirty. */
0787 
0788     unsigned int flags;     /* Various flag values: these are all defined
0789                  * in tk.h (confusing, but they're needed
0790                  * there for some query macros). */
0791 
0792     /*
0793      * Information kept by the event manager (tkEvent.c):
0794      */
0795 
0796     TkEventHandler *handlerList;/* First in list of event handlers declared
0797                  * for this window, or NULL if none. */
0798 #ifdef TK_USE_INPUT_METHODS
0799     XIC inputContext;       /* XIM input context. */
0800 #endif /* TK_USE_INPUT_METHODS */
0801 
0802     /*
0803      * Information used for event bindings (see "bind" and "bindtags" commands
0804      * in tkCmds.c):
0805      */
0806 
0807     ClientData *tagPtr;     /* Points to array of tags used for bindings
0808                  * on this window. Each tag is a Tk_Uid.
0809                  * Malloc'ed. NULL means no tags. */
0810     int numTags;        /* Number of tags at *tagPtr. */
0811 
0812     /*
0813      * Information used by tkOption.c to manage options for the window.
0814      */
0815 
0816     int optionLevel;        /* -1 means no option information is currently
0817                  * cached for this window. Otherwise this
0818                  * gives the level in the option stack at
0819                  * which info is cached. */
0820     /*
0821      * Information used by tkSelect.c to manage the selection.
0822      */
0823 
0824     struct TkSelHandler *selHandlerList;
0825                 /* First in list of handlers for returning the
0826                  * selection in various forms. */
0827 
0828     /*
0829      * Information used by tkGeometry.c for geometry management.
0830      */
0831 
0832     const Tk_GeomMgr *geomMgrPtr;
0833                 /* Information about geometry manager for this
0834                  * window. */
0835     ClientData geomData;    /* Argument for geometry manager functions. */
0836     int reqWidth, reqHeight;    /* Arguments from last call to
0837                  * Tk_GeometryRequest, or 0's if
0838                  * Tk_GeometryRequest hasn't been called. */
0839     int internalBorderLeft; /* Width of internal border of window (0 means
0840                  * no internal border). Geometry managers
0841                  * should not normally place children on top
0842                  * of the border. Fields for the other three
0843                  * sides are found below. */
0844 
0845     /*
0846      * Information maintained by tkWm.c for window manager communication.
0847      */
0848 
0849     struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also for special
0850                  * Unix menubar and wrapper windows), points
0851                  * to structure with wm-related info (see
0852                  * tkWm.c). For other windows, this is
0853                  * NULL. */
0854 
0855     /*
0856      * Information used by widget classes.
0857      */
0858 
0859     const Tk_ClassProcs *classProcsPtr;
0860     ClientData instanceData;
0861 
0862     /*
0863      * Platform specific information private to each port.
0864      */
0865 
0866     struct TkWindowPrivate *privatePtr;
0867 
0868     /*
0869      * More information used by tkGeometry.c for geometry management.
0870      */
0871 
0872     /* The remaining fields of internal border. */
0873     int internalBorderRight;
0874     int internalBorderTop;
0875     int internalBorderBottom;
0876 
0877     int minReqWidth;        /* Minimum requested width. */
0878     int minReqHeight;       /* Minimum requested height. */
0879 #ifdef TK_USE_INPUT_METHODS
0880     int ximGeneration;          /* Used to invalidate XIC */
0881 #endif /* TK_USE_INPUT_METHODS */
0882     char *geomMgrName;          /* Records the name of the geometry manager. */
0883     struct TkWindow *maintainerPtr;
0884                 /* The geometry container for this window. The
0885                  * value is NULL if the window has no container or
0886                  * if its container is its parent. */
0887 } TkWindow;
0888 
0889 /*
0890  * String tables:
0891  */
0892 
0893 MODULE_SCOPE const char *const tkStateStrings[];
0894 MODULE_SCOPE const char *const tkCompoundStrings[];
0895 
0896 /*
0897  * Real definition of some events. Note that these events come from outside
0898  * but have internally generated pieces added to them.
0899  */
0900 
0901 typedef struct {
0902     XKeyEvent keyEvent;     /* The real event from X11. */
0903 #ifdef _WIN32
0904     char trans_chars[XMaxTransChars];
0905                             /* translated characters */
0906     unsigned char nbytes;
0907 #elif !defined(MAC_OSX_TK)
0908     char *charValuePtr;     /* A pointer to a string that holds the key's
0909                  * %A substitution text (before backslash
0910                  * adding), or NULL if that has not been
0911                  * computed yet. If non-NULL, this string was
0912                  * allocated with ckalloc(). */
0913     int charValueLen;       /* Length of string in charValuePtr when that
0914                  * is non-NULL. */
0915     KeySym keysym;      /* Key symbol computed after input methods
0916                  * have been invoked */
0917 #endif
0918 } TkKeyEvent;
0919 
0920 /*
0921  * Flags passed to TkpMakeMenuWindow's 'transient' argument.
0922  */
0923 
0924 #define TK_MAKE_MENU_TEAROFF    0   /* Only non-transient case. */
0925 #define TK_MAKE_MENU_POPUP  1
0926 #define TK_MAKE_MENU_DROPDOWN   2
0927 
0928 /*
0929  * The following structure is used with TkMakeEnsemble to create ensemble
0930  * commands and optionally to create sub-ensembles.
0931  */
0932 
0933 typedef struct TkEnsemble {
0934     const char *name;
0935     Tcl_ObjCmdProc *proc;
0936     const struct TkEnsemble *subensemble;
0937 } TkEnsemble;
0938 
0939 /*
0940  * The following structure is used as a two way map between integers and
0941  * strings, usually to map between an internal C representation and the
0942  * strings used in Tcl.
0943  */
0944 
0945 typedef struct TkStateMap {
0946     int numKey;         /* Integer representation of a value. */
0947     const char *strKey;     /* String representation of a value. */
0948 } TkStateMap;
0949 
0950 /*
0951  * This structure is used by the Mac and Window porting layers as the internal
0952  * representation of a clip_mask in a GC.
0953  */
0954 
0955 typedef struct TkpClipMask {
0956     int type;           /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */
0957     union {
0958     Pixmap pixmap;
0959     TkRegion region;
0960     } value;
0961 } TkpClipMask;
0962 
0963 #define TKP_CLIP_PIXMAP 0
0964 #define TKP_CLIP_REGION 1
0965 
0966 /*
0967  * Return values from TkGrabState:
0968  */
0969 
0970 #define TK_GRAB_NONE        0
0971 #define TK_GRAB_IN_TREE     1
0972 #define TK_GRAB_ANCESTOR    2
0973 #define TK_GRAB_EXCLUDED    3
0974 
0975 /*
0976  * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags
0977  * for this routine, but don't make public until TkpMeasureCharsInContext is
0978  * made public, too.
0979  */
0980 
0981 #define TK_ISOLATE_END      32
0982 
0983 /*
0984  * The macro below is used to modify a "char" value (e.g. by casting it to an
0985  * unsigned character) so that it can be used safely with macros such as
0986  * isspace().
0987  */
0988 
0989 #define UCHAR(c) ((unsigned char) (c))
0990 
0991 /*
0992  * The following symbol is used in the mode field of FocusIn events generated
0993  * by an embedded application to request the input focus from its container.
0994  */
0995 
0996 #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
0997 
0998 /*
0999  * The following special modifier mask bits are defined, to indicate logical
1000  * modifiers such as Meta and Alt that may float among the actual modifier
1001  * bits.
1002  */
1003 
1004 #define META_MASK   (AnyModifier<<1)
1005 #define ALT_MASK    (AnyModifier<<2)
1006 #define EXTENDED_MASK   (AnyModifier<<3)
1007 
1008 /*
1009  * Mask that selects any of the state bits corresponding to buttons, plus
1010  * masks that select individual buttons' bits:
1011  */
1012 
1013 #define ALL_BUTTONS \
1014     (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
1015 
1016 
1017 MODULE_SCOPE unsigned TkGetButtonMask(unsigned);
1018 
1019 /*
1020  * Object types not declared in tkObj.c need to be mentioned here so they can
1021  * be properly registered with Tcl:
1022  */
1023 
1024 MODULE_SCOPE const Tcl_ObjType tkBorderObjType;
1025 MODULE_SCOPE const Tcl_ObjType tkBitmapObjType;
1026 MODULE_SCOPE const Tcl_ObjType tkColorObjType;
1027 MODULE_SCOPE const Tcl_ObjType tkCursorObjType;
1028 MODULE_SCOPE const Tcl_ObjType tkFontObjType;
1029 MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType;
1030 MODULE_SCOPE const Tcl_ObjType tkTextIndexType;
1031 
1032 /*
1033  * Miscellaneous variables shared among Tk modules but not exported to the
1034  * outside world:
1035  */
1036 
1037 MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod;
1038 MODULE_SCOPE Tk_ImageType   tkBitmapImageType;
1039 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
1040 MODULE_SCOPE void       (*tkHandleEventProc) (XEvent* eventPtr);
1041 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG;
1042 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM;
1043 MODULE_SCOPE TkMainInfo     *tkMainWindowList;
1044 MODULE_SCOPE Tk_ImageType   tkPhotoImageType;
1045 MODULE_SCOPE Tcl_HashTable  tkPredefBitmapTable;
1046 
1047 MODULE_SCOPE const char *const tkWebColors[20];
1048 
1049 /*
1050  * The definition of pi, at least from the perspective of double-precision
1051  * floats.
1052  */
1053 
1054 #ifndef PI
1055 #ifdef M_PI
1056 #define PI  M_PI
1057 #else
1058 #define PI  3.14159265358979323846
1059 #endif
1060 #endif
1061 
1062 /*
1063  * Support for Clang Static Analyzer <https://clang-analyzer.llvm.org/>
1064  */
1065 
1066 #if defined(PURIFY) && defined(__clang__)
1067 #if __has_feature(attribute_analyzer_noreturn) && \
1068     !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
1069 void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
1070 #endif
1071 #if !defined(CLANG_ASSERT)
1072 #define CLANG_ASSERT(x) assert(x)
1073 #endif
1074 #elif !defined(CLANG_ASSERT)
1075 #define CLANG_ASSERT(x)
1076 #endif /* PURIFY && __clang__ */
1077 
1078 /*
1079  * The following magic value is stored in the "send_event" field of FocusIn
1080  * and FocusOut events. This allows us to separate "real" events coming from
1081  * the server from those that we generated.
1082  */
1083 
1084 #define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac)
1085 
1086 /*
1087  * Exported internals.
1088  */
1089 
1090 #include "tkIntDecls.h"
1091 
1092 #ifdef __cplusplus
1093 extern "C" {
1094 #endif
1095 
1096 /*
1097  * Themed widget set init function, and handler called when Tk is destroyed.
1098  */
1099 
1100 MODULE_SCOPE int    Ttk_Init(Tcl_Interp *interp);
1101 MODULE_SCOPE void   Ttk_TkDestroyedHandler(Tcl_Interp *interp);
1102 
1103 /*
1104  * Internal functions shared among Tk modules but not exported to the outside
1105  * world:
1106  */
1107 
1108 MODULE_SCOPE int    Tk_BellObjCmd(ClientData clientData,
1109                 Tcl_Interp *interp, int objc,
1110                 Tcl_Obj *const objv[]);
1111 MODULE_SCOPE int    Tk_BindObjCmd(ClientData clientData,
1112                 Tcl_Interp *interp, int objc,
1113                 Tcl_Obj *const objv[]);
1114 MODULE_SCOPE int    Tk_BindtagsObjCmd(ClientData clientData,
1115                 Tcl_Interp *interp, int objc,
1116                 Tcl_Obj *const objv[]);
1117 MODULE_SCOPE int    Tk_BusyObjCmd(ClientData clientData,
1118                 Tcl_Interp *interp, int objc,
1119                 Tcl_Obj *const objv[]);
1120 MODULE_SCOPE int    Tk_ButtonObjCmd(ClientData clientData,
1121                 Tcl_Interp *interp, int objc,
1122                 Tcl_Obj *const objv[]);
1123 MODULE_SCOPE int    Tk_CanvasObjCmd(ClientData clientData,
1124                 Tcl_Interp *interp, int argc,
1125                 Tcl_Obj *const objv[]);
1126 MODULE_SCOPE int    Tk_CheckbuttonObjCmd(ClientData clientData,
1127                 Tcl_Interp *interp, int objc,
1128                 Tcl_Obj *const objv[]);
1129 MODULE_SCOPE int    Tk_ClipboardObjCmd(ClientData clientData,
1130                 Tcl_Interp *interp, int objc,
1131                 Tcl_Obj *const objv[]);
1132 MODULE_SCOPE int    Tk_ChooseColorObjCmd(ClientData clientData,
1133                 Tcl_Interp *interp, int objc,
1134                 Tcl_Obj *const objv[]);
1135 MODULE_SCOPE int    Tk_ChooseDirectoryObjCmd(ClientData clientData,
1136                 Tcl_Interp *interp, int objc,
1137                 Tcl_Obj *const objv[]);
1138 MODULE_SCOPE int    Tk_DestroyObjCmd(ClientData clientData,
1139                 Tcl_Interp *interp, int objc,
1140                 Tcl_Obj *const objv[]);
1141 MODULE_SCOPE int    Tk_EntryObjCmd(ClientData clientData,
1142                 Tcl_Interp *interp, int objc,
1143                 Tcl_Obj *const objv[]);
1144 MODULE_SCOPE int    Tk_EventObjCmd(ClientData clientData,
1145                 Tcl_Interp *interp, int objc,
1146                 Tcl_Obj *const objv[]);
1147 MODULE_SCOPE int    Tk_FrameObjCmd(ClientData clientData,
1148                 Tcl_Interp *interp, int objc,
1149                 Tcl_Obj *const objv[]);
1150 MODULE_SCOPE int    Tk_FocusObjCmd(ClientData clientData,
1151                 Tcl_Interp *interp, int objc,
1152                 Tcl_Obj *const objv[]);
1153 MODULE_SCOPE int    Tk_FontObjCmd(ClientData clientData,
1154                 Tcl_Interp *interp, int objc,
1155                 Tcl_Obj *const objv[]);
1156 MODULE_SCOPE int    Tk_GetOpenFileObjCmd(ClientData clientData,
1157                 Tcl_Interp *interp, int objc,
1158                 Tcl_Obj *const objv[]);
1159 MODULE_SCOPE int    Tk_GetSaveFileObjCmd(ClientData clientData,
1160                 Tcl_Interp *interp, int objc,
1161                 Tcl_Obj *const objv[]);
1162 MODULE_SCOPE int    Tk_GrabObjCmd(ClientData clientData,
1163                 Tcl_Interp *interp, int objc,
1164                 Tcl_Obj *const objv[]);
1165 MODULE_SCOPE int    Tk_GridObjCmd(ClientData clientData,
1166                 Tcl_Interp *interp, int objc,
1167                 Tcl_Obj *const objv[]);
1168 MODULE_SCOPE int    Tk_ImageObjCmd(ClientData clientData,
1169                 Tcl_Interp *interp, int objc,
1170                 Tcl_Obj *const objv[]);
1171 MODULE_SCOPE int    Tk_LabelObjCmd(ClientData clientData,
1172                 Tcl_Interp *interp, int objc,
1173                 Tcl_Obj *const objv[]);
1174 MODULE_SCOPE int    Tk_LabelframeObjCmd(ClientData clientData,
1175                 Tcl_Interp *interp, int objc,
1176                 Tcl_Obj *const objv[]);
1177 MODULE_SCOPE int    Tk_ListboxObjCmd(ClientData clientData,
1178                 Tcl_Interp *interp, int objc,
1179                 Tcl_Obj *const objv[]);
1180 MODULE_SCOPE int    Tk_LowerObjCmd(ClientData clientData,
1181                 Tcl_Interp *interp, int objc,
1182                 Tcl_Obj *const objv[]);
1183 MODULE_SCOPE int    Tk_MenuObjCmd(ClientData clientData,
1184                 Tcl_Interp *interp, int objc,
1185                 Tcl_Obj *const objv[]);
1186 MODULE_SCOPE int    Tk_MenubuttonObjCmd(ClientData clientData,
1187                 Tcl_Interp *interp, int objc,
1188                 Tcl_Obj *const objv[]);
1189 MODULE_SCOPE int    Tk_MessageBoxObjCmd(ClientData clientData,
1190                 Tcl_Interp *interp, int objc,
1191                 Tcl_Obj *const objv[]);
1192 MODULE_SCOPE int    Tk_MessageObjCmd(ClientData clientData,
1193                 Tcl_Interp *interp, int objc,
1194                 Tcl_Obj *const objv[]);
1195 MODULE_SCOPE int    Tk_PanedWindowObjCmd(ClientData clientData,
1196                 Tcl_Interp *interp, int objc,
1197                 Tcl_Obj *const objv[]);
1198 MODULE_SCOPE int    Tk_OptionObjCmd(ClientData clientData,
1199                 Tcl_Interp *interp, int objc,
1200                 Tcl_Obj *const objv[]);
1201 MODULE_SCOPE int    Tk_PackObjCmd(ClientData clientData,
1202                 Tcl_Interp *interp, int objc,
1203                 Tcl_Obj *const objv[]);
1204 MODULE_SCOPE int    Tk_PlaceObjCmd(ClientData clientData,
1205                 Tcl_Interp *interp, int objc,
1206                 Tcl_Obj *const objv[]);
1207 MODULE_SCOPE int    Tk_RadiobuttonObjCmd(ClientData clientData,
1208                 Tcl_Interp *interp, int objc,
1209                 Tcl_Obj *const objv[]);
1210 MODULE_SCOPE int    Tk_RaiseObjCmd(ClientData clientData,
1211                 Tcl_Interp *interp, int objc,
1212                 Tcl_Obj *const objv[]);
1213 MODULE_SCOPE int    Tk_ScaleObjCmd(ClientData clientData,
1214                 Tcl_Interp *interp, int objc,
1215                 Tcl_Obj *const objv[]);
1216 MODULE_SCOPE int    Tk_ScrollbarObjCmd(ClientData clientData,
1217                 Tcl_Interp *interp, int objc,
1218                 Tcl_Obj *const objv[]);
1219 MODULE_SCOPE int    Tk_SelectionObjCmd(ClientData clientData,
1220                 Tcl_Interp *interp, int objc,
1221                 Tcl_Obj *const objv[]);
1222 MODULE_SCOPE int    Tk_SendObjCmd(ClientData clientData,
1223                 Tcl_Interp *interp,int objc,
1224                 Tcl_Obj *const objv[]);
1225 MODULE_SCOPE int    Tk_SpinboxObjCmd(ClientData clientData,
1226                 Tcl_Interp *interp, int objc,
1227                 Tcl_Obj *const objv[]);
1228 MODULE_SCOPE int    Tk_TextObjCmd(ClientData clientData,
1229                 Tcl_Interp *interp, int objc,
1230                 Tcl_Obj *const objv[]);
1231 MODULE_SCOPE int    Tk_TkwaitObjCmd(ClientData clientData,
1232                 Tcl_Interp *interp, int objc,
1233                 Tcl_Obj *const objv[]);
1234 MODULE_SCOPE int    Tk_ToplevelObjCmd(ClientData clientData,
1235                 Tcl_Interp *interp, int objc,
1236                 Tcl_Obj *const objv[]);
1237 MODULE_SCOPE int    Tk_UpdateObjCmd(ClientData clientData,
1238                 Tcl_Interp *interp, int objc,
1239                 Tcl_Obj *const objv[]);
1240 MODULE_SCOPE int    Tk_WinfoObjCmd(ClientData clientData,
1241                 Tcl_Interp *interp, int objc,
1242                 Tcl_Obj *const objv[]);
1243 MODULE_SCOPE int    Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
1244                 int objc, Tcl_Obj *const objv[]);
1245 
1246 MODULE_SCOPE int    Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
1247                 Tk_Window tkwin, Tcl_Obj *objPtr,
1248                 double *doublePtr);
1249 #define TkSetGeometryContainer TkSetGeometryMaster
1250 MODULE_SCOPE int    TkSetGeometryContainer(Tcl_Interp *interp,
1251                 Tk_Window tkwin, const char *name);
1252 #define TkFreeGeometryContainer TkFreeGeometryMaster
1253 MODULE_SCOPE void   TkFreeGeometryContainer(Tk_Window tkwin,
1254                 const char *name);
1255 
1256 MODULE_SCOPE void   TkRegisterObjTypes(void);
1257 MODULE_SCOPE int    TkDeadAppObjCmd(ClientData clientData,
1258                 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
1259 MODULE_SCOPE int    TkCanvasGetCoordObj(Tcl_Interp *interp,
1260                 Tk_Canvas canvas, Tcl_Obj *obj,
1261                 double *doublePtr);
1262 MODULE_SCOPE int    TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
1263                 const char *string, double *doublePtr);
1264 MODULE_SCOPE int    TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
1265                 Tk_PostscriptInfo psInfo, XImage *ximage,
1266                 int x, int y, int width, int height);
1267 MODULE_SCOPE void       TkMapTopFrame(Tk_Window tkwin);
1268 MODULE_SCOPE XEvent *   TkpGetBindingXEvent(Tcl_Interp *interp);
1269 MODULE_SCOPE void   TkCreateExitHandler(Tcl_ExitProc *proc,
1270                 void *clientData);
1271 MODULE_SCOPE void   TkDeleteExitHandler(Tcl_ExitProc *proc,
1272                 ClientData clientData);
1273 MODULE_SCOPE Tcl_ExitProc   TkFinalize;
1274 MODULE_SCOPE Tcl_ExitProc   TkFinalizeThread;
1275 MODULE_SCOPE void   TkpBuildRegionFromAlphaData(TkRegion region,
1276                 unsigned x, unsigned y, unsigned width,
1277                 unsigned height, unsigned char *dataPtr,
1278                 unsigned pixelStride, unsigned lineStride);
1279 MODULE_SCOPE void   TkAppendPadAmount(Tcl_Obj *bufferObj,
1280                 const char *buffer, int pad1, int pad2);
1281 MODULE_SCOPE int    TkParsePadAmount(Tcl_Interp *interp,
1282                 Tk_Window tkwin, Tcl_Obj *objPtr,
1283                 int *pad1Ptr, int *pad2Ptr);
1284 MODULE_SCOPE void       TkFocusSplit(TkWindow *winPtr);
1285 MODULE_SCOPE void       TkFocusJoin(TkWindow *winPtr);
1286 MODULE_SCOPE int    TkpAlwaysShowSelection(Tk_Window tkwin);
1287 MODULE_SCOPE void   TkpDrawCharsInContext(Display * display,
1288                 Drawable drawable, GC gc, Tk_Font tkfont,
1289                 const char *source, int numBytes, int rangeStart,
1290                 int rangeLength, int x, int y);
1291 MODULE_SCOPE void   TkpDrawAngledCharsInContext(Display * display,
1292                 Drawable drawable, GC gc, Tk_Font tkfont,
1293                 const char *source, int numBytes, int rangeStart,
1294                 int rangeLength, double x, double y, double angle);
1295 MODULE_SCOPE int    TkpMeasureCharsInContext(Tk_Font tkfont,
1296                 const char *source, int numBytes, int rangeStart,
1297                 int rangeLength, int maxLength, int flags,
1298                 int *lengthPtr);
1299 MODULE_SCOPE void   TkUnderlineCharsInContext(Display *display,
1300                 Drawable drawable, GC gc, Tk_Font tkfont,
1301                 const char *string, int numBytes, int x, int y,
1302                 int firstByte, int lastByte);
1303 MODULE_SCOPE void   TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
1304                 int c, struct TkFontAttributes *faPtr);
1305 MODULE_SCOPE Tcl_Obj *  TkNewWindowObj(Tk_Window tkwin);
1306 MODULE_SCOPE void   TkpShowBusyWindow(TkBusy busy);
1307 MODULE_SCOPE void   TkpHideBusyWindow(TkBusy busy);
1308 MODULE_SCOPE void   TkpMakeTransparentWindowExist(Tk_Window tkwin,
1309                 Window parent);
1310 MODULE_SCOPE void   TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
1311                 Window *parentPtr, Tk_Window tkParent,
1312                 TkBusy busy);
1313 MODULE_SCOPE int    TkBackgroundEvalObjv(Tcl_Interp *interp,
1314                 int objc, Tcl_Obj *const *objv, int flags);
1315 MODULE_SCOPE void   TkSendVirtualEvent(Tk_Window tgtWin,
1316                 const char *eventName, Tcl_Obj *detail);
1317 MODULE_SCOPE void   TkDrawDottedRect(Display *disp, Drawable d, GC gc,
1318                 int x, int y, int width, int height);
1319 MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
1320                 const char *nsname, const char *name,
1321                 ClientData clientData, const TkEnsemble *map);
1322 MODULE_SCOPE int    TkInitTkCmd(Tcl_Interp *interp,
1323                 ClientData clientData);
1324 MODULE_SCOPE int    TkInitFontchooser(Tcl_Interp *interp,
1325                 ClientData clientData);
1326 MODULE_SCOPE void   TkpWarpPointer(TkDisplay *dispPtr);
1327 MODULE_SCOPE void   TkpCancelWarp(TkDisplay *dispPtr);
1328 MODULE_SCOPE int    TkListCreateFrame(ClientData clientData,
1329                 Tcl_Interp *interp, Tcl_Obj *listObj,
1330                 int toplevel, Tcl_Obj *nameObj);
1331 
1332 #ifdef _WIN32
1333 #define TkParseColor XParseColor
1334 #else
1335 MODULE_SCOPE Status TkParseColor (Display * display,
1336                 Colormap map, const char* spec,
1337                 XColor * colorPtr);
1338 #endif
1339 #ifdef HAVE_XFT
1340 MODULE_SCOPE void   TkUnixSetXftClipRegion(TkRegion clipRegion);
1341 #endif
1342 
1343 MODULE_SCOPE void   TkpCopyRegion(TkRegion dst, TkRegion src);
1344 
1345 #if !defined(__cplusplus) && !defined(c_plusplus)
1346 # define c_class class
1347 #endif
1348 
1349 /* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */
1350 #if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6))
1351 #   define TkUtfToUniChar Tcl_UtfToUniChar
1352 #   define TkUniCharToUtf Tcl_UniCharToUtf
1353 #   define TkUtfPrev Tcl_UtfPrev
1354 #   define TkUtfAtIndex Tcl_UtfAtIndex
1355 #else
1356     MODULE_SCOPE int TkUtfToUniChar(const char *, int *);
1357     MODULE_SCOPE int TkUniCharToUtf(int, char *);
1358     MODULE_SCOPE const char *TkUtfPrev(const char *, const char *);
1359     MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index);
1360 #endif
1361 
1362 /*
1363  * Unsupported commands.
1364  */
1365 
1366 MODULE_SCOPE int    TkUnsupported1ObjCmd(ClientData clientData,
1367                 Tcl_Interp *interp, int objc,
1368                 Tcl_Obj *const objv[]);
1369 
1370 /*
1371  * For Tktest.
1372  */
1373 MODULE_SCOPE int SquareObjCmd(ClientData clientData,
1374                 Tcl_Interp *interp, int objc,
1375                 Tcl_Obj * const objv[]);
1376 MODULE_SCOPE int    TkOldTestInit(Tcl_Interp *interp);
1377 #if !(defined(_WIN32) || defined(MAC_OSX_TK))
1378 #define TkplatformtestInit(x) TCL_OK
1379 #else
1380 MODULE_SCOPE int    TkplatformtestInit(Tcl_Interp *interp);
1381 #endif
1382 
1383 #ifdef __cplusplus
1384 }
1385 #endif
1386 
1387 #endif /* _TKINT */
1388 
1389 /*
1390  * Local Variables:
1391  * mode: c
1392  * c-basic-offset: 4
1393  * fill-column: 78
1394  * End:
1395  */