diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-26 06:07:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-26 06:07:25 (GMT) |
commit | e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262 (patch) | |
tree | 5c662f5e1b8c73c18c27fbcf410c1faf0d43297e /generic/tkStubInit.c | |
parent | 1781ae2223312ebc0d57a9861834a2be6904b53b (diff) | |
parent | 6092901c18b64a83b6d7ccb7e4c63679afb801b1 (diff) | |
download | tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.zip tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.tar.gz tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.tar.bz2 |
implement TkSetPixmapColormap and TkpPrintWindowId for cygwin.
cleanup some more unused CYGWIN stuff .
Change XSetCommand signature to match Xorg, needed for Cygwin
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r-- | generic/tkStubInit.c | 260 |
1 files changed, 190 insertions, 70 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index e19180f..6ba0bda 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,12 +30,6 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" -/* - * WARNING: The contents of this file is automatically generated by the - * tools/genStubs.tcl script. Any modifications to the function declarations - * below should be made in the generic/tk.decls script. - */ - static const TkIntStubs tkIntStubs; /* @@ -44,50 +38,46 @@ static const TkIntStubs tkIntStubs; #undef Tk_MainEx -#undef TkClipBox -#undef TkCreateRegion -#undef TkDestroyRegion -#undef TkIntersectRegion -#undef TkRectInRegion -#undef TkSetRegion -#undef TkUnionRectWithRegion -#undef TkSubtractRegion -#undef TkPutImage - -#ifndef __WIN32__ +#ifdef __WIN32__ + +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 */ +} + +# define TkCreateXEventSource (void (*) (void)) TkpSync +# define TkUnixContainerId 0 +# define TkUnixDoOneXEvent 0 +# define TkUnixSetMenubar 0 +# define TkWmCleanup (void (*) (TkDisplay *)) TkpSync +# define TkSendCleanup (void (*) (TkDisplay *)) TkpSync +# define TkpTestsendCmd 0 + +#else + /* * Make sure that extensions which call XParseColor through the stub * table, call TkParseColor instead. [Bug 3486474] */ # 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 (*) (TkRegion, XRectangle *)) XClipBox -# define TkCreateRegion (TkRegion (*) ()) XCreateRegion -# define TkDestroyRegion (void (*) (TkRegion)) XDestroyRegion -# define TkIntersectRegion (void (*) (TkRegion, TkRegion, TkRegion)) XIntersectRegion -# define TkRectInRegion (int (*) (TkRegion, int, int, unsigned int, unsigned int)) XRectInRegion -# define TkSetRegion (void (*) (Display *, GC, TkRegion)) XSetRegion -# define TkUnionRectWithRegion (void (*) (XRectangle *, TkRegion, TkRegion)) XUnionRectWithRegion -# define TkSubtractRegion (void (*) (TkRegion, TkRegion, TkRegion)) XSubtractRegion - -# ifdef __CYGWIN__ -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +# ifdef __CYGWIN__ + +# define Tk_GetHINSTANCE TkPlatGetHINSTANCE /* * 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 *); static void *Tk_GetHINSTANCE() @@ -98,19 +88,148 @@ static void *Tk_GetHINSTANCE() (const char *) &tkIntStubs, &hInstance); return hInstance; } - /* 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 - -# else /* !__CYGWIN__ */ -# define TkPutImage 0 -# endif /* __CYGWIN__ */ -# endif /* !MAC_TCL && !MACC_OSX_TCL */ + +void +TkSetPixmapColormap( + Pixmap pixmap, + Colormap colormap) +{ +} + +void +TkpPrintWindowId( + char *buf, /* Pointer to string large enough to hold + * the hex representation of a pointer. */ + 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 +# 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 + +#elif !defined(MAC_OSC_TK) /* UNIX */ + +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion + +# define TkClipBox (void (*) (TkRegion, XRectangle *)) XClipBox +# define TkCreateRegion (TkRegion (*) ()) XCreateRegion +# define TkDestroyRegion (void (*) (TkRegion)) XDestroyRegion +# define TkIntersectRegion (void (*) (TkRegion, TkRegion, TkRegion)) XIntersectRegion +# define TkRectInRegion (int (*) (TkRegion, int, int, unsigned int, unsigned int)) XRectInRegion +# define TkSetRegion (void (*) (Display *, GC, TkRegion)) XSetRegion +# define TkUnionRectWithRegion (void (*) (XRectangle *, TkRegion, TkRegion)) XUnionRectWithRegion +# define TkSubtractRegion (void (*) (TkRegion, TkRegion, TkRegion)) XSubtractRegion + +# endif #endif /* !__WIN32__ */ +/* + * WARNING: The contents of this file is automatically generated by the + * tools/genStubs.tcl script. Any modifications to the function declarations + * below should be made in the generic/tk.decls script. + */ + /* !BEGIN!: Do not edit below this line. */ static const TkIntStubs tkIntStubs = { @@ -240,7 +359,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 121 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 121 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -250,7 +369,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 122 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 122 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -261,7 +380,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 124 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 124 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -333,7 +452,7 @@ static const TkIntStubs tkIntStubs = { static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -371,6 +490,15 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ + TkCreateXEventSource, /* 37 */ + 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 */ @@ -428,7 +556,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { 0, /* 52 */ TkpGetMS, /* 53 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -449,7 +577,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { static const TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, 0, -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -657,15 +785,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { static const TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, 0, -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - Tk_AttachHWND, /* 0 */ - Tk_GetHINSTANCE, /* 1 */ - Tk_GetHWND, /* 2 */ - Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ @@ -674,12 +794,12 @@ static const TkPlatStubs tkPlatStubs = { Tk_TranslateWinEvent, /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - Tk_AttachHWND, /* 0 */ - Tk_GetHINSTANCE, /* 1 */ - Tk_GetHWND, /* 2 */ - Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ + Tk_MacOSXSetEmbedHandler, /* 0 */ + Tk_MacOSXTurnOffMenus, /* 1 */ + Tk_MacOSXTkOwnsCursor, /* 2 */ + TkMacOSXInitMenus, /* 3 */ + TkMacOSXInitAppleEvents, /* 4 */ + TkGenWMConfigureEvent, /* 5 */ TkMacOSXInvalClipRgns, /* 6 */ TkMacOSXGetDrawablePort, /* 7 */ TkMacOSXGetRootControl, /* 8 */ |