summaryrefslogtreecommitdiffstats
path: root/generic/tkStubInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 09:14:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 09:14:45 (GMT)
commit0325826958d4b99fe71050eb1ce9e3aca7d4e499 (patch)
treed391271502b1d39a58153d0be2f7a96b160fba86 /generic/tkStubInit.c
parentc5a1fb819282a68bad2fd70104628a6a13f8a4b3 (diff)
parentece6d6152f164938bdfcdb8fa397e97baa51cd58 (diff)
downloadtk-0325826958d4b99fe71050eb1ce9e3aca7d4e499.zip
tk-0325826958d4b99fe71050eb1ce9e3aca7d4e499.tar.gz
tk-0325826958d4b99fe71050eb1ce9e3aca7d4e499.tar.bz2
[Bug 3508771]: Implement TkClipBox, Tk*Region and Tk_GetHINSTANCE for Cygwin
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r--generic/tkStubInit.c152
1 files changed, 58 insertions, 94 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index a82e044..d37dd4c 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -40,17 +40,61 @@
/*
* Remove macros that will interfere with the definitions below.
*/
-
-#define Tk_CreateCanvasVisitor ((void (*) _ANSI_ARGS_((Tcl_Interp * interp, \
- VOID * typePtr))) NULL)
-#define Tk_GetCanvasVisitor ((VOID * (*) _ANSI_ARGS_((Tcl_Interp * interp, \
- CONST char * name))) NULL)
+#undef TkClipBox
+#undef TkCreateRegion
+#undef TkDestroyRegion
+#undef TkIntersectRegion
+#undef TkRectInRegion
+#undef TkSetRegion
+#undef TkUnionRectWithRegion
+#undef TkSubtractRegion
+#undef TkPutImage
#ifndef __WIN32__
/* Make sure that extensions which call XParseColor through
* the stub table, call TkParseColor in stead. See bug #3486474 */
# define XParseColor TkParseColor
-#endif
+
+# if !defined(MAC_TCL) && !defined(MAC_OSX_TCL)
+# define Tk_AttachHWND 0
+# define Tk_GetHWND 0
+# define Tk_HWNDToWindow 0
+# define Tk_PointerEvent 0
+# define Tk_TranslateWinEvent 0
+# 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__
+/* Trick, so we don't have to include <windows.h> here, which
+ * - b.t.w. - lacks this function anyway */
+#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
+
+TkIntStubs tkIntStubs;
+
+#define Tk_GetHINSTANCE TkPlatGetHINSTANCE
+static void *Tk_GetHINSTANCE()
+{
+ void *hInstance = NULL;
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const char *)&tkIntStubs, &hInstance);
+ return hInstance;
+}
+
+#else /* __CYGWIN__ */
+# define Tk_GetHINSTANCE 0
+# define TkPutImage 0
+#endif /* __CYGWIN__ */
+
+# endif /* !MAC_TCL && !MACC_OSX_TCL */
+
+#endif /* !__WIN32__ */
/*
* WARNING: The contents of this file is automatically generated by the
@@ -176,90 +220,13 @@ TkIntStubs tkIntStubs = {
TkpGetSubFonts, /* 110 */
TkpGetSystemDefault, /* 111 */
TkpMenuThreadInit, /* 112 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 113 */
-#endif /* UNIX */
-#ifdef __WIN32__
TkClipBox, /* 113 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkClipBox, /* 113 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkClipBox, /* 113 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 114 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkCreateRegion, /* 114 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
TkCreateRegion, /* 114 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkCreateRegion, /* 114 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 115 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkDestroyRegion, /* 115 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkDestroyRegion, /* 115 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
TkDestroyRegion, /* 115 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 116 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkIntersectRegion, /* 116 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkIntersectRegion, /* 116 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
TkIntersectRegion, /* 116 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 117 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkRectInRegion, /* 117 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
TkRectInRegion, /* 117 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkRectInRegion, /* 117 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 118 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkSetRegion, /* 118 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkSetRegion, /* 118 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
TkSetRegion, /* 118 */
-#endif /* MAC_OSX_TK */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 119 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkUnionRectWithRegion, /* 119 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
- TkUnionRectWithRegion, /* 119 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
TkUnionRectWithRegion, /* 119 */
-#endif /* MAC_OSX_TK */
NULL, /* 120 */
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
NULL, /* 121 */
@@ -318,18 +285,7 @@ TkIntStubs tkIntStubs = {
TkFocusFree, /* 142 */
TkClipCleanup, /* 143 */
TkGCCleanup, /* 144 */
-#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
- NULL, /* 145 */
-#endif /* UNIX */
-#ifdef __WIN32__
- TkSubtractRegion, /* 145 */
-#endif /* __WIN32__ */
-#ifdef MAC_TCL
TkSubtractRegion, /* 145 */
-#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
- TkSubtractRegion, /* 145 */
-#endif /* MAC_OSX_TK */
TkStylePkgInit, /* 146 */
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
@@ -826,6 +782,14 @@ TkIntXlibStubs tkIntXlibStubs = {
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__
Tk_AttachHWND, /* 0 */
Tk_GetHINSTANCE, /* 1 */