diff options
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r-- | generic/tkStubInit.c | 213 |
1 files changed, 137 insertions, 76 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index d4f7d79..adaf319 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -37,35 +37,41 @@ #include "tkIntPlatDecls.h" #include "tkIntXlibDecls.h" +#ifdef __WIN32__ + +static int +doNothing(void) +{ + /* dummy implementation, no need to do anything */ + return 0; +} + /* * Remove macros that will interfere with the definitions below. */ -#undef TkClipBox -#undef TkCreateRegion -#undef TkDestroyRegion -#undef TkIntersectRegion -#undef TkRectInRegion -#undef TkSetRegion -#undef TkUnionRectWithRegion -#undef TkSubtractRegion -#undef TkPutImage +# undef TkpCmapStressed +# undef TkpSync -#ifndef __WIN32__ -/* - * Make sure that extensions which call XParseColor through the stub - * table, call TkParseColor instead. [Bug 3486474] - */ -# define XParseColor TkParseColor +# define TkCreateXEventSource (void (*) (void)) doNothing +# define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing +# define TkpSync (void (*) (Display *)) doNothing +# define TkUnixContainerId 0 +# define TkUnixDoOneXEvent 0 +# define TkUnixSetMenubar 0 +# define TkWmCleanup (void (*) (TkDisplay *)) doNothing +# define TkSendCleanup (void (*) (TkDisplay *)) doNothing + +#else /* !__WIN32__ */ + +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion -# 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 @@ -75,21 +81,34 @@ # define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion # define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion -# ifdef __CYGWIN__ -# define TkPutImage TkIntXlibPutImage -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 - /* - * Trick, so we don't have to include <windows.h> here, which in any - * case lacks this function anyway. + * Make sure that extensions which call XParseColor through the stub + * table, call TkParseColor instead. [Bug 3486474] */ +# define XParseColor TkParseColor + +# ifdef __CYGWIN__ + + /* + * Remove macros that will interfere with the definitions below. + */ +# undef TkPutImage +# undef TkSetPixmapColormap +# undef TkpPrintWindowId +# undef TkWinChildProc + + /* + * Trick, so we don't have to include <windows.h> here, which in any + * case lacks this function anyway. + */ + +# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); TkIntStubs tkIntStubs; -static void *Tk_GetHINSTANCE() +void *Tk_GetHINSTANCE() { void *hInstance = NULL; @@ -97,22 +116,63 @@ static void *Tk_GetHINSTANCE() (const char *) &tkIntStubs, &hInstance); return hInstance; } -static void TkPutImage(unsigned long *colors, int ncolors, Display *display, - Drawable d, GC gc, XImage *image, int destx, int desty, - int srcx, int srcy, unsigned int width, unsigned int height) + +void +TkSetPixmapColormap(pixmap, colormap) + Pixmap pixmap; + Colormap colormap; +{ +} + +void +TkpPrintWindowId(buf, window) + char *buf; /* Pointer to string large enough to hold + * the hex representation of a pointer. */ + Window window; /* Window to be printed into buffer. */ { - XPutImage(display, d, gc, image, destx, desty, srcx, srcy, width, height); + sprintf(buf, "%#08lx", (unsigned long) (window)); } - /* TODO: To be implemented for Cygwin */ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 + /* TODO: To be implemented for Cygwin */ +# define Tk_AttachHWND 0 +# define Tk_GetHWND 0 +# define Tk_HWNDToWindow 0 +# define Tk_PointerEvent 0 +# define Tk_TranslateWinEvent 0 +# define TkAlignImageData 0 +# define TkGenerateActivateEvents 0 +# define TkpGetMS 0 +# define TkPointerDeadWindow 0 +# define TkpSetCapture 0 +# define TkpSetCursor 0 +# define TkWinCancelMouseTimer 0 +# define TkWinClipboardRender 0 +# define TkWinEmbeddedEventProc 0 +# define TkWinFillRect 0 +# define TkWinGetBorderPixels 0 +# define TkWinGetDrawableDC 0 +# define TkWinGetModifierState 0 +# define TkWinGetSystemPalette 0 +# define TkWinGetWrapperWindow 0 +# define TkWinHandleMenuEvent 0 +# define TkWinIndexOfColor 0 +# define TkWinReleaseDrawableDC 0 +# define TkWinResendEvent 0 +# define TkWinSelectPalette 0 +# define TkWinSetMenu 0 +# define TkWinSetWindowPos 0 +# define TkWinWmCleanup 0 +# define TkWinXCleanup 0 +# define TkWinXInit 0 +# define TkWinSetForegroundWindow 0 +# define TkWinDialogDebug 0 +# define TkWinGetMenuSystemDefault 0 +# define TkWinGetPlatformId 0 +# define TkWinSetHINSTANCE 0 +# define TkWinGetPlatformTheme 0 +# define TkWinChildProc 0 # endif /* __CYGWIN__ */ -# endif /* !MAC_TCL && !MACC_OSX_TCL */ #endif /* !__WIN32__ */ /* @@ -250,40 +310,40 @@ TkIntStubs tkIntStubs = { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ NULL, /* 121 */ #endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ NULL, /* 121 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL TkpCreateNativeBitmap, /* 121 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ TkpCreateNativeBitmap, /* 121 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ NULL, /* 122 */ #endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ NULL, /* 122 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL TkpDefineNativeBitmaps, /* 122 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ TkpDefineNativeBitmaps, /* 122 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ NULL, /* 123 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ NULL, /* 124 */ #endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ NULL, /* 124 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL TkpGetNativeAppBitmap, /* 124 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ TkpGetNativeAppBitmap, /* 124 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ NULL, /* 125 */ NULL, /* 126 */ NULL, /* 127 */ @@ -317,7 +377,7 @@ TkIntStubs tkIntStubs = { TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ NULL, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -354,7 +414,16 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformId, /* 33 */ TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ -#endif /* __WIN32__ */ + TkWinChildProc, /* 36 */ + TkCreateXEventSource, /* 37 */ + TkpCmapStressed, /* 38 */ + TkpSync, /* 39 */ + TkUnixContainerId, /* 40 */ + TkUnixDoOneXEvent, /* 41 */ + TkUnixSetMenubar, /* 42 */ + TkWmCleanup, /* 43 */ + TkSendCleanup, /* 44 */ +#endif /* WIN */ #ifdef MAC_TCL TkGenerateActivateEvents, /* 0 */ NULL, /* 1 */ @@ -424,7 +493,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkMacPreprocessMenu, /* 65 */ TkpIsWindowFloating, /* 66 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ TkGenerateActivateEvents, /* 0 */ NULL, /* 1 */ NULL, /* 2 */ @@ -479,8 +548,8 @@ TkIntPlatStubs tkIntPlatStubs = { TkGenWMDestroyEvent, /* 51 */ NULL, /* 52 */ TkpGetMS, /* 53 */ -#endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#endif /* AQUA */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ TkFreeWindowId, /* 1 */ TkInitXId, /* 2 */ @@ -500,7 +569,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, NULL, -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -608,7 +677,7 @@ TkIntXlibStubs tkIntXlibStubs = { XDrawLine, /* 104 */ XWarpPointer, /* 105 */ XFillRectangle, /* 106 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ @@ -702,7 +771,7 @@ TkIntXlibStubs tkIntXlibStubs = { XQueryColors, /* 89 */ XQueryTree, /* 90 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -795,28 +864,20 @@ TkIntXlibStubs tkIntXlibStubs = { XQueryColors, /* 89 */ XQueryTree, /* 90 */ XSync, /* 91 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ }; TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, NULL, -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - Tk_AttachHWND, /* 0 */ - Tk_GetHINSTANCE, /* 1 */ - Tk_GetHWND, /* 2 */ - Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ -#endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ Tk_HWNDToWindow, /* 3 */ Tk_PointerEvent, /* 4 */ Tk_TranslateWinEvent, /* 5 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL Tk_MacSetEmbedHandler, /* 0 */ Tk_MacTurnOffMenus, /* 1 */ @@ -830,7 +891,7 @@ TkPlatStubs tkPlatStubs = { TkMacHaveAppearance, /* 9 */ TkMacGetDrawablePort, /* 10 */ #endif /* MAC_TCL */ -#ifdef MAC_OSX_TK +#ifdef MAC_OSX_TK /* AQUA */ Tk_MacOSXSetEmbedHandler, /* 0 */ Tk_MacOSXTurnOffMenus, /* 1 */ Tk_MacOSXTkOwnsCursor, /* 2 */ @@ -842,7 +903,7 @@ TkPlatStubs tkPlatStubs = { TkMacOSXGetRootControl, /* 8 */ Tk_MacOSXSetupTkNotifier, /* 9 */ Tk_MacOSXIsAppInFront, /* 10 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ }; static TkStubHooks tkStubHooks = { |