summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--generic/tk.decls23
-rw-r--r--generic/tkInt.decls16
-rw-r--r--generic/tkIntDecls.h200
-rw-r--r--generic/tkPlatDecls.h94
-rw-r--r--generic/tkStubInit.c144
-rw-r--r--unix/tkUnixPort.h16
7 files changed, 194 insertions, 307 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e28f30..e47126c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-04-26 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk.decls: [Bug 3508771]: Implement TkClipBox, Tk*Region and
+ * generic/tkInt.decls: Tk_GetHINSTANCE for Cygwin
+ * generic/tkPlatDecls.h:
+ * generic/tkintDecls.h:
+ * generic/tkStubInit.c:
+
2012-04-22 Donal K. Fellows <dkf@users.sf.net>
* generic/tkBind.c (ExpandPercents): [Bug 3520202]: Ensure that the
diff --git a/generic/tk.decls b/generic/tk.decls
index 2671421..897d84a 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -1087,7 +1087,28 @@ interface tkPlat
################################
# Unix specific functions
-# (none)
+#
+
+declare 0 unix {
+ Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd)
+}
+declare 1 unix {
+ void *Tk_GetHINSTANCE(void)
+}
+declare 2 unix {
+ void *Tk_GetHWND(Window window)
+}
+declare 3 unix {
+ Tk_Window Tk_HWNDToWindow(void *hwnd)
+}
+declare 4 unix {
+ void Tk_PointerEvent(void *hwnd, int x, int y)
+}
+declare 5 unix {
+ int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam, int *result)
+}
+
################################
# Windows specific functions
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 2f58dde..7a69e50 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -398,26 +398,26 @@ declare 111 {
declare 112 {
void TkpMenuThreadInit(void)
}
-declare 113 {aqua win} {
+declare 113 {
void TkClipBox(TkRegion rgn, XRectangle *rect_return)
}
-declare 114 {aqua win} {
+declare 114 {
TkRegion TkCreateRegion(void)
}
-declare 115 {aqua win} {
+declare 115 {
void TkDestroyRegion(TkRegion rgn)
}
-declare 116 {aqua win} {
+declare 116 {
void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
-declare 117 {aqua win} {
+declare 117 {
int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width,
unsigned int height)
}
-declare 118 {aqua win} {
+declare 118 {
void TkSetRegion(Display *display, GC gc, TkRegion rgn)
}
-declare 119 {aqua win} {
+declare 119 {
void TkUnionRectWithRegion(XRectangle *rect,
TkRegion src, TkRegion dr_return)
}
@@ -463,7 +463,7 @@ declare 143 {
declare 144 {
void TkGCCleanup(TkDisplay *dispPtr)
}
-declare 145 {win aqua} {
+declare 145 {
void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
declare 146 {
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index cfa87da..d50f07c 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -329,68 +329,23 @@ EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin,
const char *dbName, const char *className);
/* 112 */
EXTERN void TkpMenuThreadInit(void);
-#ifdef __WIN32__ /* WIN */
-/* 113 */
-EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 113 */
EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 114 */
-EXTERN TkRegion TkCreateRegion(void);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 114 */
EXTERN TkRegion TkCreateRegion(void);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 115 */
-EXTERN void TkDestroyRegion(TkRegion rgn);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 115 */
EXTERN void TkDestroyRegion(TkRegion rgn);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
/* 116 */
EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-/* 116 */
-EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 117 */
-EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
- unsigned int width, unsigned int height);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 117 */
EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
unsigned int width, unsigned int height);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 118 */
-EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 118 */
EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 119 */
-EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
- TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 119 */
EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
TkRegion dr_return);
-#endif /* AQUA */
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
/* 121 */
@@ -440,16 +395,9 @@ EXTERN void TkFocusFree(TkMainInfo *mainPtr);
EXTERN void TkClipCleanup(TkDisplay *dispPtr);
/* 144 */
EXTERN void TkGCCleanup(TkDisplay *dispPtr);
-#ifdef __WIN32__ /* WIN */
/* 145 */
EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-/* 145 */
-EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
-#endif /* AQUA */
/* 146 */
EXTERN void TkStylePkgInit(TkMainInfo *mainPtr);
/* 147 */
@@ -716,76 +664,13 @@ typedef struct TkIntStubs {
void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */
Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */
void (*tkpMenuThreadInit) (void); /* 112 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved113)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved113)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved114)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkRegion (*tkCreateRegion) (void); /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved114)(void); /* Dummy entry for stubs table backwards compatibility */
- TkRegion (*tkCreateRegion) (void); /* 114 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved115)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved115)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved116)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved116)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved117)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved117)(void); /* Dummy entry for stubs table backwards compatibility */
int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved118)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved118)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved119)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved119)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
-#endif /* AQUA */
void (*reserved120)(void);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
void (*reserved121)(void);
@@ -838,16 +723,7 @@ typedef struct TkIntStubs {
void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */
void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */
void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved145)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved145)(void); /* Dummy entry for stubs table backwards compatibility */
- void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
-#endif /* AQUA */
void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */
void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */
Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, const char *cmdName); /* 148 */
@@ -1124,62 +1000,20 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkpGetSystemDefault) /* 111 */
#define TkpMenuThreadInit \
(tkIntStubsPtr->tkpMenuThreadInit) /* 112 */
-#ifdef __WIN32__ /* WIN */
-#define TkClipBox \
- (tkIntStubsPtr->tkClipBox) /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkClipBox \
(tkIntStubsPtr->tkClipBox) /* 113 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkCreateRegion \
- (tkIntStubsPtr->tkCreateRegion) /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkCreateRegion \
(tkIntStubsPtr->tkCreateRegion) /* 114 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
#define TkDestroyRegion \
(tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-#define TkDestroyRegion \
- (tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkIntersectRegion \
- (tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkIntersectRegion \
(tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
#define TkRectInRegion \
(tkIntStubsPtr->tkRectInRegion) /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-#define TkRectInRegion \
- (tkIntStubsPtr->tkRectInRegion) /* 117 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkSetRegion \
- (tkIntStubsPtr->tkSetRegion) /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkSetRegion \
(tkIntStubsPtr->tkSetRegion) /* 118 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkUnionRectWithRegion \
- (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkUnionRectWithRegion \
(tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
-#endif /* AQUA */
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
#define TkpCreateNativeBitmap \
@@ -1224,14 +1058,8 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkClipCleanup) /* 143 */
#define TkGCCleanup \
(tkIntStubsPtr->tkGCCleanup) /* 144 */
-#ifdef __WIN32__ /* WIN */
-#define TkSubtractRegion \
- (tkIntStubsPtr->tkSubtractRegion) /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkSubtractRegion \
(tkIntStubsPtr->tkSubtractRegion) /* 145 */
-#endif /* AQUA */
#define TkStylePkgInit \
(tkIntStubsPtr->tkStylePkgInit) /* 146 */
#define TkStylePkgFree \
@@ -1317,5 +1145,33 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+/*
+ * On X11, these macros are just wrappers for the equivalent X Region calls.
+ */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+
+#undef TkClipBox
+#undef TkCreateRegion
+#undef TkDestroyRegion
+#undef TkIntersectRegion
+#undef TkRectInRegion
+#undef TkSetRegion
+#undef TkSubtractRegion
+#undef TkUnionRectWithRegion
+
+#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
+#define TkCreateRegion() (TkRegion) XCreateRegion()
+#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
+#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
+ (Region) b, (Region) r)
+#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
+#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
+#define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
+ (Region) b, (Region) r)
+#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
+ (Region) src, (Region) ret)
+
+#endif /* UNIX */
+
#endif /* _TKINTDECLS */
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index 49274d4..74f4ccd 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -33,6 +33,22 @@ extern "C" {
* Exported function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+/* 0 */
+EXTERN Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd);
+/* 1 */
+EXTERN void * Tk_GetHINSTANCE(void);
+/* 2 */
+EXTERN void * Tk_GetHWND(Window window);
+/* 3 */
+EXTERN Tk_Window Tk_HWNDToWindow(void *hwnd);
+/* 4 */
+EXTERN void Tk_PointerEvent(void *hwnd, int x, int y);
+/* 5 */
+EXTERN int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam,
+ int *result);
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd);
@@ -51,23 +67,19 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
+EXTERN Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd);
/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus(void);
+EXTERN void * Tk_GetHINSTANCE(void);
/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
+EXTERN void * Tk_GetHWND(Window window);
/* 3 */
-EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+EXTERN Tk_Window Tk_HWNDToWindow(void *hwnd);
/* 4 */
-EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
+EXTERN void Tk_PointerEvent(void *hwnd, int x, int y);
/* 5 */
-EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
- int width, int height, int flags);
+EXTERN int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam,
+ int *result);
/* 6 */
EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
/* 7 */
@@ -84,6 +96,14 @@ typedef struct TkPlatStubs {
int magic;
const struct TkPlatStubHooks *hooks;
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ Window (*tk_AttachHWND) (Tk_Window tkwin, void *hwnd); /* 0 */
+ void * (*tk_GetHINSTANCE) (void); /* 1 */
+ void * (*tk_GetHWND) (Window window); /* 2 */
+ Tk_Window (*tk_HWNDToWindow) (void *hwnd); /* 3 */
+ void (*tk_PointerEvent) (void *hwnd, int x, int y); /* 4 */
+ int (*tk_TranslateWinEvent) (void *hwnd, unsigned int message, int wParam, int lParam, int *result); /* 5 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */
HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */
@@ -93,12 +113,12 @@ typedef struct TkPlatStubs {
int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*tk_MacOSXSetEmbedHandler) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 0 */
- void (*tk_MacOSXTurnOffMenus) (void); /* 1 */
- void (*tk_MacOSXTkOwnsCursor) (int tkOwnsIt); /* 2 */
- void (*tkMacOSXInitMenus) (Tcl_Interp *interp); /* 3 */
- void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
- void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ Window (*tk_AttachHWND) (Tk_Window tkwin, void *hwnd); /* 0 */
+ void * (*tk_GetHINSTANCE) (void); /* 1 */
+ void * (*tk_GetHWND) (Window window); /* 2 */
+ Tk_Window (*tk_HWNDToWindow) (void *hwnd); /* 3 */
+ void (*tk_PointerEvent) (void *hwnd, int x, int y); /* 4 */
+ int (*tk_TranslateWinEvent) (void *hwnd, unsigned int message, int wParam, int lParam, int *result); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
@@ -121,6 +141,20 @@ extern const TkPlatStubs *tkPlatStubsPtr;
* Inline function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#define Tk_AttachHWND \
+ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */
+#define Tk_GetHINSTANCE \
+ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */
+#define Tk_GetHWND \
+ (tkPlatStubsPtr->tk_GetHWND) /* 2 */
+#define Tk_HWNDToWindow \
+ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */
+#define Tk_PointerEvent \
+ (tkPlatStubsPtr->tk_PointerEvent) /* 4 */
+#define Tk_TranslateWinEvent \
+ (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
#define Tk_AttachHWND \
(tkPlatStubsPtr->tk_AttachHWND) /* 0 */
@@ -136,18 +170,18 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-#define Tk_MacOSXSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
-#define Tk_MacOSXTurnOffMenus \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */
-#define Tk_MacOSXTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */
-#define TkMacOSXInitMenus \
- (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */
-#define TkMacOSXInitAppleEvents \
- (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */
+#define Tk_AttachHWND \
+ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */
+#define Tk_GetHINSTANCE \
+ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */
+#define Tk_GetHWND \
+ (tkPlatStubsPtr->tk_GetHWND) /* 2 */
+#define Tk_HWNDToWindow \
+ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */
+#define Tk_PointerEvent \
+ (tkPlatStubsPtr->tk_PointerEvent) /* 4 */
+#define Tk_TranslateWinEvent \
+ (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#define TkMacOSXInvalClipRgns \
(tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */
#define TkMacOSXGetDrawablePort \
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 */
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index 64589be..0076e5d 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -114,22 +114,6 @@
#endif
/*
- * These macros are just wrappers for the equivalent X Region calls.
- */
-
-#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
-#define TkCreateRegion() (TkRegion) XCreateRegion()
-#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
-#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
- (Region) b, (Region) r)
-#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
-#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
-#define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
- (Region) b, (Region) r)
-#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
- (Region) src, (Region) ret)
-
-/*
* The TkPutImage macro strips off the color table information, which isn't
* needed for X.
*/