diff options
Diffstat (limited to 'generic/tkInt.h')
-rw-r--r-- | generic/tkInt.h | 206 |
1 files changed, 149 insertions, 57 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h index 9f22b99..0e72161 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -25,7 +25,6 @@ * Darwin (where configure runs only once for multiple architectures). */ -#include <stdio.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif @@ -74,14 +73,19 @@ # endif #endif -#if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) -# if TCL_UTF_MAX > 3 -# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c) -# define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c) -# else -# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString) -# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString) -# endif +#ifndef TkSizeT +# if TCL_MAJOR_VERSION > 8 +# define TkSizeT size_t +# else +# define TkSizeT int +# endif +#endif + +#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) +# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString) +# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString) +# define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString +# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString #endif #if defined(__GNUC__) && (__GNUC__ > 2) @@ -103,19 +107,19 @@ #if !defined(INT2PTR) && !defined(PTR2INT) # if defined(HAVE_INTPTR_T) || defined(intptr_t) # define INT2PTR(p) ((void*)(intptr_t)(p)) -# define PTR2INT(p) ((int)(intptr_t)(p)) +# define PTR2INT(p) ((intptr_t)(p)) # else # define INT2PTR(p) ((void*)(p)) -# define PTR2INT(p) ((int)(p)) +# define PTR2INT(p) ((long)(p)) # endif #endif #if !defined(UINT2PTR) && !defined(PTR2UINT) # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) # define UINT2PTR(p) ((void*)(uintptr_t)(p)) -# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p)) +# define PTR2UINT(p) ((uintptr_t)(p)) # else # define UINT2PTR(p) ((void*)(p)) -# define PTR2UINT(p) ((unsigned int)(p)) +# define PTR2UINT(p) ((unsigned long)(p)) # endif #endif @@ -137,7 +141,7 @@ typedef struct TkColormap TkColormap; typedef struct TkFontAttributes TkFontAttributes; typedef struct TkGrabEvent TkGrabEvent; typedef struct TkpCursor_ *TkpCursor; -typedef struct TkRegion_ *TkRegion; +#define TkRegion Region typedef struct TkStressedCmap TkStressedCmap; typedef struct TkBindInfo_ *TkBindInfo; typedef struct Busy *TkBusy; @@ -152,7 +156,7 @@ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ - int resourceRefCount; /* Number of active uses of this cursor (each + TkSizeT resourceRefCount; /* Number of active uses of this cursor (each * active use corresponds to a call to * Tk_AllocPreserveFromObj or Tk_Preserve). If * this count is 0, then this structure is no @@ -161,7 +165,7 @@ typedef struct TkCursor { * there are objects referring to it. The * structure is freed when resourceRefCount * and objRefCount are both 0. */ - int objRefCount; /* Number of Tcl objects that reference this + TkSizeT objRefCount; /* Number of Tcl objects that reference this * structure.. */ Tcl_HashTable *otherTable; /* Second table (other than idTable) used to * index this entry. */ @@ -196,6 +200,8 @@ typedef struct TkCaret { * specific data, since each thread will have its own TkDisplay structure. */ +typedef enum TkLockUsage {LU_IGNORE, LU_CAPS, LU_SHIFT} TkLockUsage; + typedef struct TkDisplay { Display *display; /* Xlib's info about display. */ struct TkDisplay *nextPtr; /* Next in list of all displays. */ @@ -237,7 +243,7 @@ typedef struct TkDisplay { unsigned int altModMask; /* Has one bit set to indicate the modifier * corresponding to the "Meta" key. If no such * modifier, then this is zero. */ - enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage; + TkLockUsage lockUsage; /* Indicates how to interpret lock * modifier. */ int numModKeyCodes; /* Number of entries in modKeyCodes array @@ -311,7 +317,7 @@ typedef struct TkDisplay { /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ - int deleteCount; /* Counts # of handlers deleted since last + TkSizeT deleteCount; /* Counts # of handlers deleted since last * time inactive handlers were garbage- * collected. When this number gets big, * handlers get cleaned up. */ @@ -363,9 +369,9 @@ typedef struct TkDisplay { */ Tcl_HashTable maintainHashTable; - /* Hash table that maps from a master's - * Tk_Window token to a list of slaves managed - * by that master. */ + /* Hash table that maps from a container's + * Tk_Window token to a list of windows managed + * by that container. */ int geomInit; #define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ @@ -446,9 +452,9 @@ typedef struct TkDisplay { */ int placeInit; /* 0 means tables below need initializing. */ - Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master + Tcl_HashTable containerTable; /* Maps from Tk_Window token to the Container * structure for the window, if it exists. */ - Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave + Tcl_HashTable contentTable; /* Maps from Tk_Window token to the Content * structure for the window, if it exists. */ /* @@ -520,14 +526,14 @@ typedef struct TkDisplay { * Miscellaneous information: */ -#ifdef TK_USE_INPUT_METHODS +#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIM inputMethod; /* Input method for this display. */ XIMStyle inputStyle; /* Input style selected for this display. */ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ - int refCount; /* Reference count of how many Tk applications + TkSizeT refCount; /* Reference count of how many Tk applications * are using this display. Used to clean up * the display when we no longer have any Tk * applications using it. */ @@ -536,10 +542,17 @@ typedef struct TkDisplay { * The following field were all added for Tk8.3 */ +#if TCL_MAJOR_VERSION < 9 +#if !defined(TK_NO_DEPRECATED) int mouseButtonState; /* Current mouse button state for this * display. NOT USED as of 8.6.10 */ Window mouseButtonWindow; /* Window the button state was set in, added * in Tk 8.4. */ +#else + int notused1; + XID notused2; +#endif /* !TK_NO_DEPRECATED */ +#endif Tk_Window warpWindow; Tk_Window warpMainwin; /* For finding the root window for warping * purposes. */ @@ -557,8 +570,11 @@ typedef struct TkDisplay { int iconDataSize; /* Size of default iconphoto image data. */ unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */ -#ifdef TK_USE_INPUT_METHODS int ximGeneration; /* Used to invalidate XIC */ +#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9) + XIM inputMethod; /* Input method for this display. */ + XIMStyle inputStyle; /* Input style selected for this display. */ + XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ } TkDisplay; @@ -570,15 +586,11 @@ typedef struct TkDisplay { * Whether to use input methods for this display * TK_DISPLAY_WM_TRACING: (default off) * Whether we should do wm tracing on this display. - * TK_DISPLAY_IN_WARP: (default off) - * Indicates that we are in a pointer warp */ #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) #define TK_DISPLAY_USE_IM (1 << 1) #define TK_DISPLAY_WM_TRACING (1 << 3) -#define TK_DISPLAY_IN_WARP (1 << 4) -#define TK_DISPLAY_USE_XKB (1 << 5) /* * One of the following structures exists for each error handler created by a @@ -631,7 +643,7 @@ typedef struct TkEventHandler { */ typedef struct TkMainInfo { - int refCount; /* Number of windows whose "mainPtr" fields + TkSizeT refCount; /* Number of windows whose "mainPtr" fields * point here. When this becomes zero, can * free up the structure (the reference count * is zero because windows can get deleted in @@ -642,7 +654,11 @@ typedef struct TkMainInfo { Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow * structs for all windows related to this * main window. Managed by tkWindow.c. */ - long deletionEpoch; /* Incremented by window deletions. */ +#if TCL_MAJOR_VERSION > 8 + size_t deletionEpoch; /* Incremented by window deletions. */ +#else + long deletionEpoch; +#endif Tk_BindingTable bindingTable; /* Used in conjunction with "bind" command to * bind events to Tcl commands. */ @@ -779,7 +795,7 @@ typedef struct TkWindow { TkEventHandler *handlerList;/* First in list of event handlers declared * for this window, or NULL if none. */ -#ifdef TK_USE_INPUT_METHODS +#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIC inputContext; /* XIM input context. */ #endif /* TK_USE_INPUT_METHODS */ @@ -860,7 +876,7 @@ typedef struct TkWindow { int minReqWidth; /* Minimum requested width. */ int minReqHeight; /* Minimum requested height. */ -#ifdef TK_USE_INPUT_METHODS +#if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) int ximGeneration; /* Used to invalidate XIC */ #endif /* TK_USE_INPUT_METHODS */ char *geomMgrName; /* Records the name of the geometry manager. */ @@ -868,6 +884,10 @@ typedef struct TkWindow { /* The geometry container for this window. The * value is NULL if the window has no container or * if its container is its parent. */ +#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9) + XIC inputContext; /* XIM input context. */ + int ximGeneration; /* Used to invalidate XIC */ +#endif /* TK_USE_INPUT_METHODS */ } TkWindow; /* @@ -887,7 +907,7 @@ typedef struct { * adding), or NULL if that has not been * computed yet. If non-NULL, this string was * allocated with ckalloc(). */ - int charValueLen; /* Length of string in charValuePtr when that + TkSizeT charValueLen; /* Length of string in charValuePtr when that * is non-NULL. */ KeySym keysym; /* Key symbol computed after input methods * have been invoked */ @@ -902,6 +922,15 @@ typedef struct { #define TK_MAKE_MENU_POPUP 1 #define TK_MAKE_MENU_DROPDOWN 2 +/* See TIP #494 */ +#ifndef TCL_IO_FAILURE +# define TCL_IO_FAILURE (-1) +#endif +/* See TIP #537 */ +#ifndef TCL_INDEX_NONE +# define TCL_INDEX_NONE (-1) +#endif + /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. @@ -933,7 +962,7 @@ typedef struct TkpClipMask { int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */ union { Pixmap pixmap; - TkRegion region; + Region region; } value; } TkpClipMask; @@ -982,17 +1011,36 @@ typedef struct TkpClipMask { #define ALT_MASK (AnyModifier<<2) #define EXTENDED_MASK (AnyModifier<<3) +#ifndef Button8 +# define Button8 8 +#endif +#ifndef Button9 +# define Button9 9 +#endif + +#ifndef Button6Mask +# define Button6Mask (1<<13) +#endif +#ifndef Button7Mask +# define Button7Mask (1<<14) +#endif +#ifndef Button8Mask +# define Button8Mask (AnyModifier<<4) +#endif +#ifndef Button9Mask +# define Button9Mask (AnyModifier<<5) +#endif + /* * Mask that selects any of the state bits corresponding to buttons, plus * masks that select individual buttons' bits: */ #define ALL_BUTTONS \ - (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) + (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask \ + |Button6Mask|Button7Mask|Button8Mask|Button9Mask) -MODULE_SCOPE unsigned TkGetButtonMask(unsigned); - /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: @@ -1015,8 +1063,10 @@ MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; MODULE_SCOPE Tk_ImageType tkBitmapImageType; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF; MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr); +MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtDefault; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; +MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano; MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; @@ -1222,13 +1272,8 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData, MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr, - double *doublePtr); -#define TkSetGeometryContainer TkSetGeometryMaster MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp, Tk_Window tkwin, const char *name); -#define TkFreeGeometryContainer TkFreeGeometryMaster MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, const char *name); @@ -1244,6 +1289,15 @@ MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin, MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, XImage *ximage, int x, int y, int width, int height); +#if TCL_MAJOR_VERSION > 8 +MODULE_SCOPE int TkCanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, + Tk_Window tkwin, const char *value, char *widgRec, size_t offset); +MODULE_SCOPE const char *TkCanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, + char *widgRec, size_t offset, Tcl_FreeProc **freeProcPtr); +#else +#define TkCanvasTagsParseProc Tk_CanvasTagsParseProc +#define TkCanvasTagsPrintProc Tk_CanvasTagsPrintProc +#endif MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin); MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp); MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc, @@ -1252,7 +1306,7 @@ MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc, ClientData clientData); MODULE_SCOPE Tcl_ExitProc TkFinalize; MODULE_SCOPE Tcl_ExitProc TkFinalizeThread; -MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region, +MODULE_SCOPE void TkpBuildRegionFromAlphaData(Region region, unsigned x, unsigned y, unsigned width, unsigned height, unsigned char *dataPtr, unsigned pixelStride, unsigned lineStride); @@ -1263,7 +1317,6 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); -MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); MODULE_SCOPE void TkpDrawCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, @@ -1282,7 +1335,9 @@ MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, int firstByte, int lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, int c, struct TkFontAttributes *faPtr); -MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); +MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable, + Tk_3DBorder border, int highlightWidth, + int borderWidth, int relief); MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, @@ -1292,8 +1347,6 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int flags); -MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, - const char *eventName, Tcl_Obj *detail); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, ClientData clientData, const TkEnsemble *map); @@ -1301,11 +1354,19 @@ MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, ClientData clientData); +MODULE_SCOPE void TkInitEmbeddedConfigurationInformation( + Tcl_Interp *interp); +MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); -MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr); MODULE_SCOPE int TkListCreateFrame(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *listObj, int toplevel, Tcl_Obj *nameObj); +MODULE_SCOPE void TkRotatePoint(double originX, double originY, + double sine, double cosine, double *xPtr, + double *yPtr); +MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*); + +#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) #ifdef _WIN32 #define TkParseColor XParseColor @@ -1314,8 +1375,30 @@ MODULE_SCOPE Status TkParseColor (Display * display, Colormap map, const char* spec, XColor * colorPtr); #endif +#if !defined(_WIN32) && !defined(__CYGWIN__) /* UNIX and MacOSX */ +#undef TkPutImage +#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \ + XPutImage(display, pixels, gc, image, srcx, srcy, destx, desty, width, height); +#else +#undef XPutImage +#define XPutImage(display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \ + TkPutImage(NULL, 0, display, pixels, gc, image, srcx, srcy, destx, desty, width, height); +#endif + +/* + * These macros are just wrappers for the equivalent X Region calls. + */ +#define TkClipBox XClipBox +#define TkCreateRegion XCreateRegion +#define TkDestroyRegion XDestroyRegion +#define TkIntersectRegion XIntersectRegion +#define TkRectInRegion XRectInRegion +#define TkSetRegion XSetRegion +#define TkSubtractRegion XSubtractRegion +#define TkUnionRectWithRegion XUnionRectWithRegion + #ifdef HAVE_XFT -MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); +MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); #endif #if !defined(__cplusplus) && !defined(c_plusplus) @@ -1323,15 +1406,24 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); #endif #if TCL_UTF_MAX > 4 -# define TkUtfToUniChar Tcl_UtfToUniChar -# define TkUniCharToUtf Tcl_UniCharToUtf +# define TkUtfToUniChar(src, ch) (size_t)(((int (*)(const char *, int *))Tcl_UtfToUniChar)(src, ch)) +# define TkUniCharToUtf(ch, src) (size_t)(((int (*)(int, char *))Tcl_UniCharToUtf)(ch, src)) # define TkUtfPrev Tcl_UtfPrev -# define TkUtfAtIndex Tcl_UtfAtIndex #else - MODULE_SCOPE int TkUtfToUniChar(const char *, int *); - MODULE_SCOPE int TkUniCharToUtf(int, char *); + MODULE_SCOPE size_t TkUtfToUniChar(const char *, int *); + MODULE_SCOPE size_t TkUniCharToUtf(int, char *); MODULE_SCOPE const char *TkUtfPrev(const char *, const char *); - MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index); +#endif + +#if TCL_MAJOR_VERSION > 8 +#define TkGetStringFromObj(objPtr, lenPtr) \ + (((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \ + *(lenPtr) = (objPtr)->length, (objPtr)->bytes) +MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr, + size_t *lengthPtr); +#else +#define TkGetStringFromObj Tcl_GetStringFromObj +#define TkGetByteArrayFromObj Tcl_GetByteArrayFromObj #endif /* |