jpayne@69: /* jpayne@69: * tkInt.h -- jpayne@69: * jpayne@69: * Declarations for things used internally by the Tk functions but not jpayne@69: * exported outside the module. jpayne@69: * jpayne@69: * Copyright (c) 1990-1994 The Regents of the University of California. jpayne@69: * Copyright (c) 1994-1997 Sun Microsystems, Inc. jpayne@69: * Copyright (c) 1998 by Scriptics Corporation. jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution of jpayne@69: * this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKINT jpayne@69: #define _TKINT jpayne@69: jpayne@69: #ifndef _TKPORT jpayne@69: #include "tkPort.h" jpayne@69: #endif jpayne@69: jpayne@69: #define TK_OPTION_ENUM_VAR ((int)(sizeof(Tk_OptionType)&(sizeof(int)-1))<<6) jpayne@69: jpayne@69: /* jpayne@69: * Ensure WORDS_BIGENDIAN is defined correctly: jpayne@69: * Needs to happen here in addition to configure to work with fat compiles on jpayne@69: * Darwin (where configure runs only once for multiple architectures). jpayne@69: */ jpayne@69: jpayne@69: #include jpayne@69: #ifdef HAVE_SYS_TYPES_H jpayne@69: # include jpayne@69: #endif jpayne@69: #ifdef HAVE_SYS_PARAM_H jpayne@69: # include jpayne@69: #endif jpayne@69: #ifdef BYTE_ORDER jpayne@69: # ifdef BIG_ENDIAN jpayne@69: # if BYTE_ORDER == BIG_ENDIAN jpayne@69: # undef WORDS_BIGENDIAN jpayne@69: # define WORDS_BIGENDIAN 1 jpayne@69: # endif jpayne@69: # endif jpayne@69: # ifdef LITTLE_ENDIAN jpayne@69: # if BYTE_ORDER == LITTLE_ENDIAN jpayne@69: # undef WORDS_BIGENDIAN jpayne@69: # endif jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Used to tag functions that are only to be visible within the module being jpayne@69: * built and not outside it (where this is supported by the linker). jpayne@69: */ jpayne@69: jpayne@69: #ifndef MODULE_SCOPE jpayne@69: # ifdef __cplusplus jpayne@69: # define MODULE_SCOPE extern "C" jpayne@69: # else jpayne@69: # define MODULE_SCOPE extern jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifndef JOIN jpayne@69: # define JOIN(a,b) JOIN1(a,b) jpayne@69: # define JOIN1(a,b) a##b jpayne@69: #endif jpayne@69: jpayne@69: #ifndef TCL_UNUSED jpayne@69: # if defined(__cplusplus) jpayne@69: # define TCL_UNUSED(T) T jpayne@69: # elif defined(__GNUC__) && (__GNUC__ > 2) jpayne@69: # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) jpayne@69: # else jpayne@69: # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) jpayne@69: # if TCL_UTF_MAX > 3 jpayne@69: # define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c) jpayne@69: # define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c) jpayne@69: # else jpayne@69: # define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString) jpayne@69: # define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString) jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) jpayne@69: # define TKFLEXARRAY jpayne@69: #elif defined(__GNUC__) && (__GNUC__ > 2) jpayne@69: # define TKFLEXARRAY 0 jpayne@69: #else jpayne@69: # define TKFLEXARRAY 1 jpayne@69: #endif jpayne@69: jpayne@69: #ifndef Tcl_GetParent jpayne@69: # define Tcl_GetParent Tcl_GetMaster jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Macros used to cast between pointers and integers (e.g. when storing an int jpayne@69: * in ClientData), on 64-bit architectures they avoid gcc warning about "cast jpayne@69: * to/from pointer from/to integer of different size". jpayne@69: */ jpayne@69: jpayne@69: #if !defined(INT2PTR) && !defined(PTR2INT) jpayne@69: # if defined(HAVE_INTPTR_T) || defined(intptr_t) jpayne@69: # define INT2PTR(p) ((void*)(intptr_t)(p)) jpayne@69: # define PTR2INT(p) ((int)(intptr_t)(p)) jpayne@69: # else jpayne@69: # define INT2PTR(p) ((void*)(p)) jpayne@69: # define PTR2INT(p) ((int)(p)) jpayne@69: # endif jpayne@69: #endif jpayne@69: #if !defined(UINT2PTR) && !defined(PTR2UINT) jpayne@69: # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) jpayne@69: # define UINT2PTR(p) ((void*)(uintptr_t)(p)) jpayne@69: # define PTR2UINT(p) ((unsigned int)(uintptr_t)(p)) jpayne@69: # else jpayne@69: # define UINT2PTR(p) ((void*)(p)) jpayne@69: # define PTR2UINT(p) ((unsigned int)(p)) jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifndef TCL_Z_MODIFIER jpayne@69: # if defined(_WIN64) jpayne@69: # define TCL_Z_MODIFIER "I" jpayne@69: # elif defined(__GNUC__) && !defined(_WIN32) jpayne@69: # define TCL_Z_MODIFIER "z" jpayne@69: # else jpayne@69: # define TCL_Z_MODIFIER "" jpayne@69: # endif jpayne@69: #endif /* !TCL_Z_MODIFIER */ jpayne@69: jpayne@69: /* jpayne@69: * Opaque type declarations: jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkColormap TkColormap; jpayne@69: typedef struct TkFontAttributes TkFontAttributes; jpayne@69: typedef struct TkGrabEvent TkGrabEvent; jpayne@69: typedef struct TkpCursor_ *TkpCursor; jpayne@69: typedef struct TkRegion_ *TkRegion; jpayne@69: typedef struct TkStressedCmap TkStressedCmap; jpayne@69: typedef struct TkBindInfo_ *TkBindInfo; jpayne@69: typedef struct Busy *TkBusy; jpayne@69: jpayne@69: /* jpayne@69: * One of the following structures is maintained for each cursor in use in the jpayne@69: * system. This structure is used by tkCursor.c and the various system- jpayne@69: * specific cursor files. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkCursor { jpayne@69: Tk_Cursor cursor; /* System specific identifier for cursor. */ jpayne@69: Display *display; /* Display containing cursor. Needed for jpayne@69: * disposal and retrieval of cursors. */ jpayne@69: int resourceRefCount; /* Number of active uses of this cursor (each jpayne@69: * active use corresponds to a call to jpayne@69: * Tk_AllocPreserveFromObj or Tk_Preserve). If jpayne@69: * this count is 0, then this structure is no jpayne@69: * longer valid and it isn't present in a hash jpayne@69: * table: it is being kept around only because jpayne@69: * there are objects referring to it. The jpayne@69: * structure is freed when resourceRefCount jpayne@69: * and objRefCount are both 0. */ jpayne@69: int objRefCount; /* Number of Tcl objects that reference this jpayne@69: * structure.. */ jpayne@69: Tcl_HashTable *otherTable; /* Second table (other than idTable) used to jpayne@69: * index this entry. */ jpayne@69: Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure jpayne@69: * (needed when deleting). */ jpayne@69: Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed jpayne@69: * when deleting). */ jpayne@69: struct TkCursor *nextPtr; /* Points to the next TkCursor structure with jpayne@69: * the same name. Cursors with the same name jpayne@69: * but different displays are chained together jpayne@69: * off a single hash table entry. */ jpayne@69: } TkCursor; jpayne@69: jpayne@69: /* jpayne@69: * The following structure is kept one-per-TkDisplay to maintain information jpayne@69: * about the caret (cursor location) on this display. This is used to dictate jpayne@69: * global focus location (Windows Accessibility guidelines) and to position jpayne@69: * the IME or XIM over-the-spot window. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkCaret { jpayne@69: struct TkWindow *winPtr; /* The window on which we requested caret jpayne@69: * placement. */ jpayne@69: int x; /* Relative x coord of the caret. */ jpayne@69: int y; /* Relative y coord of the caret. */ jpayne@69: int height; /* Specified height of the window. */ jpayne@69: } TkCaret; jpayne@69: jpayne@69: /* jpayne@69: * One of the following structures is maintained for each display containing a jpayne@69: * window managed by Tk. In part, the structure is used to store thread- jpayne@69: * specific data, since each thread will have its own TkDisplay structure. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkDisplay { jpayne@69: Display *display; /* Xlib's info about display. */ jpayne@69: struct TkDisplay *nextPtr; /* Next in list of all displays. */ jpayne@69: char *name; /* Name of display (with any screen identifier jpayne@69: * removed). Malloc-ed. */ jpayne@69: Time lastEventTime; /* Time of last event received for this jpayne@69: * display. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used primarily by tk3d.c: jpayne@69: */ jpayne@69: jpayne@69: int borderInit; /* 0 means borderTable needs initializing. */ jpayne@69: Tcl_HashTable borderTable; /* Maps from color name to TkBorder jpayne@69: * structure. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkAtom.c only: jpayne@69: */ jpayne@69: jpayne@69: int atomInit; /* 0 means stuff below hasn't been initialized jpayne@69: * yet. */ jpayne@69: Tcl_HashTable nameTable; /* Maps from names to Atom's. */ jpayne@69: Tcl_HashTable atomTable; /* Maps from Atom's back to names. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used primarily by tkBind.c: jpayne@69: */ jpayne@69: jpayne@69: int bindInfoStale; /* Non-zero means the variables in this part jpayne@69: * of the structure are potentially incorrect jpayne@69: * and should be recomputed. */ jpayne@69: unsigned int modeModMask; /* Has one bit set to indicate the modifier jpayne@69: * corresponding to "mode shift". If no such jpayne@69: * modifier, than this is zero. */ jpayne@69: unsigned int metaModMask; /* Has one bit set to indicate the modifier jpayne@69: * corresponding to the "Meta" key. If no such jpayne@69: * modifier, then this is zero. */ jpayne@69: unsigned int altModMask; /* Has one bit set to indicate the modifier jpayne@69: * corresponding to the "Meta" key. If no such jpayne@69: * modifier, then this is zero. */ jpayne@69: enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage; jpayne@69: /* Indicates how to interpret lock jpayne@69: * modifier. */ jpayne@69: int numModKeyCodes; /* Number of entries in modKeyCodes array jpayne@69: * below. */ jpayne@69: KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for all jpayne@69: * of the keys that have modifiers associated jpayne@69: * with them. Malloc'ed, but may be NULL. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkBitmap.c only: jpayne@69: */ jpayne@69: jpayne@69: int bitmapInit; /* 0 means tables above need initializing. */ jpayne@69: int bitmapAutoNumber; /* Used to number bitmaps. */ jpayne@69: Tcl_HashTable bitmapNameTable; jpayne@69: /* Maps from name of bitmap to the first jpayne@69: * TkBitmap record for that name. */ jpayne@69: Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap jpayne@69: * structure for the bitmap. */ jpayne@69: Tcl_HashTable bitmapDataTable; jpayne@69: /* Used by Tk_GetBitmapFromData to map from a jpayne@69: * collection of in-core data about a bitmap jpayne@69: * to a reference giving an automatically- jpayne@69: * generated name for the bitmap. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkCanvas.c only: jpayne@69: */ jpayne@69: jpayne@69: int numIdSearches; jpayne@69: int numSlowSearches; jpayne@69: jpayne@69: /* jpayne@69: * Used by tkColor.c only: jpayne@69: */ jpayne@69: jpayne@69: int colorInit; /* 0 means color module needs initializing. */ jpayne@69: TkStressedCmap *stressPtr; /* First in list of colormaps that have filled jpayne@69: * up, so we have to pick an approximate jpayne@69: * color. */ jpayne@69: Tcl_HashTable colorNameTable; jpayne@69: /* Maps from color name to TkColor structure jpayne@69: * for that color. */ jpayne@69: Tcl_HashTable colorValueTable; jpayne@69: /* Maps from integer RGB values to TkColor jpayne@69: * structures. */ jpayne@69: jpayne@69: /* jpayne@69: * Used by tkCursor.c only: jpayne@69: */ jpayne@69: jpayne@69: int cursorInit; /* 0 means cursor module need initializing. */ jpayne@69: Tcl_HashTable cursorNameTable; jpayne@69: /* Maps from a string name to a cursor to the jpayne@69: * TkCursor record for the cursor. */ jpayne@69: Tcl_HashTable cursorDataTable; jpayne@69: /* Maps from a collection of in-core data jpayne@69: * about a cursor to a TkCursor structure. */ jpayne@69: Tcl_HashTable cursorIdTable; jpayne@69: /* Maps from a cursor id to the TkCursor jpayne@69: * structure for the cursor. */ jpayne@69: char cursorString[20]; /* Used to store a cursor id string. */ jpayne@69: Font cursorFont; /* Font to use for standard cursors. None jpayne@69: * means font not loaded yet. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkError.c only: jpayne@69: */ jpayne@69: jpayne@69: struct TkErrorHandler *errorPtr; jpayne@69: /* First in list of error handlers for this jpayne@69: * display. NULL means no handlers exist at jpayne@69: * present. */ jpayne@69: int deleteCount; /* Counts # of handlers deleted since last jpayne@69: * time inactive handlers were garbage- jpayne@69: * collected. When this number gets big, jpayne@69: * handlers get cleaned up. */ jpayne@69: jpayne@69: /* jpayne@69: * Used by tkEvent.c only: jpayne@69: */ jpayne@69: jpayne@69: struct TkWindowEvent *delayedMotionPtr; jpayne@69: /* Points to a malloc-ed motion event whose jpayne@69: * processing has been delayed in the hopes jpayne@69: * that another motion event will come along jpayne@69: * right away and we can merge the two of them jpayne@69: * together. NULL means that there is no jpayne@69: * delayed motion event. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkFocus.c only: jpayne@69: */ jpayne@69: jpayne@69: int focusDebug; /* 1 means collect focus debugging jpayne@69: * statistics. */ jpayne@69: struct TkWindow *implicitWinPtr; jpayne@69: /* If the focus arrived at a toplevel window jpayne@69: * implicitly via an Enter event (rather than jpayne@69: * via a FocusIn event), this points to the jpayne@69: * toplevel window. Otherwise it is NULL. */ jpayne@69: struct TkWindow *focusPtr; /* Points to the window on this display that jpayne@69: * should be receiving keyboard events. When jpayne@69: * multiple applications on the display have jpayne@69: * the focus, this will refer to the innermost jpayne@69: * window in the innermost application. This jpayne@69: * information isn't used on Windows, but it's jpayne@69: * needed on the Mac, and also on X11 when XIM jpayne@69: * processing is being done. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGC.c only: jpayne@69: */ jpayne@69: jpayne@69: Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure jpayne@69: * describing a GC with those values. */ jpayne@69: Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */ jpayne@69: int gcInit; /* 0 means the tables below need jpayne@69: * initializing. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGeometry.c only: jpayne@69: */ jpayne@69: jpayne@69: Tcl_HashTable maintainHashTable; jpayne@69: /* Hash table that maps from a container's jpayne@69: * Tk_Window token to a list of windows managed jpayne@69: * by that container. */ jpayne@69: int geomInit; jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGrid.c, tkPack.c, tkPlace.c, tkPointer.c, jpayne@69: * and ttkMacOSXTheme.c: jpayne@69: */ jpayne@69: jpayne@69: #define TkGetContainer(tkwin) (Tk_TopWinHierarchy((TkWindow *)tkwin) ? NULL : \ jpayne@69: (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ jpayne@69: ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)) jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGet.c only: jpayne@69: */ jpayne@69: jpayne@69: Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */ jpayne@69: int uidInit; /* 0 means uidTable needs initializing. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGrab.c only: jpayne@69: */ jpayne@69: jpayne@69: struct TkWindow *grabWinPtr;/* Window in which the pointer is currently jpayne@69: * grabbed, or NULL if none. */ jpayne@69: struct TkWindow *eventualGrabWinPtr; jpayne@69: /* Value that grabWinPtr will have once the jpayne@69: * grab event queue (below) has been jpayne@69: * completely emptied. */ jpayne@69: struct TkWindow *buttonWinPtr; jpayne@69: /* Window in which first mouse button was jpayne@69: * pressed while grab was in effect, or NULL jpayne@69: * if no such press in effect. */ jpayne@69: struct TkWindow *serverWinPtr; jpayne@69: /* If no application contains the pointer then jpayne@69: * this is NULL. Otherwise it contains the jpayne@69: * last window for which we've gotten an Enter jpayne@69: * or Leave event from the server (i.e. the jpayne@69: * last window known to have contained the jpayne@69: * pointer). Doesn't reflect events that were jpayne@69: * synthesized in tkGrab.c. */ jpayne@69: TkGrabEvent *firstGrabEventPtr; jpayne@69: /* First in list of enter/leave events jpayne@69: * synthesized by grab code. These events must jpayne@69: * be processed in order before any other jpayne@69: * events are processed. NULL means no such jpayne@69: * events. */ jpayne@69: TkGrabEvent *lastGrabEventPtr; jpayne@69: /* Last in list of synthesized events, or NULL jpayne@69: * if list is empty. */ jpayne@69: int grabFlags; /* Miscellaneous flag values. See definitions jpayne@69: * in tkGrab.c. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGrid.c only: jpayne@69: */ jpayne@69: jpayne@69: int gridInit; /* 0 means table below needs initializing. */ jpayne@69: Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding jpayne@69: * Grid structures. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkImage.c only: jpayne@69: */ jpayne@69: jpayne@69: int imageId; /* Value used to number image ids. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkMacWinMenu.c only: jpayne@69: */ jpayne@69: jpayne@69: int postCommandGeneration; jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkPack.c only. jpayne@69: */ jpayne@69: jpayne@69: int packInit; /* 0 means table below needs initializing. */ jpayne@69: Tcl_HashTable packerHashTable; jpayne@69: /* Maps from Tk_Window tokens to corresponding jpayne@69: * Packer structures. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkPlace.c only. jpayne@69: */ jpayne@69: jpayne@69: int placeInit; /* 0 means tables below need initializing. */ jpayne@69: Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master jpayne@69: * structure for the window, if it exists. */ jpayne@69: Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave jpayne@69: * structure for the window, if it exists. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkSelect.c and tkClipboard.c only: jpayne@69: */ jpayne@69: jpayne@69: struct TkSelectionInfo *selectionInfoPtr; jpayne@69: /* First in list of selection information jpayne@69: * records. Each entry contains information jpayne@69: * about the current owner of a particular jpayne@69: * selection on this display. */ jpayne@69: Atom multipleAtom; /* Atom for MULTIPLE. None means selection jpayne@69: * stuff isn't initialized. */ jpayne@69: Atom incrAtom; /* Atom for INCR. */ jpayne@69: Atom targetsAtom; /* Atom for TARGETS. */ jpayne@69: Atom timestampAtom; /* Atom for TIMESTAMP. */ jpayne@69: Atom textAtom; /* Atom for TEXT. */ jpayne@69: Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */ jpayne@69: Atom applicationAtom; /* Atom for TK_APPLICATION. */ jpayne@69: Atom windowAtom; /* Atom for TK_WINDOW. */ jpayne@69: Atom clipboardAtom; /* Atom for CLIPBOARD. */ jpayne@69: Atom utf8Atom; /* Atom for UTF8_STRING. */ jpayne@69: Atom atomPairAtom; /* Atom for ATOM_PAIR. */ jpayne@69: jpayne@69: Tk_Window clipWindow; /* Window used for clipboard ownership and to jpayne@69: * retrieve selections between processes. NULL jpayne@69: * means clipboard info hasn't been jpayne@69: * initialized. */ jpayne@69: int clipboardActive; /* 1 means we currently own the clipboard jpayne@69: * selection, 0 means we don't. */ jpayne@69: struct TkMainInfo *clipboardAppPtr; jpayne@69: /* Last application that owned clipboard. */ jpayne@69: struct TkClipboardTarget *clipTargetPtr; jpayne@69: /* First in list of clipboard type information jpayne@69: * records. Each entry contains information jpayne@69: * about the buffers for a given selection jpayne@69: * target. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkSend.c only: jpayne@69: */ jpayne@69: jpayne@69: Tk_Window commTkwin; /* Window used for communication between jpayne@69: * interpreters during "send" commands. NULL jpayne@69: * means send info hasn't been initialized jpayne@69: * yet. */ jpayne@69: Atom commProperty; /* X's name for comm property. */ jpayne@69: Atom registryProperty; /* X's name for property containing registry jpayne@69: * of interpreter names. */ jpayne@69: Atom appNameProperty; /* X's name for property used to hold the jpayne@69: * application name on each comm window. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkUnixWm.c and tkWinWm.c only: jpayne@69: */ jpayne@69: jpayne@69: struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */ jpayne@69: struct TkWmInfo *foregroundWmPtr; jpayne@69: /* Points to the foreground window. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkVisual.c only: jpayne@69: */ jpayne@69: jpayne@69: TkColormap *cmapPtr; /* First in list of all non-default colormaps jpayne@69: * allocated for this display. */ jpayne@69: jpayne@69: /* jpayne@69: * Miscellaneous information: jpayne@69: */ jpayne@69: jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: XIM inputMethod; /* Input method for this display. */ jpayne@69: XIMStyle inputStyle; /* Input style selected for this display. */ jpayne@69: XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ jpayne@69: jpayne@69: int refCount; /* Reference count of how many Tk applications jpayne@69: * are using this display. Used to clean up jpayne@69: * the display when we no longer have any Tk jpayne@69: * applications using it. */ jpayne@69: jpayne@69: /* jpayne@69: * The following field were all added for Tk8.3 jpayne@69: */ jpayne@69: jpayne@69: int mouseButtonState; /* Current mouse button state for this jpayne@69: * display. NOT USED as of 8.6.10 */ jpayne@69: Window mouseButtonWindow; /* Window the button state was set in, added jpayne@69: * in Tk 8.4. */ jpayne@69: Tk_Window warpWindow; jpayne@69: Tk_Window warpMainwin; /* For finding the root window for warping jpayne@69: * purposes. */ jpayne@69: int warpX; jpayne@69: int warpY; jpayne@69: jpayne@69: /* jpayne@69: * The following field(s) were all added for Tk8.4 jpayne@69: */ jpayne@69: jpayne@69: unsigned int flags; /* Various flag values: these are all defined jpayne@69: * in below. */ jpayne@69: TkCaret caret; /* Information about the caret for this jpayne@69: * display. This is not a pointer. */ jpayne@69: jpayne@69: int iconDataSize; /* Size of default iconphoto image data. */ jpayne@69: unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */ jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: int ximGeneration; /* Used to invalidate XIC */ jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: } TkDisplay; jpayne@69: jpayne@69: /* jpayne@69: * Flag values for TkDisplay flags. jpayne@69: * TK_DISPLAY_COLLAPSE_MOTION_EVENTS: (default on) jpayne@69: * Indicates that we should collapse motion events on this display jpayne@69: * TK_DISPLAY_USE_IM: (default on, set via tk.tcl) jpayne@69: * Whether to use input methods for this display jpayne@69: * TK_DISPLAY_WM_TRACING: (default off) jpayne@69: * Whether we should do wm tracing on this display. jpayne@69: * TK_DISPLAY_IN_WARP: (default off) jpayne@69: * Indicates that we are in a pointer warp jpayne@69: */ jpayne@69: jpayne@69: #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) jpayne@69: #define TK_DISPLAY_USE_IM (1 << 1) jpayne@69: #define TK_DISPLAY_WM_TRACING (1 << 3) jpayne@69: #define TK_DISPLAY_IN_WARP (1 << 4) jpayne@69: #define TK_DISPLAY_USE_XKB (1 << 5) jpayne@69: jpayne@69: /* jpayne@69: * One of the following structures exists for each error handler created by a jpayne@69: * call to Tk_CreateErrorHandler. The structure is managed by tkError.c. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkErrorHandler { jpayne@69: TkDisplay *dispPtr; /* Display to which handler applies. */ jpayne@69: unsigned long firstRequest; /* Only errors with serial numbers >= to this jpayne@69: * are considered. */ jpayne@69: unsigned long lastRequest; /* Only errors with serial numbers <= to this jpayne@69: * are considered. This field is filled in jpayne@69: * when XUnhandle is called. -1 means jpayne@69: * XUnhandle hasn't been called yet. */ jpayne@69: int error; /* Consider only errors with this error_code jpayne@69: * (-1 means consider all errors). */ jpayne@69: int request; /* Consider only errors with this major jpayne@69: * request code (-1 means consider all major jpayne@69: * codes). */ jpayne@69: int minorCode; /* Consider only errors with this minor jpayne@69: * request code (-1 means consider all minor jpayne@69: * codes). */ jpayne@69: Tk_ErrorProc *errorProc; /* Function to invoke when a matching error jpayne@69: * occurs. NULL means just ignore errors. */ jpayne@69: ClientData clientData; /* Arbitrary value to pass to errorProc. */ jpayne@69: struct TkErrorHandler *nextPtr; jpayne@69: /* Pointer to next older handler for this jpayne@69: * display, or NULL for end of list. */ jpayne@69: } TkErrorHandler; jpayne@69: jpayne@69: /* jpayne@69: * One of the following structures exists for each event handler created by jpayne@69: * calling Tk_CreateEventHandler. This information is used by tkEvent.c only. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkEventHandler { jpayne@69: unsigned long mask; /* Events for which to invoke proc. */ jpayne@69: Tk_EventProc *proc; /* Function to invoke when an event in mask jpayne@69: * occurs. */ jpayne@69: ClientData clientData; /* Argument to pass to proc. */ jpayne@69: struct TkEventHandler *nextPtr; jpayne@69: /* Next in list of handlers associated with jpayne@69: * window (NULL means end of list). */ jpayne@69: } TkEventHandler; jpayne@69: jpayne@69: /* jpayne@69: * Tk keeps one of the following data structures for each main window (created jpayne@69: * by a call to TkCreateMainWindow). It stores information that is shared by jpayne@69: * all of the windows associated with a particular main window. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkMainInfo { jpayne@69: int refCount; /* Number of windows whose "mainPtr" fields jpayne@69: * point here. When this becomes zero, can jpayne@69: * free up the structure (the reference count jpayne@69: * is zero because windows can get deleted in jpayne@69: * almost any order; the main window isn't jpayne@69: * necessarily the last one deleted). */ jpayne@69: struct TkWindow *winPtr; /* Pointer to main window. */ jpayne@69: Tcl_Interp *interp; /* Interpreter associated with application. */ jpayne@69: Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow jpayne@69: * structs for all windows related to this jpayne@69: * main window. Managed by tkWindow.c. */ jpayne@69: long deletionEpoch; /* Incremented by window deletions. */ jpayne@69: Tk_BindingTable bindingTable; jpayne@69: /* Used in conjunction with "bind" command to jpayne@69: * bind events to Tcl commands. */ jpayne@69: TkBindInfo bindInfo; /* Information used by tkBind.c on a per jpayne@69: * application basis. */ jpayne@69: struct TkFontInfo *fontInfoPtr; jpayne@69: /* Information used by tkFont.c on a per jpayne@69: * application basis. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used only by tkFocus.c and tk*Embed.c: jpayne@69: */ jpayne@69: jpayne@69: struct TkToplevelFocusInfo *tlFocusPtr; jpayne@69: /* First in list of records containing focus jpayne@69: * information for each top-level in the jpayne@69: * application. Used only by tkFocus.c. */ jpayne@69: struct TkDisplayFocusInfo *displayFocusPtr; jpayne@69: /* First in list of records containing focus jpayne@69: * information for each display that this jpayne@69: * application has ever used. Used only by jpayne@69: * tkFocus.c. */ jpayne@69: jpayne@69: struct ElArray *optionRootPtr; jpayne@69: /* Top level of option hierarchy for this main jpayne@69: * window. NULL means uninitialized. Managed jpayne@69: * by tkOption.c. */ jpayne@69: Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel jpayne@69: * structures. Managed by tkImage.c. */ jpayne@69: int strictMotif; /* This is linked to the tk_strictMotif global jpayne@69: * variable. */ jpayne@69: int alwaysShowSelection; /* This is linked to the jpayne@69: * ::tk::AlwaysShowSelection variable. */ jpayne@69: struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by jpayne@69: * this process. */ jpayne@69: Tcl_HashTable busyTable; /* Information used by [tk busy] command. */ jpayne@69: Tcl_ObjCmdProc *tclUpdateObjProc; jpayne@69: /* Saved Tcl [update] command, used to restore jpayne@69: * Tcl's version of [update] after Tk is shut jpayne@69: * down */ jpayne@69: } TkMainInfo; jpayne@69: jpayne@69: /* jpayne@69: * Tk keeps the following data structure for each of it's builtin bitmaps. jpayne@69: * This structure is only used by tkBitmap.c and other platform specific jpayne@69: * bitmap files. jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: const void *source; /* Bits for bitmap. */ jpayne@69: int width, height; /* Dimensions of bitmap. */ jpayne@69: int native; /* 0 means generic (X style) bitmap, 1 means jpayne@69: * native style bitmap. */ jpayne@69: } TkPredefBitmap; jpayne@69: jpayne@69: /* jpayne@69: * Tk keeps one of the following structures for each window. Some of the jpayne@69: * information (like size and location) is a shadow of information managed by jpayne@69: * the X server, and some is special information used here, such as event and jpayne@69: * geometry management information. This information is (mostly) managed by jpayne@69: * tkWindow.c. WARNING: the declaration below must be kept consistent with the jpayne@69: * Tk_FakeWin structure in tk.h. If you change one, be sure to change the jpayne@69: * other! jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkWindow { jpayne@69: /* jpayne@69: * Structural information: jpayne@69: */ jpayne@69: jpayne@69: Display *display; /* Display containing window. */ jpayne@69: TkDisplay *dispPtr; /* Tk's information about display for jpayne@69: * window. */ jpayne@69: int screenNum; /* Index of screen for window, among all those jpayne@69: * for dispPtr. */ jpayne@69: Visual *visual; /* Visual to use for window. If not default, jpayne@69: * MUST be set before X window is created. */ jpayne@69: int depth; /* Number of bits/pixel. */ jpayne@69: Window window; /* X's id for window. None means window hasn't jpayne@69: * actually been created yet, or it's been jpayne@69: * deleted. */ jpayne@69: struct TkWindow *childList; /* First in list of child windows, or NULL if jpayne@69: * no children. List is in stacking order, jpayne@69: * lowest window first.*/ jpayne@69: struct TkWindow *lastChildPtr; jpayne@69: /* Last in list of child windows (highest in jpayne@69: * stacking order), or NULL if no children. */ jpayne@69: struct TkWindow *parentPtr; /* Pointer to parent window (logical parent, jpayne@69: * not necessarily X parent). NULL means jpayne@69: * either this is the main window, or the jpayne@69: * window's parent has already been deleted. */ jpayne@69: struct TkWindow *nextPtr; /* Next higher sibling (in stacking order) in jpayne@69: * list of children with same parent. NULL jpayne@69: * means end of list. */ jpayne@69: TkMainInfo *mainPtr; /* Information shared by all windows jpayne@69: * associated with a particular main window. jpayne@69: * NULL means this window is a rogue that is jpayne@69: * not associated with any application (at jpayne@69: * present, this only happens for the dummy jpayne@69: * windows used for "send" communication). */ jpayne@69: jpayne@69: /* jpayne@69: * Name and type information for the window: jpayne@69: */ jpayne@69: jpayne@69: char *pathName; /* Path name of window (concatenation of all jpayne@69: * names between this window and its top-level jpayne@69: * ancestor). This is a pointer into an entry jpayne@69: * in mainPtr->nameTable. NULL means that the jpayne@69: * window hasn't been completely created jpayne@69: * yet. */ jpayne@69: Tk_Uid nameUid; /* Name of the window within its parent jpayne@69: * (unique within the parent). */ jpayne@69: Tk_Uid classUid; /* Class of the window. NULL means window jpayne@69: * hasn't been given a class yet. */ jpayne@69: jpayne@69: /* jpayne@69: * Geometry and other attributes of window. This information may not be jpayne@69: * updated on the server immediately; stuff that hasn't been reflected in jpayne@69: * the server yet is called "dirty". At present, information can be dirty jpayne@69: * only if the window hasn't yet been created. jpayne@69: */ jpayne@69: jpayne@69: XWindowChanges changes; /* Geometry and other info about window. */ jpayne@69: unsigned int dirtyChanges; /* Bits indicate fields of "changes" that are jpayne@69: * dirty. */ jpayne@69: XSetWindowAttributes atts; /* Current attributes of window. */ jpayne@69: unsigned long dirtyAtts; /* Bits indicate fields of "atts" that are jpayne@69: * dirty. */ jpayne@69: jpayne@69: unsigned int flags; /* Various flag values: these are all defined jpayne@69: * in tk.h (confusing, but they're needed jpayne@69: * there for some query macros). */ jpayne@69: jpayne@69: /* jpayne@69: * Information kept by the event manager (tkEvent.c): jpayne@69: */ jpayne@69: jpayne@69: TkEventHandler *handlerList;/* First in list of event handlers declared jpayne@69: * for this window, or NULL if none. */ jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: XIC inputContext; /* XIM input context. */ jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: jpayne@69: /* jpayne@69: * Information used for event bindings (see "bind" and "bindtags" commands jpayne@69: * in tkCmds.c): jpayne@69: */ jpayne@69: jpayne@69: ClientData *tagPtr; /* Points to array of tags used for bindings jpayne@69: * on this window. Each tag is a Tk_Uid. jpayne@69: * Malloc'ed. NULL means no tags. */ jpayne@69: int numTags; /* Number of tags at *tagPtr. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkOption.c to manage options for the window. jpayne@69: */ jpayne@69: jpayne@69: int optionLevel; /* -1 means no option information is currently jpayne@69: * cached for this window. Otherwise this jpayne@69: * gives the level in the option stack at jpayne@69: * which info is cached. */ jpayne@69: /* jpayne@69: * Information used by tkSelect.c to manage the selection. jpayne@69: */ jpayne@69: jpayne@69: struct TkSelHandler *selHandlerList; jpayne@69: /* First in list of handlers for returning the jpayne@69: * selection in various forms. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by tkGeometry.c for geometry management. jpayne@69: */ jpayne@69: jpayne@69: const Tk_GeomMgr *geomMgrPtr; jpayne@69: /* Information about geometry manager for this jpayne@69: * window. */ jpayne@69: ClientData geomData; /* Argument for geometry manager functions. */ jpayne@69: int reqWidth, reqHeight; /* Arguments from last call to jpayne@69: * Tk_GeometryRequest, or 0's if jpayne@69: * Tk_GeometryRequest hasn't been called. */ jpayne@69: int internalBorderLeft; /* Width of internal border of window (0 means jpayne@69: * no internal border). Geometry managers jpayne@69: * should not normally place children on top jpayne@69: * of the border. Fields for the other three jpayne@69: * sides are found below. */ jpayne@69: jpayne@69: /* jpayne@69: * Information maintained by tkWm.c for window manager communication. jpayne@69: */ jpayne@69: jpayne@69: struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also for special jpayne@69: * Unix menubar and wrapper windows), points jpayne@69: * to structure with wm-related info (see jpayne@69: * tkWm.c). For other windows, this is jpayne@69: * NULL. */ jpayne@69: jpayne@69: /* jpayne@69: * Information used by widget classes. jpayne@69: */ jpayne@69: jpayne@69: const Tk_ClassProcs *classProcsPtr; jpayne@69: ClientData instanceData; jpayne@69: jpayne@69: /* jpayne@69: * Platform specific information private to each port. jpayne@69: */ jpayne@69: jpayne@69: struct TkWindowPrivate *privatePtr; jpayne@69: jpayne@69: /* jpayne@69: * More information used by tkGeometry.c for geometry management. jpayne@69: */ jpayne@69: jpayne@69: /* The remaining fields of internal border. */ jpayne@69: int internalBorderRight; jpayne@69: int internalBorderTop; jpayne@69: int internalBorderBottom; jpayne@69: jpayne@69: int minReqWidth; /* Minimum requested width. */ jpayne@69: int minReqHeight; /* Minimum requested height. */ jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: int ximGeneration; /* Used to invalidate XIC */ jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: char *geomMgrName; /* Records the name of the geometry manager. */ jpayne@69: struct TkWindow *maintainerPtr; jpayne@69: /* The geometry container for this window. The jpayne@69: * value is NULL if the window has no container or jpayne@69: * if its container is its parent. */ jpayne@69: } TkWindow; jpayne@69: jpayne@69: /* jpayne@69: * String tables: jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE const char *const tkStateStrings[]; jpayne@69: MODULE_SCOPE const char *const tkCompoundStrings[]; jpayne@69: jpayne@69: /* jpayne@69: * Real definition of some events. Note that these events come from outside jpayne@69: * but have internally generated pieces added to them. jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: XKeyEvent keyEvent; /* The real event from X11. */ jpayne@69: #ifdef _WIN32 jpayne@69: char trans_chars[XMaxTransChars]; jpayne@69: /* translated characters */ jpayne@69: unsigned char nbytes; jpayne@69: #elif !defined(MAC_OSX_TK) jpayne@69: char *charValuePtr; /* A pointer to a string that holds the key's jpayne@69: * %A substitution text (before backslash jpayne@69: * adding), or NULL if that has not been jpayne@69: * computed yet. If non-NULL, this string was jpayne@69: * allocated with ckalloc(). */ jpayne@69: int charValueLen; /* Length of string in charValuePtr when that jpayne@69: * is non-NULL. */ jpayne@69: KeySym keysym; /* Key symbol computed after input methods jpayne@69: * have been invoked */ jpayne@69: #endif jpayne@69: } TkKeyEvent; jpayne@69: jpayne@69: /* jpayne@69: * Flags passed to TkpMakeMenuWindow's 'transient' argument. jpayne@69: */ jpayne@69: jpayne@69: #define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */ jpayne@69: #define TK_MAKE_MENU_POPUP 1 jpayne@69: #define TK_MAKE_MENU_DROPDOWN 2 jpayne@69: jpayne@69: /* jpayne@69: * The following structure is used with TkMakeEnsemble to create ensemble jpayne@69: * commands and optionally to create sub-ensembles. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkEnsemble { jpayne@69: const char *name; jpayne@69: Tcl_ObjCmdProc *proc; jpayne@69: const struct TkEnsemble *subensemble; jpayne@69: } TkEnsemble; jpayne@69: jpayne@69: /* jpayne@69: * The following structure is used as a two way map between integers and jpayne@69: * strings, usually to map between an internal C representation and the jpayne@69: * strings used in Tcl. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkStateMap { jpayne@69: int numKey; /* Integer representation of a value. */ jpayne@69: const char *strKey; /* String representation of a value. */ jpayne@69: } TkStateMap; jpayne@69: jpayne@69: /* jpayne@69: * This structure is used by the Mac and Window porting layers as the internal jpayne@69: * representation of a clip_mask in a GC. jpayne@69: */ jpayne@69: jpayne@69: typedef struct TkpClipMask { jpayne@69: int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */ jpayne@69: union { jpayne@69: Pixmap pixmap; jpayne@69: TkRegion region; jpayne@69: } value; jpayne@69: } TkpClipMask; jpayne@69: jpayne@69: #define TKP_CLIP_PIXMAP 0 jpayne@69: #define TKP_CLIP_REGION 1 jpayne@69: jpayne@69: /* jpayne@69: * Return values from TkGrabState: jpayne@69: */ jpayne@69: jpayne@69: #define TK_GRAB_NONE 0 jpayne@69: #define TK_GRAB_IN_TREE 1 jpayne@69: #define TK_GRAB_ANCESTOR 2 jpayne@69: #define TK_GRAB_EXCLUDED 3 jpayne@69: jpayne@69: /* jpayne@69: * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags jpayne@69: * for this routine, but don't make public until TkpMeasureCharsInContext is jpayne@69: * made public, too. jpayne@69: */ jpayne@69: jpayne@69: #define TK_ISOLATE_END 32 jpayne@69: jpayne@69: /* jpayne@69: * The macro below is used to modify a "char" value (e.g. by casting it to an jpayne@69: * unsigned character) so that it can be used safely with macros such as jpayne@69: * isspace(). jpayne@69: */ jpayne@69: jpayne@69: #define UCHAR(c) ((unsigned char) (c)) jpayne@69: jpayne@69: /* jpayne@69: * The following symbol is used in the mode field of FocusIn events generated jpayne@69: * by an embedded application to request the input focus from its container. jpayne@69: */ jpayne@69: jpayne@69: #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20) jpayne@69: jpayne@69: /* jpayne@69: * The following special modifier mask bits are defined, to indicate logical jpayne@69: * modifiers such as Meta and Alt that may float among the actual modifier jpayne@69: * bits. jpayne@69: */ jpayne@69: jpayne@69: #define META_MASK (AnyModifier<<1) jpayne@69: #define ALT_MASK (AnyModifier<<2) jpayne@69: #define EXTENDED_MASK (AnyModifier<<3) jpayne@69: jpayne@69: /* jpayne@69: * Mask that selects any of the state bits corresponding to buttons, plus jpayne@69: * masks that select individual buttons' bits: jpayne@69: */ jpayne@69: jpayne@69: #define ALL_BUTTONS \ jpayne@69: (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) jpayne@69: jpayne@69: jpayne@69: MODULE_SCOPE unsigned TkGetButtonMask(unsigned); jpayne@69: jpayne@69: /* jpayne@69: * Object types not declared in tkObj.c need to be mentioned here so they can jpayne@69: * be properly registered with Tcl: jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE const Tcl_ObjType tkBorderObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkColorObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkCursorObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkFontObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType; jpayne@69: MODULE_SCOPE const Tcl_ObjType tkTextIndexType; jpayne@69: jpayne@69: /* jpayne@69: * Miscellaneous variables shared among Tk modules but not exported to the jpayne@69: * outside world: jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; jpayne@69: MODULE_SCOPE Tk_ImageType tkBitmapImageType; jpayne@69: MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF; jpayne@69: MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr); jpayne@69: MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG; jpayne@69: MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; jpayne@69: MODULE_SCOPE TkMainInfo *tkMainWindowList; jpayne@69: MODULE_SCOPE Tk_ImageType tkPhotoImageType; jpayne@69: MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; jpayne@69: jpayne@69: MODULE_SCOPE const char *const tkWebColors[20]; jpayne@69: jpayne@69: /* jpayne@69: * The definition of pi, at least from the perspective of double-precision jpayne@69: * floats. jpayne@69: */ jpayne@69: jpayne@69: #ifndef PI jpayne@69: #ifdef M_PI jpayne@69: #define PI M_PI jpayne@69: #else jpayne@69: #define PI 3.14159265358979323846 jpayne@69: #endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Support for Clang Static Analyzer jpayne@69: */ jpayne@69: jpayne@69: #if defined(PURIFY) && defined(__clang__) jpayne@69: #if __has_feature(attribute_analyzer_noreturn) && \ jpayne@69: !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) jpayne@69: void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); jpayne@69: #endif jpayne@69: #if !defined(CLANG_ASSERT) jpayne@69: #define CLANG_ASSERT(x) assert(x) jpayne@69: #endif jpayne@69: #elif !defined(CLANG_ASSERT) jpayne@69: #define CLANG_ASSERT(x) jpayne@69: #endif /* PURIFY && __clang__ */ jpayne@69: jpayne@69: /* jpayne@69: * The following magic value is stored in the "send_event" field of FocusIn jpayne@69: * and FocusOut events. This allows us to separate "real" events coming from jpayne@69: * the server from those that we generated. jpayne@69: */ jpayne@69: jpayne@69: #define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac) jpayne@69: jpayne@69: /* jpayne@69: * Exported internals. jpayne@69: */ jpayne@69: jpayne@69: #include "tkIntDecls.h" jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Themed widget set init function: jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp); jpayne@69: jpayne@69: /* jpayne@69: * Internal functions shared among Tk modules but not exported to the outside jpayne@69: * world: jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE int Tk_BellObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_BindObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_BindtagsObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_BusyObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ButtonObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_CanvasObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int argc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_CheckbuttonObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ClipboardObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ChooseColorObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ChooseDirectoryObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_DestroyObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_EntryObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_EventObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_FrameObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_FocusObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_FontObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_GetOpenFileObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_GetSaveFileObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_GrabObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_GridObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ImageObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_LabelObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_LabelframeObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ListboxObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_LowerObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_MenuObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_MenubuttonObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_MessageBoxObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_MessageObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_PanedWindowObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_OptionObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_PackObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_PlaceObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_RadiobuttonObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_RaiseObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ScaleObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ScrollbarObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp,int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_ToplevelObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_UpdateObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, jpayne@69: int objc, Tcl_Obj *const objv[]); jpayne@69: jpayne@69: MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, jpayne@69: Tk_Window tkwin, Tcl_Obj *objPtr, jpayne@69: double *doublePtr); jpayne@69: #define TkSetGeometryContainer TkSetGeometryMaster jpayne@69: MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp, jpayne@69: Tk_Window tkwin, const char *name); jpayne@69: #define TkFreeGeometryContainer TkFreeGeometryMaster jpayne@69: MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, jpayne@69: const char *name); jpayne@69: jpayne@69: MODULE_SCOPE void TkEventInit(void); jpayne@69: MODULE_SCOPE void TkRegisterObjTypes(void); jpayne@69: MODULE_SCOPE int TkDeadAppObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); jpayne@69: MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp, jpayne@69: Tk_Canvas canvas, Tcl_Obj *obj, jpayne@69: double *doublePtr); jpayne@69: MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin, jpayne@69: const char *string, double *doublePtr); jpayne@69: MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin, jpayne@69: Tk_PostscriptInfo psInfo, XImage *ximage, jpayne@69: int x, int y, int width, int height); jpayne@69: MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin); jpayne@69: MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp); jpayne@69: MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc, jpayne@69: void *clientData); jpayne@69: MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc, jpayne@69: ClientData clientData); jpayne@69: MODULE_SCOPE Tcl_ExitProc TkFinalize; jpayne@69: MODULE_SCOPE Tcl_ExitProc TkFinalizeThread; jpayne@69: MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region, jpayne@69: unsigned x, unsigned y, unsigned width, jpayne@69: unsigned height, unsigned char *dataPtr, jpayne@69: unsigned pixelStride, unsigned lineStride); jpayne@69: MODULE_SCOPE void TkAppendPadAmount(Tcl_Obj *bufferObj, jpayne@69: const char *buffer, int pad1, int pad2); jpayne@69: MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, jpayne@69: Tk_Window tkwin, Tcl_Obj *objPtr, jpayne@69: int *pad1Ptr, int *pad2Ptr); jpayne@69: MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); jpayne@69: MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); jpayne@69: MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); jpayne@69: MODULE_SCOPE void TkpDrawCharsInContext(Display * display, jpayne@69: Drawable drawable, GC gc, Tk_Font tkfont, jpayne@69: const char *source, int numBytes, int rangeStart, jpayne@69: int rangeLength, int x, int y); jpayne@69: MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display, jpayne@69: Drawable drawable, GC gc, Tk_Font tkfont, jpayne@69: const char *source, int numBytes, int rangeStart, jpayne@69: int rangeLength, double x, double y, double angle); jpayne@69: MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont, jpayne@69: const char *source, int numBytes, int rangeStart, jpayne@69: int rangeLength, int maxLength, int flags, jpayne@69: int *lengthPtr); jpayne@69: MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, jpayne@69: Drawable drawable, GC gc, Tk_Font tkfont, jpayne@69: const char *string, int numBytes, int x, int y, jpayne@69: int firstByte, int lastByte); jpayne@69: MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, jpayne@69: int c, struct TkFontAttributes *faPtr); jpayne@69: MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); jpayne@69: MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); jpayne@69: MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); jpayne@69: MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, jpayne@69: Window parent); jpayne@69: MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, jpayne@69: Window *parentPtr, Tk_Window tkParent, jpayne@69: TkBusy busy); jpayne@69: MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, jpayne@69: int objc, Tcl_Obj *const *objv, int flags); jpayne@69: MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, jpayne@69: const char *eventName, Tcl_Obj *detail); jpayne@69: MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, jpayne@69: const char *nsname, const char *name, jpayne@69: ClientData clientData, const TkEnsemble *map); jpayne@69: MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, jpayne@69: ClientData clientData); jpayne@69: MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, jpayne@69: ClientData clientData); jpayne@69: MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); jpayne@69: MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr); jpayne@69: MODULE_SCOPE int TkListCreateFrame(ClientData clientData, jpayne@69: Tcl_Interp *interp, Tcl_Obj *listObj, jpayne@69: int toplevel, Tcl_Obj *nameObj); jpayne@69: jpayne@69: #ifdef _WIN32 jpayne@69: #define TkParseColor XParseColor jpayne@69: #else jpayne@69: MODULE_SCOPE Status TkParseColor (Display * display, jpayne@69: Colormap map, const char* spec, jpayne@69: XColor * colorPtr); jpayne@69: #endif jpayne@69: #ifdef HAVE_XFT jpayne@69: MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); jpayne@69: #endif jpayne@69: jpayne@69: #if !defined(__cplusplus) && !defined(c_plusplus) jpayne@69: # define c_class class jpayne@69: #endif jpayne@69: jpayne@69: /* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */ jpayne@69: #if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6)) jpayne@69: # define TkUtfToUniChar Tcl_UtfToUniChar jpayne@69: # define TkUniCharToUtf Tcl_UniCharToUtf jpayne@69: # define TkUtfPrev Tcl_UtfPrev jpayne@69: # define TkUtfAtIndex Tcl_UtfAtIndex jpayne@69: #else jpayne@69: MODULE_SCOPE int TkUtfToUniChar(const char *, int *); jpayne@69: MODULE_SCOPE int TkUniCharToUtf(int, char *); jpayne@69: MODULE_SCOPE const char *TkUtfPrev(const char *, const char *); jpayne@69: MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index); jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Unsupported commands. jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj *const objv[]); jpayne@69: jpayne@69: /* jpayne@69: * For Tktest. jpayne@69: */ jpayne@69: MODULE_SCOPE int SquareObjCmd(ClientData clientData, jpayne@69: Tcl_Interp *interp, int objc, jpayne@69: Tcl_Obj * const objv[]); jpayne@69: MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); jpayne@69: #if !(defined(_WIN32) || defined(MAC_OSX_TK)) jpayne@69: #define TkplatformtestInit(x) TCL_OK jpayne@69: #else jpayne@69: MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* _TKINT */ jpayne@69: jpayne@69: /* jpayne@69: * Local Variables: jpayne@69: * mode: c jpayne@69: * c-basic-offset: 4 jpayne@69: * fill-column: 78 jpayne@69: * End: jpayne@69: */