Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:25

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