summaryrefslogtreecommitdiffstats
path: root/generic/tkStubInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-25 13:30:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-25 13:30:03 (GMT)
commit75d0d5da127d9d9b7fbc4b5989c6510eb950e402 (patch)
tree255663c368de4388994f1372fc8643165b175ddd /generic/tkStubInit.c
parenta0029792b685e19df1d79a8170579d88416055b0 (diff)
downloadtk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.zip
tk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.tar.gz
tk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.tar.bz2
implement various internal win32 stub functions for cygwin
Diffstat (limited to 'generic/tkStubInit.c')
-rw-r--r--generic/tkStubInit.c145
1 files changed, 53 insertions, 92 deletions
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index a82e044..89ae433 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -40,18 +40,59 @@
/*
* 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
-#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)
+TkIntStubs tkIntStubs;
#ifndef __WIN32__
/* Make sure that extensions which call XParseColor through
* the stub table, call TkParseColor in stead. See bug #3486474 */
# define XParseColor TkParseColor
+
+# 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 *);
+
+#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
+# define Tk_GetHINSTANCE 0
#endif
+# endif /* !MAC_TCL && !MACC_OSX_TCL */
+
+#endif /* !__WIN32__ */
+
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -176,90 +217,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 +282,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 +779,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 */