diff options
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r-- | generic/tkStubInit.c | 296 |
1 files changed, 162 insertions, 134 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 63250c5..499dfd4 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,47 +30,37 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" +static const TkIntStubs tkIntStubs; + +/* + * Remove macro that might interfere with the definition below. + */ + +#undef Tk_MainEx + #ifdef __WIN32__ -static int -doNothing(void) +int +TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { /* dummy implementation, no need to do anything */ return 0; } +void +TkpSync(Display *display) +{ + /* dummy implementation, no need to do anything */ +} -/* - * Remove macros that will interfere with the definitions below. - */ -# undef TkFreeWindowId -# undef TkInitXId -# undef TkpCmapStressed -# undef TkpSync - -# define TkCreateXEventSource (void (*) (void)) doNothing -# define TkFreeWindowId (void (*) (TkDisplay *, Window)) doNothing -# define TkInitXId (void (*) (TkDisplay *)) doNothing -# define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing -# define TkpSync (void (*) (Display *)) doNothing +# define TkCreateXEventSource (void (*) (void)) TkpSync # define TkUnixContainerId 0 # define TkUnixDoOneXEvent 0 # define TkUnixSetMenubar 0 -# define TkWmCleanup (void (*) (TkDisplay *)) doNothing -# define TkSendCleanup (void (*) (TkDisplay *)) doNothing -# define TkFreeXId (void (*) (TkDisplay *)) doNothing +# define TkWmCleanup (void (*) (TkDisplay *)) TkpSync +# define TkSendCleanup (void (*) (TkDisplay *)) TkpSync # define TkpTestsendCmd 0 #else -/* - * Remove macros that will interfere with the definitions below. - */ - -MODULE_SCOPE TkIntStubs tkIntStubs; -MODULE_SCOPE TkIntPlatStubs tkIntPlatStubs; -MODULE_SCOPE TkIntXlibStubs tkIntXlibStubs; -MODULE_SCOPE TkPlatStubs tkPlatStubs; -MODULE_SCOPE TkStubs tkStubs; - # undef TkClipBox # undef TkCreateRegion # undef TkDestroyRegion @@ -79,7 +69,6 @@ MODULE_SCOPE TkStubs tkStubs; # undef TkSetRegion # undef TkUnionRectWithRegion # undef TkSubtractRegion -# undef TkPutImage # undef TkSetPixmapColormap # undef TkpPrintWindowId # undef TkWinChildProc @@ -90,25 +79,8 @@ MODULE_SCOPE TkStubs tkStubs; */ # define XParseColor TkParseColor -# ifndef __CYGWIN__ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 -# define Tk_GetHINSTANCE 0 -# endif -# if !defined(MAC_TCL) && !defined(MAC_OSX_TCL) -# define TkClipBox (void (*) _ANSI_ARGS_((TkRegion, XRectangle *))) XClipBox -# define TkCreateRegion (TkRegion (*) ()) XCreateRegion -# define TkDestroyRegion (void (*) _ANSI_ARGS_((TkRegion))) XDestroyRegion -# define TkIntersectRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XIntersectRegion -# define TkRectInRegion (int (*) _ANSI_ARGS_((TkRegion, int, int, unsigned int, unsigned int))) XRectInRegion -# define TkSetRegion (void (*) _ANSI_ARGS_((Display *, GC, TkRegion))) XSetRegion -# define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion -# define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion +# ifdef __CYGWIN__ -# ifdef __CYGWIN__ # define Tk_GetHINSTANCE TkPlatGetHINSTANCE /* @@ -129,21 +101,78 @@ static void *Tk_GetHINSTANCE() } void -TkSetPixmapColormap(pixmap, colormap) - Pixmap pixmap; - Colormap colormap; +TkSetPixmapColormap( + Pixmap pixmap, + Colormap colormap) { } void -TkpPrintWindowId(buf, window) - char *buf; /* Pointer to string large enough to hold +TkpPrintWindowId( + char *buf, /* Pointer to string large enough to hold * the hex representation of a pointer. */ - Window window; /* Window to be printed into buffer. */ + Window window) /* Window to be printed into buffer. */ { sprintf(buf, "%#08lx", (unsigned long) (window)); } +void +TkPutImage( + unsigned long *colors, /* Array of pixel values used by this image. + * May be NULL. */ + int ncolors, /* Number of colors used, or 0. */ + Display *display, + Drawable d, /* Destination drawable. */ + GC gc, + XImage *image, /* Source image. */ + int src_x, int src_y, /* Offset of subimage. */ + int dest_x, int dest_y, /* Position of subimage origin in drawable. */ + unsigned int width, unsigned int height) + /* Dimensions of subimage. */ +{ + XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height); +} + +TkRegion TkCreateRegion() +{ + return (TkRegion) XCreateRegion(); +} + +void TkDestroyRegion(TkRegion r) +{ + XDestroyRegion((Region)r); +} + +void TkSetRegion(Display *d, GC g, TkRegion r) +{ + XSetRegion(d, g, (Region)r); +} + +void TkUnionRectWithRegion(XRectangle *a, TkRegion b, TkRegion c) +{ + XUnionRectWithRegion(a, (Region) b, (Region) c); +} + +void TkClipBox(TkRegion a, XRectangle *b) +{ + XClipBox((Region) a, b); +} + +void TkIntersectRegion(TkRegion a, TkRegion b, TkRegion c) +{ + XIntersectRegion((Region) a, (Region) b, (Region) c); +} + +int TkRectInRegion (TkRegion r, int a, int b, unsigned int c, unsigned int d) +{ + return XRectInRegion((Region) r, a, b, c, d); +} + +void TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c) +{ + XSubtractRegion((Region) a, (Region) b, (Region) c); +} + /* TODO: To be implemented for Cygwin */ # define Tk_AttachHWND 0 # define Tk_GetHWND 0 @@ -183,7 +212,6 @@ TkpPrintWindowId(buf, window) # define TkWinGetPlatformTheme 0 # define TkWinChildProc 0 # endif /* __CYGWIN__ */ -# endif /* !MAC_TCL && !MACC_OSX_TCL */ #endif /* !__WIN32__ */ /* @@ -194,21 +222,21 @@ TkpPrintWindowId(buf, window) /* !BEGIN!: Do not edit below this line. */ -TkIntStubs tkIntStubs = { +static const TkIntStubs tkIntStubs = { TCL_STUB_MAGIC, - NULL, + 0, TkAllocWindow, /* 0 */ TkBezierPoints, /* 1 */ TkBezierScreenPoints, /* 2 */ - TkBindDeadWindow, /* 3 */ + 0, /* 3 */ TkBindEventProc, /* 4 */ TkBindFree, /* 5 */ TkBindInit, /* 6 */ TkChangeEventWindow, /* 7 */ TkClipInit, /* 8 */ TkComputeAnchor, /* 9 */ - TkCopyAndGlobalEval, /* 10 */ - TkCreateBindingProcedure, /* 11 */ + 0, /* 10 */ + 0, /* 11 */ TkCreateCursorFromData, /* 12 */ TkCreateFrame, /* 13 */ TkCreateMainWindow, /* 14 */ @@ -273,7 +301,7 @@ TkIntStubs tkIntStubs = { TkpRedirectKeyEvent, /* 73 */ TkpSetMainMenubar, /* 74 */ TkpUseWindow, /* 75 */ - TkpWindowWasRecentlyDeleted, /* 76 */ + 0, /* 76 */ TkQueueEventForAllChildren, /* 77 */ TkReadBitmapFile, /* 78 */ TkScrollWindow, /* 79 */ @@ -281,7 +309,7 @@ TkIntStubs tkIntStubs = { TkSelEventProc, /* 81 */ TkSelInit, /* 82 */ TkSelPropProc, /* 83 */ - NULL, /* 84 */ + 0, /* 84 */ TkSetWindowMenuBar, /* 85 */ TkStringToKeysym, /* 86 */ TkThickPolyLineToArea, /* 87 */ @@ -317,48 +345,48 @@ TkIntStubs tkIntStubs = { TkRectInRegion, /* 117 */ TkSetRegion, /* 118 */ TkUnionRectWithRegion, /* 119 */ - NULL, /* 120 */ + 0, /* 120 */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 121 */ + 0, /* 121 */ #endif /* X11 */ #ifdef __WIN32__ /* WIN */ - NULL, /* 121 */ + 0, /* 121 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 121 */ /* Dummy entry for stubs table backwards compatibility */ + 0, /* 121 */ /* Dummy entry for stubs table backwards compatibility */ TkpCreateNativeBitmap, /* 121 */ #endif /* AQUA */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 122 */ + 0, /* 122 */ #endif /* X11 */ #ifdef __WIN32__ /* WIN */ - NULL, /* 122 */ + 0, /* 122 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 122 */ /* Dummy entry for stubs table backwards compatibility */ + 0, /* 122 */ /* Dummy entry for stubs table backwards compatibility */ TkpDefineNativeBitmaps, /* 122 */ #endif /* AQUA */ - NULL, /* 123 */ + 0, /* 123 */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 124 */ + 0, /* 124 */ #endif /* X11 */ #ifdef __WIN32__ /* WIN */ - NULL, /* 124 */ + 0, /* 124 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 124 */ /* Dummy entry for stubs table backwards compatibility */ + 0, /* 124 */ /* Dummy entry for stubs table backwards compatibility */ TkpGetNativeAppBitmap, /* 124 */ #endif /* AQUA */ - NULL, /* 125 */ - NULL, /* 126 */ - NULL, /* 127 */ - NULL, /* 128 */ - NULL, /* 129 */ - NULL, /* 130 */ - NULL, /* 131 */ - NULL, /* 132 */ - NULL, /* 133 */ - NULL, /* 134 */ + 0, /* 125 */ + 0, /* 126 */ + 0, /* 127 */ + 0, /* 128 */ + 0, /* 129 */ + 0, /* 130 */ + 0, /* 131 */ + 0, /* 132 */ + 0, /* 133 */ + 0, /* 134 */ TkpDrawHighlightBorder, /* 135 */ TkSetFocusWin, /* 136 */ TkpSetKeycodeAndState, /* 137 */ @@ -379,20 +407,20 @@ TkIntStubs tkIntStubs = { TkpDrawFrame, /* 152 */ TkCreateThreadExitHandler, /* 153 */ TkDeleteThreadExitHandler, /* 154 */ - NULL, /* 155 */ + 0, /* 155 */ TkpTestembedCmd, /* 156 */ TkpTesttextCmd, /* 157 */ - NULL, /* 158 */ - NULL, /* 159 */ - NULL, /* 160 */ - NULL, /* 161 */ - NULL, /* 162 */ - NULL, /* 163 */ - NULL, /* 164 */ - NULL, /* 165 */ - NULL, /* 166 */ - NULL, /* 167 */ - NULL, /* 168 */ + TkSelGetSelection, /* 158 */ + TkTextGetIndex, /* 159 */ + TkTextIndexBackBytes, /* 160 */ + TkTextIndexForwBytes, /* 161 */ + TkTextMakeByteIndex, /* 162 */ + TkTextPrintIndex, /* 163 */ + TkTextSetMark, /* 164 */ + TkTextXviewCmd, /* 165 */ + TkTextChanged, /* 166 */ + TkBTreeNumLines, /* 167 */ + TkTextInsertDisplayProc, /* 168 */ TkStateParseProc, /* 169 */ TkStatePrintProc, /* 170 */ TkCanvasDashParseProc, /* 171 */ @@ -405,14 +433,18 @@ TkIntStubs tkIntStubs = { TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ + TkDrawAngledTextLayout, /* 181 */ + TkUnderlineAngledTextLayout, /* 182 */ + TkIntersectAngledTextLayout, /* 183 */ + TkDrawAngledChars, /* 184 */ }; -TkIntPlatStubs tkIntPlatStubs = { +static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, - NULL, + 0, #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ - NULL, /* 1 */ + 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ TkpGetMS, /* 3 */ TkPointerDeadWindow, /* 4 */ @@ -449,22 +481,19 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ TkCreateXEventSource, /* 37 */ - TkFreeWindowId, /* 38 */ - TkInitXId, /* 39 */ - TkpCmapStressed, /* 40 */ - TkpSync, /* 41 */ - TkUnixContainerId, /* 42 */ - TkUnixDoOneXEvent, /* 43 */ - TkUnixSetMenubar, /* 44 */ - TkWmCleanup, /* 45 */ - TkSendCleanup, /* 46 */ - TkFreeXId, /* 47 */ - TkpTestsendCmd, /* 48 */ + TkpCmapStressed, /* 38 */ + TkpSync, /* 39 */ + TkUnixContainerId, /* 40 */ + TkUnixDoOneXEvent, /* 41 */ + TkUnixSetMenubar, /* 42 */ + TkWmCleanup, /* 43 */ + TkSendCleanup, /* 44 */ + TkpTestsendCmd, /* 45 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ TkGenerateActivateEvents, /* 0 */ - NULL, /* 1 */ - NULL, /* 2 */ + 0, /* 1 */ + 0, /* 2 */ TkPointerDeadWindow, /* 3 */ TkpSetCapture, /* 4 */ TkpSetCursor, /* 5 */ @@ -475,14 +504,14 @@ TkIntPlatStubs tkIntPlatStubs = { TkMacOSXDispatchMenuEvent, /* 10 */ TkMacOSXInstallCursor, /* 11 */ TkMacOSXHandleTearoffMenu, /* 12 */ - NULL, /* 13 */ + 0, /* 13 */ TkMacOSXDoHLEvent, /* 14 */ - NULL, /* 15 */ + 0, /* 15 */ TkMacOSXGetXWindow, /* 16 */ TkMacOSXGrowToplevel, /* 17 */ TkMacOSXHandleMenuSelect, /* 18 */ - NULL, /* 19 */ - NULL, /* 20 */ + 0, /* 19 */ + 0, /* 20 */ TkMacOSXInvalidateWindow, /* 21 */ TkMacOSXIsCharacterMissing, /* 22 */ TkMacOSXMakeRealWindowExist, /* 23 */ @@ -510,17 +539,17 @@ TkIntPlatStubs tkIntPlatStubs = { TkMacOSXPreprocessMenu, /* 45 */ TkpIsWindowFloating, /* 46 */ TkMacOSXGetCapture, /* 47 */ - NULL, /* 48 */ + 0, /* 48 */ TkGetTransientMaster, /* 49 */ TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ - NULL, /* 52 */ + 0, /* 52 */ TkpGetMS, /* 53 */ #endif /* AQUA */ #if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ - TkFreeWindowId, /* 1 */ - TkInitXId, /* 2 */ + 0, /* 1 */ + 0, /* 2 */ TkpCmapStressed, /* 3 */ TkpSync, /* 4 */ TkUnixContainerId, /* 5 */ @@ -529,15 +558,15 @@ TkIntPlatStubs tkIntPlatStubs = { TkpScanWindowId, /* 8 */ TkWmCleanup, /* 9 */ TkSendCleanup, /* 10 */ - TkFreeXId, /* 11 */ + 0, /* 11 */ TkpWmSetState, /* 12 */ TkpTestsendCmd, /* 13 */ #endif /* X11 */ }; -TkIntXlibStubs tkIntXlibStubs = { +static const TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, - NULL, + 0, #ifdef __WIN32__ /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ @@ -620,7 +649,7 @@ TkIntXlibStubs tkIntXlibStubs = { XFilterEvent, /* 78 */ XmbLookupString, /* 79 */ TkPutImage, /* 80 */ - NULL, /* 81 */ + 0, /* 81 */ XParseColor, /* 82 */ XCreateGC, /* 83 */ XFreeGC, /* 84 */ @@ -743,10 +772,10 @@ TkIntXlibStubs tkIntXlibStubs = { #endif /* AQUA */ }; -TkPlatStubs tkPlatStubs = { +static const TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, - NULL, -#ifdef __WIN32__ /* WIN */ + 0, +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ @@ -769,14 +798,14 @@ TkPlatStubs tkPlatStubs = { #endif /* AQUA */ }; -static TkStubHooks tkStubHooks = { +static const TkStubHooks tkStubHooks = { &tkPlatStubs, &tkIntStubs, &tkIntPlatStubs, &tkIntXlibStubs }; -TkStubs tkStubs = { +const TkStubs tkStubs = { TCL_STUB_MAGIC, &tkStubHooks, Tk_MainLoop, /* 0 */ @@ -823,7 +852,7 @@ TkStubs tkStubs = { Tk_CreateSelHandler, /* 41 */ Tk_CreateWindow, /* 42 */ Tk_CreateWindowFromPath, /* 43 */ - Tk_DefineBitmap, /* 44 */ + Tk_OldDefineBitmap, /* 44 */ Tk_DefineCursor, /* 45 */ Tk_DeleteAllBindings, /* 46 */ Tk_DeleteBinding, /* 47 */ @@ -865,7 +894,7 @@ TkStubs tkStubs = { Tk_GetAtomName, /* 83 */ Tk_GetBinding, /* 84 */ Tk_GetBitmap, /* 85 */ - Tk_GetBitmapFromData, /* 86 */ + Tk_OldGetBitmapFromData, /* 86 */ Tk_GetCapStyle, /* 87 */ Tk_GetColor, /* 88 */ Tk_GetColorByValue, /* 89 */ @@ -997,8 +1026,8 @@ TkStubs tkStubs = { Tk_InitConsoleChannels, /* 215 */ Tk_CreateConsoleWindow, /* 216 */ Tk_CreateSmoothMethod, /* 217 */ - NULL, /* 218 */ - NULL, /* 219 */ + 0, /* 218 */ + 0, /* 219 */ Tk_GetDash, /* 220 */ Tk_CreateOutline, /* 221 */ Tk_DeleteOutline, /* 222 */ @@ -1053,9 +1082,8 @@ TkStubs tkStubs = { Tk_Interp, /* 271 */ Tk_CreateOldImageType, /* 272 */ Tk_CreateOldPhotoImageFormat, /* 273 */ + Tk_DefineBitmap, /* 274 */ + Tk_GetBitmapFromData, /* 275 */ }; /* !END!: Do not edit above this line. */ - -#undef UNIX_TK -#undef MAC_OSX_TK |