diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-05 04:46:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-05 04:46:39 (GMT) |
commit | bffdf13f31774677807ea594324f7a8964a1ee10 (patch) | |
tree | 4b1b6848a2a8f1b3f66d319e784c6d08ddc042ab /generic/tkStubInit.c | |
parent | 91ae12c773a03fe4533d19a6d115deb6a4c95351 (diff) | |
parent | e35d614587b25a1a03ededdf2d04bcbfca86be70 (diff) | |
download | tk-bffdf13f31774677807ea594324f7a8964a1ee10.zip tk-bffdf13f31774677807ea594324f7a8964a1ee10.tar.gz tk-bffdf13f31774677807ea594324f7a8964a1ee10.tar.bz2 |
Change XSetDashes signature and many others to match Xorg, needed for Cygwin
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r-- | generic/tkStubInit.c | 139 |
1 files changed, 97 insertions, 42 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 4a4c3a6..342994a 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -39,13 +39,19 @@ doNothing(void) return 0; } +#define TkCreateXEventSource TkPlatCreateXEventSource +static void +TkCreateXEventSource(void) +{ + TkWinXInit(Tk_GetHINSTANCE()); +} + /* * Remove macros that will interfere with the definitions below. */ # undef TkpCmapStressed # undef TkpSync -# define TkCreateXEventSource (void (*) (void)) doNothing # define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing # define TkpSync (void (*) (Display *)) doNothing # define TkUnixContainerId 0 @@ -57,24 +63,6 @@ doNothing(void) #else /* !__WIN32__ */ -# undef TkClipBox -# undef TkCreateRegion -# undef TkDestroyRegion -# undef TkIntersectRegion -# undef TkRectInRegion -# undef TkSetRegion -# undef TkUnionRectWithRegion -# undef TkSubtractRegion - -# 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 - /* * Make sure that extensions which call XParseColor through the stub * table, call TkParseColor instead. [Bug 3486474] @@ -83,25 +71,16 @@ doNothing(void) # ifdef __CYGWIN__ - /* - * Remove macros that will interfere with the definitions below. - */ -# undef TkPutImage -# undef TkSetPixmapColormap -# undef TkpPrintWindowId -# undef TkWinChildProc + TkIntStubs tkIntStubs; +/* + * Trick, so we don't have to include <windows.h> here, which in any + * case lacks this function anyway. + */ - /* - * 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 +#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); -TkIntStubs tkIntStubs; - void *Tk_GetHINSTANCE() { void *hInstance = NULL; @@ -112,21 +91,78 @@ 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)); } +int +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. */ +{ + return 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 @@ -166,7 +202,26 @@ TkpPrintWindowId(buf, window) # define TkWinGetPlatformTheme 0 # define TkWinChildProc 0 -# endif /* __CYGWIN__ */ +# elif !defined(MAC_TCL) && !defined(MAC_OSX_TK) /* UNIX */ + +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion + +# 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 +# endif #endif /* !__WIN32__ */ /* @@ -518,7 +573,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, NULL, -#if defined(__WIN32__) /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ |