summaryrefslogtreecommitdiffstats
path: root/generic/tkStubInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 11:41:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 11:41:17 (GMT)
commit45fa85f33f94e501ba96c550861e298df9a8a6ad (patch)
treec442506115268ee64927b74f44c80ef24c673388 /generic/tkStubInit.c
parent021238ae28d80332aca5ce297082885bf0e798d5 (diff)
parent6953f9dc57f63fe39701cd4e62ad03259e36c371 (diff)
downloadtk-45fa85f33f94e501ba96c550861e298df9a8a6ad.zip
tk-45fa85f33f94e501ba96c550861e298df9a8a6ad.tar.gz
tk-45fa85f33f94e501ba96c550861e298df9a8a6ad.tar.bz2
[Bug 3508771]: Implement TkClipBox, Tk*Region and Tk_GetHINSTANCE for Cygwin
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r--generic/tkStubInit.c144
1 files changed, 64 insertions, 80 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index c62d143..658909e 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -36,7 +36,7 @@
* below should be made in the generic/tk.decls script.
*/
-MODULE_SCOPE const TkStubs tkStubs;
+static const TkIntStubs tkIntStubs;
/*
* Remove macro that might interfere with the definition below.
@@ -44,11 +44,59 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef Tk_MainEx
+#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 (*) (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__
+/* 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 *);
+
+#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__ */
/* !BEGIN!: Do not edit below this line. */
@@ -168,76 +216,13 @@ static const TkIntStubs tkIntStubs = {
TkpGetSubFonts, /* 110 */
TkpGetSystemDefault, /* 111 */
TkpMenuThreadInit, /* 112 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 113 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkClipBox, /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 113 */ /* Dummy entry for stubs table backwards compatibility */
- TkClipBox, /* 113 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 114 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkCreateRegion, /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 114 */ /* Dummy entry for stubs table backwards compatibility */
TkCreateRegion, /* 114 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 115 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkDestroyRegion, /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 115 */ /* Dummy entry for stubs table backwards compatibility */
- TkDestroyRegion, /* 115 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 116 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkIntersectRegion, /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 116 */ /* Dummy entry for stubs table backwards compatibility */
- TkIntersectRegion, /* 116 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 117 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkRectInRegion, /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 117 */ /* Dummy entry for stubs table backwards compatibility */
- TkRectInRegion, /* 117 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 118 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkSetRegion, /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 118 */ /* Dummy entry for stubs table backwards compatibility */
- TkSetRegion, /* 118 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 119 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkUnionRectWithRegion, /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 119 */ /* Dummy entry for stubs table backwards compatibility */
- TkUnionRectWithRegion, /* 119 */
-#endif /* AQUA */
0, /* 120 */
#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
0, /* 121 */
@@ -290,16 +275,7 @@ static const TkIntStubs tkIntStubs = {
TkFocusFree, /* 142 */
TkClipCleanup, /* 143 */
TkGCCleanup, /* 144 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 145 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkSubtractRegion, /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 145 */ /* Dummy entry for stubs table backwards compatibility */
TkSubtractRegion, /* 145 */
-#endif /* AQUA */
TkStylePkgInit, /* 146 */
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
@@ -668,6 +644,14 @@ 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 */
Tk_AttachHWND, /* 0 */
Tk_GetHINSTANCE, /* 1 */
@@ -677,12 +661,12 @@ static const TkPlatStubs tkPlatStubs = {
Tk_TranslateWinEvent, /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- Tk_MacOSXSetEmbedHandler, /* 0 */
- Tk_MacOSXTurnOffMenus, /* 1 */
- Tk_MacOSXTkOwnsCursor, /* 2 */
- TkMacOSXInitMenus, /* 3 */
- TkMacOSXInitAppleEvents, /* 4 */
- TkGenWMConfigureEvent, /* 5 */
+ Tk_AttachHWND, /* 0 */
+ Tk_GetHINSTANCE, /* 1 */
+ Tk_GetHWND, /* 2 */
+ Tk_HWNDToWindow, /* 3 */
+ Tk_PointerEvent, /* 4 */
+ Tk_TranslateWinEvent, /* 5 */
TkMacOSXInvalClipRgns, /* 6 */
TkMacOSXGetDrawablePort, /* 7 */
TkMacOSXGetRootControl, /* 8 */