diff options
Diffstat (limited to 'generic/tkInt.h')
-rw-r--r-- | generic/tkInt.h | 216 |
1 files changed, 130 insertions, 86 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h index c30eceb..21b882c 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -15,22 +15,17 @@ #ifndef _TKINT #define _TKINT -#ifndef _TK -#include "tk.h" -#endif -#ifndef _TCL -#include "tcl.h" -#endif #ifndef _TKPORT #include "tkPort.h" #endif /* - * Ensure WORDS_BIGENDIAN is defined correcly: + * Ensure WORDS_BIGENDIAN is defined correctly: * Needs to happen here in addition to configure to work with fat compiles on * Darwin (where configure runs only once for multiple architectures). */ +#include <stdio.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif @@ -100,18 +95,11 @@ typedef struct TkpCursor_ *TkpCursor; typedef struct TkRegion_ *TkRegion; typedef struct TkStressedCmap TkStressedCmap; typedef struct TkBindInfo_ *TkBindInfo; - -/* - * Function types. - */ - -typedef int (TkBindEvalProc)(ClientData clientData, Tcl_Interp *interp, - XEvent *eventPtr, Tk_Window tkwin, KeySym keySym); -typedef void (TkBindFreeProc)(ClientData clientData); +typedef struct Busy *TkBusy; /* * One of the following structures is maintained for each cursor in use in the - * system. This structure is used by tkCursor.c and the various system + * system. This structure is used by tkCursor.c and the various system- * specific cursor files. */ @@ -397,10 +385,6 @@ typedef struct TkDisplay { int postCommandGeneration; /* - * Information used by tkOption.c only. - */ - - /* * Information used by tkPack.c only. */ @@ -469,24 +453,6 @@ typedef struct TkDisplay { * application name on each comm window. */ /* - * Information used by tkXId.c only: - */ - - struct TkIdStack *idStackPtr; - /* First in list of chunks of free resource - * identifiers, or NULL if there are no free - * resources. */ - XID (*defaultAllocProc) (Display *display); - /* Default resource allocator for display. */ - struct TkIdStack *windowStackPtr; - /* First in list of chunks of window ids that - * can't be reused right now. */ - Tcl_TimerToken idCleanupScheduled; - /* If set, it means a call to WindowIdCleanup - * has already been scheduled, 0 means it - * hasn't. */ - - /* * Information used by tkUnixWm.c and tkWinWm.c only: */ @@ -495,18 +461,6 @@ typedef struct TkDisplay { /* Points to the foreground window. */ /* - * Information maintained by tkWindow.c for use later on by tkXId.c: - */ - - int destroyCount; /* Number of Tk_DestroyWindow operations in - * progress. */ - unsigned long lastDestroyRequest; - /* Id of most recent XDestroyWindow request; - * can re-use ids in windowStackPtr when - * server has seen this request and event - * queue is empty. */ - - /* * Information used by tkVisual.c only: */ @@ -537,7 +491,9 @@ typedef struct TkDisplay { * display. */ Window mouseButtonWindow; /* Window the button state was set in, added * in Tk 8.4. */ - Window warpWindow; + Tk_Window warpWindow; + Tk_Window warpMainwin; /* For finding the root window for warping + * purposes. */ int warpX; int warpY; @@ -669,6 +625,7 @@ typedef struct TkMainInfo { * ::tk::AlwaysShowSelection variable. */ struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by * this process. */ + Tcl_HashTable busyTable; /* Information used by [tk busy] command. */ } TkMainInfo; /* @@ -678,7 +635,7 @@ typedef struct TkMainInfo { */ typedef struct { - const char *source; /* Bits for bitmap. */ + const void *source; /* Bits for bitmap. */ int width, height; /* Dimensions of bitmap. */ int native; /* 0 means generic (X style) bitmap, 1 means * native style bitmap. */ @@ -803,7 +760,8 @@ typedef struct TkWindow { * Information used by tkGeometry.c for geometry management. */ - const Tk_GeomMgr *geomMgrPtr; /* Information about geometry manager for this + const Tk_GeomMgr *geomMgrPtr; + /* Information about geometry manager for this * window. */ ClientData geomData; /* Argument for geometry manager functions. */ int reqWidth, reqHeight; /* Arguments from last call to @@ -822,13 +780,14 @@ typedef struct TkWindow { struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also for special * Unix menubar and wrapper windows), points * to structure with wm-related info (see - * tkWm.c). For other windows, this is NULL. */ + * tkWm.c). For other windows, this is + * NULL. */ /* * Information used by widget classes. */ - Tk_ClassProcs *classProcsPtr; + const Tk_ClassProcs *classProcsPtr; ClientData instanceData; /* @@ -848,6 +807,7 @@ typedef struct TkWindow { int minReqWidth; /* Minimum requested width. */ int minReqHeight; /* Minimum requested height. */ + char *geometryMaster; } TkWindow; /* @@ -869,6 +829,25 @@ typedef struct { } TkKeyEvent; /* + * Flags passed to TkpMakeMenuWindow's 'transient' argument. + */ + +#define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */ +#define TK_MAKE_MENU_POPUP 1 +#define TK_MAKE_MENU_DROPDOWN 2 + +/* + * The following structure is used with TkMakeEnsemble to create ensemble + * commands and optionally to create sub-ensembles. + */ + +typedef struct TkEnsemble { + const char *name; + Tcl_ObjCmdProc *proc; + const struct TkEnsemble *subensemble; +} TkEnsemble; + +/* * The following structure is used as a two way map between integers and * strings, usually to map between an internal C representation and the * strings used in Tcl. @@ -896,12 +875,6 @@ typedef struct TkpClipMask { #define TKP_CLIP_REGION 1 /* - * Pointer to first entry in list of all displays currently known. - */ - -extern TkDisplay *tkDisplayList; - -/* * Return values from TkGrabState: */ @@ -948,35 +921,74 @@ extern TkDisplay *tkDisplayList; * be properly registered with Tcl: */ -MODULE_SCOPE Tcl_ObjType tkBorderObjType; -MODULE_SCOPE Tcl_ObjType tkBitmapObjType; -MODULE_SCOPE Tcl_ObjType tkColorObjType; -MODULE_SCOPE Tcl_ObjType tkCursorObjType; -MODULE_SCOPE Tcl_ObjType tkFontObjType; -MODULE_SCOPE Tcl_ObjType tkOptionObjType; -MODULE_SCOPE Tcl_ObjType tkStateKeyObjType; -MODULE_SCOPE Tcl_ObjType tkTextIndexType; +MODULE_SCOPE const Tcl_ObjType tkBorderObjType; +MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; +MODULE_SCOPE const Tcl_ObjType tkColorObjType; +MODULE_SCOPE const Tcl_ObjType tkCursorObjType; +MODULE_SCOPE const Tcl_ObjType tkFontObjType; +MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType; +MODULE_SCOPE const Tcl_ObjType tkTextIndexType; /* * Miscellaneous variables shared among Tk modules but not exported to the * outside world: */ -MODULE_SCOPE Tk_SmoothMethod tkBezierSmoothMethod; +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 tkImgFmtPNG; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; -#include "tkIntDecls.h" +MODULE_SCOPE const char *const tkWebColors[20]; + +/* + * The definition of pi, at least from the perspective of double-precision + * floats. + */ -#ifdef BUILD_tk -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLEXPORT +#ifndef PI +#ifdef M_PI +#define PI M_PI +#else +#define PI 3.14159265358979323846 +#endif +#endif + +/* + * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org> + */ + +#if defined(PURIFY) && defined(__clang__) +#if __has_feature(attribute_analyzer_noreturn) && \ + !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) +void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); +#endif +#if !defined(CLANG_ASSERT) +#include <assert.h> +#define CLANG_ASSERT(x) assert(x) #endif +#elif !defined(CLANG_ASSERT) +#define CLANG_ASSERT(x) +#endif /* PURIFY && __clang__ */ + +/* + * The following magic value is stored in the "send_event" field of FocusIn + * and FocusOut events. This allows us to separate "real" events coming from + * the server from those that we generated. + */ + +#define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac) + +/* + * Exported internals. + */ + +#include "tkIntDecls.h" /* * Themed widget set init function: @@ -998,6 +1010,9 @@ MODULE_SCOPE int Tk_BindObjCmd(ClientData clientData, MODULE_SCOPE int Tk_BindtagsObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Tk_BusyObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_ButtonObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -1016,9 +1031,6 @@ MODULE_SCOPE int Tk_ChooseColorObjCmd(ClientData clientData, MODULE_SCOPE int Tk_ChooseDirectoryObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tk_ChooseFontObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_DestroyObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -1110,9 +1122,6 @@ MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData, MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tk_TkObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -1131,6 +1140,10 @@ MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); +MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp, + Tk_Window tkwin, const char *master); +MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin, + const char *master); MODULE_SCOPE void TkEventInit(void); MODULE_SCOPE void TkRegisterObjTypes(void); @@ -1157,8 +1170,8 @@ MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region, unsigned x, unsigned y, unsigned width, unsigned height, unsigned char *dataPtr, unsigned pixelStride, unsigned lineStride); -MODULE_SCOPE void TkPrintPadAmount(Tcl_Interp *interp, - char *buffer, int pad1, int pad2); +MODULE_SCOPE void TkAppendPadAmount(Tcl_Obj *bufferObj, + const char *buffer, int pad1, int pad2); MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *pad1Ptr, int *pad2Ptr); @@ -1179,11 +1192,32 @@ MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, int firstByte, int lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, Tcl_UniChar c, struct TkFontAttributes *faPtr); +MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); +MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); +MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); +MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, + Window parent); +MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, + Window *parentPtr, Tk_Window tkParent, + 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); +MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, + const char *nsname, const char *name, + ClientData clientData, const TkEnsemble *map); +MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, + ClientData clientData); +MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, + ClientData clientData); +MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); + #ifdef __WIN32__ #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, - Colormap map, CONST char* spec, + Colormap map, const char* spec, XColor * colorPtr); #endif #ifdef HAVE_XFT @@ -1198,11 +1232,21 @@ MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLIMPORT +/* + * For Tktest. + */ +MODULE_SCOPE int SquareObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj * const objv[]); +MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); +#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#define TkplatformtestInit(x) TCL_OK +#else +MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); +#endif #endif /* _TKINT */ - + /* * Local Variables: * mode: c |