diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-26 11:02:29 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-26 11:02:29 (GMT) |
commit | 6953f9dc57f63fe39701cd4e62ad03259e36c371 (patch) | |
tree | 083f2cf73199b4e7ae476283fdb3589d19566885 /generic | |
parent | bcc1d86678bcd77495a02ca7b58041f6c9ff3d1a (diff) | |
parent | df66b47acfd0644c7cda898c0c3c60d8e99dacd8 (diff) | |
download | tk-6953f9dc57f63fe39701cd4e62ad03259e36c371.zip tk-6953f9dc57f63fe39701cd4e62ad03259e36c371.tar.gz tk-6953f9dc57f63fe39701cd4e62ad03259e36c371.tar.bz2 |
[Bug 3508771]: Implement TkClipBox, Tk*Region and Tk_GetHINSTANCE for Cygwin
[Bug 3519917]: Snow Leopard unix/Makefile `make test` fail
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 23 | ||||
-rw-r--r-- | generic/tkInt.decls | 16 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 240 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 162 | ||||
-rw-r--r-- | generic/tkStubInit.c | 147 |
5 files changed, 234 insertions, 354 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index 65715c4..7960d0c 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1075,7 +1075,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 39b121c..63f34f5 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -405,26 +405,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) } @@ -470,7 +470,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 298c322..5fe8a56 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -666,110 +666,44 @@ EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin, /* 112 */ EXTERN void TkpMenuThreadInit(void); #endif -#ifdef __WIN32__ /* WIN */ #ifndef TkClipBox_TCL_DECLARED #define TkClipBox_TCL_DECLARED /* 113 */ EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return); #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkClipBox_TCL_DECLARED -#define TkClipBox_TCL_DECLARED -/* 113 */ -EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return); -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ -#ifndef TkCreateRegion_TCL_DECLARED -#define TkCreateRegion_TCL_DECLARED -/* 114 */ -EXTERN TkRegion TkCreateRegion(void); -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ #ifndef TkCreateRegion_TCL_DECLARED #define TkCreateRegion_TCL_DECLARED /* 114 */ EXTERN TkRegion TkCreateRegion(void); #endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ -#ifndef TkDestroyRegion_TCL_DECLARED -#define TkDestroyRegion_TCL_DECLARED -/* 115 */ -EXTERN void TkDestroyRegion(TkRegion rgn); -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ #ifndef TkDestroyRegion_TCL_DECLARED #define TkDestroyRegion_TCL_DECLARED /* 115 */ EXTERN void TkDestroyRegion(TkRegion rgn); #endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkIntersectRegion_TCL_DECLARED #define TkIntersectRegion_TCL_DECLARED /* 116 */ EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return); #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkIntersectRegion_TCL_DECLARED -#define TkIntersectRegion_TCL_DECLARED -/* 116 */ -EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb, - TkRegion dr_return); -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkRectInRegion_TCL_DECLARED #define TkRectInRegion_TCL_DECLARED /* 117 */ EXTERN int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width, unsigned int height); #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkRectInRegion_TCL_DECLARED -#define TkRectInRegion_TCL_DECLARED -/* 117 */ -EXTERN int TkRectInRegion(TkRegion rgn, int x, int y, - unsigned int width, unsigned int height); -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ -#ifndef TkSetRegion_TCL_DECLARED -#define TkSetRegion_TCL_DECLARED -/* 118 */ -EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn); -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ #ifndef TkSetRegion_TCL_DECLARED #define TkSetRegion_TCL_DECLARED /* 118 */ EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn); #endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ -#ifndef TkUnionRectWithRegion_TCL_DECLARED -#define TkUnionRectWithRegion_TCL_DECLARED -/* 119 */ -EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src, - TkRegion dr_return); -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ #ifndef TkUnionRectWithRegion_TCL_DECLARED #define TkUnionRectWithRegion_TCL_DECLARED /* 119 */ EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src, TkRegion dr_return); #endif -#endif /* AQUA */ /* Slot 120 is reserved */ #ifdef MAC_OSX_TK /* AQUA */ #ifndef TkpCreateNativeBitmap_TCL_DECLARED @@ -858,22 +792,12 @@ EXTERN void TkClipCleanup(TkDisplay *dispPtr); /* 144 */ EXTERN void TkGCCleanup(TkDisplay *dispPtr); #endif -#ifdef __WIN32__ /* WIN */ #ifndef TkSubtractRegion_TCL_DECLARED #define TkSubtractRegion_TCL_DECLARED /* 145 */ EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return); #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkSubtractRegion_TCL_DECLARED -#define TkSubtractRegion_TCL_DECLARED -/* 145 */ -EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb, - TkRegion dr_return); -#endif -#endif /* AQUA */ #ifndef TkStylePkgInit_TCL_DECLARED #define TkStylePkgInit_TCL_DECLARED /* 146 */ @@ -1156,76 +1080,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; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved113; /* 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; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ - TkRegion (*tkCreateRegion) (void); /* 114 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved114; /* Dummy entry for stubs table backwards compatibility */ TkRegion (*tkCreateRegion) (void); /* 114 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - VOID *reserved115; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ - void (*tkDestroyRegion) (TkRegion rgn); /* 115 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved115; /* Dummy entry for stubs table backwards compatibility */ void (*tkDestroyRegion) (TkRegion rgn); /* 115 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - VOID *reserved116; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved116; /* 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; -#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; /* 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; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ - void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved118; /* 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; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved119; /* Dummy entry for stubs table backwards compatibility */ - void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */ -#endif /* AQUA */ VOID *reserved120; #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ VOID *reserved121; @@ -1278,16 +1139,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; -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - VOID *reserved145; /* 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 */ @@ -1788,90 +1640,34 @@ extern TkIntStubs *tkIntStubsPtr; #define TkpMenuThreadInit \ (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */ #endif -#ifdef __WIN32__ /* WIN */ #ifndef TkClipBox #define TkClipBox \ (tkIntStubsPtr->tkClipBox) /* 113 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkClipBox -#define TkClipBox \ - (tkIntStubsPtr->tkClipBox) /* 113 */ -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkCreateRegion #define TkCreateRegion \ (tkIntStubsPtr->tkCreateRegion) /* 114 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkCreateRegion -#define TkCreateRegion \ - (tkIntStubsPtr->tkCreateRegion) /* 114 */ -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkDestroyRegion #define TkDestroyRegion \ (tkIntStubsPtr->tkDestroyRegion) /* 115 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkDestroyRegion -#define TkDestroyRegion \ - (tkIntStubsPtr->tkDestroyRegion) /* 115 */ -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkIntersectRegion #define TkIntersectRegion \ (tkIntStubsPtr->tkIntersectRegion) /* 116 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkIntersectRegion -#define TkIntersectRegion \ - (tkIntStubsPtr->tkIntersectRegion) /* 116 */ -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkRectInRegion #define TkRectInRegion \ (tkIntStubsPtr->tkRectInRegion) /* 117 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkRectInRegion -#define TkRectInRegion \ - (tkIntStubsPtr->tkRectInRegion) /* 117 */ -#endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ -#ifndef TkSetRegion -#define TkSetRegion \ - (tkIntStubsPtr->tkSetRegion) /* 118 */ -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ #ifndef TkSetRegion #define TkSetRegion \ (tkIntStubsPtr->tkSetRegion) /* 118 */ #endif -#endif /* AQUA */ -#ifdef __WIN32__ /* WIN */ #ifndef TkUnionRectWithRegion #define TkUnionRectWithRegion \ (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkUnionRectWithRegion -#define TkUnionRectWithRegion \ - (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ -#endif -#endif /* AQUA */ /* Slot 120 is reserved */ #ifdef MAC_OSX_TK /* AQUA */ #ifndef TkpCreateNativeBitmap @@ -1942,18 +1738,10 @@ extern TkIntStubs *tkIntStubsPtr; #define TkGCCleanup \ (tkIntStubsPtr->tkGCCleanup) /* 144 */ #endif -#ifdef __WIN32__ /* WIN */ #ifndef TkSubtractRegion #define TkSubtractRegion \ (tkIntStubsPtr->tkSubtractRegion) /* 145 */ #endif -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -#ifndef TkSubtractRegion -#define TkSubtractRegion \ - (tkIntStubsPtr->tkSubtractRegion) /* 145 */ -#endif -#endif /* AQUA */ #ifndef TkStylePkgInit #define TkStylePkgInit \ (tkIntStubsPtr->tkStylePkgInit) /* 146 */ @@ -2066,5 +1854,33 @@ extern 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 5b386ee..c7584c7 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -29,6 +29,40 @@ * Exported function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#ifndef Tk_AttachHWND_TCL_DECLARED +#define Tk_AttachHWND_TCL_DECLARED +/* 0 */ +EXTERN Window Tk_AttachHWND(Tk_Window tkwin, VOID *hwnd); +#endif +#ifndef Tk_GetHINSTANCE_TCL_DECLARED +#define Tk_GetHINSTANCE_TCL_DECLARED +/* 1 */ +EXTERN VOID * Tk_GetHINSTANCE(void); +#endif +#ifndef Tk_GetHWND_TCL_DECLARED +#define Tk_GetHWND_TCL_DECLARED +/* 2 */ +EXTERN VOID * Tk_GetHWND(Window window); +#endif +#ifndef Tk_HWNDToWindow_TCL_DECLARED +#define Tk_HWNDToWindow_TCL_DECLARED +/* 3 */ +EXTERN Tk_Window Tk_HWNDToWindow(VOID *hwnd); +#endif +#ifndef Tk_PointerEvent_TCL_DECLARED +#define Tk_PointerEvent_TCL_DECLARED +/* 4 */ +EXTERN void Tk_PointerEvent(VOID *hwnd, int x, int y); +#endif +#ifndef Tk_TranslateWinEvent_TCL_DECLARED +#define Tk_TranslateWinEvent_TCL_DECLARED +/* 5 */ +EXTERN int Tk_TranslateWinEvent(VOID *hwnd, + unsigned int message, int wParam, int lParam, + int *result); +#endif +#endif /* UNIX */ #ifdef __WIN32__ /* WIN */ #ifndef Tk_AttachHWND_TCL_DECLARED #define Tk_AttachHWND_TCL_DECLARED @@ -64,41 +98,37 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message, #endif #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ -#ifndef Tk_MacOSXSetEmbedHandler_TCL_DECLARED -#define Tk_MacOSXSetEmbedHandler_TCL_DECLARED +#ifndef Tk_AttachHWND_TCL_DECLARED +#define Tk_AttachHWND_TCL_DECLARED /* 0 */ -EXTERN void Tk_MacOSXSetEmbedHandler( - Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, - Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, - Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, - Tk_MacOSXEmbedGetClipProc *getClipProc, - Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); -#endif -#ifndef Tk_MacOSXTurnOffMenus_TCL_DECLARED -#define Tk_MacOSXTurnOffMenus_TCL_DECLARED +EXTERN Window Tk_AttachHWND(Tk_Window tkwin, VOID *hwnd); +#endif +#ifndef Tk_GetHINSTANCE_TCL_DECLARED +#define Tk_GetHINSTANCE_TCL_DECLARED /* 1 */ -EXTERN void Tk_MacOSXTurnOffMenus(void); +EXTERN VOID * Tk_GetHINSTANCE(void); #endif -#ifndef Tk_MacOSXTkOwnsCursor_TCL_DECLARED -#define Tk_MacOSXTkOwnsCursor_TCL_DECLARED +#ifndef Tk_GetHWND_TCL_DECLARED +#define Tk_GetHWND_TCL_DECLARED /* 2 */ -EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt); +EXTERN VOID * Tk_GetHWND(Window window); #endif -#ifndef TkMacOSXInitMenus_TCL_DECLARED -#define TkMacOSXInitMenus_TCL_DECLARED +#ifndef Tk_HWNDToWindow_TCL_DECLARED +#define Tk_HWNDToWindow_TCL_DECLARED /* 3 */ -EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp); +EXTERN Tk_Window Tk_HWNDToWindow(VOID *hwnd); #endif -#ifndef TkMacOSXInitAppleEvents_TCL_DECLARED -#define TkMacOSXInitAppleEvents_TCL_DECLARED +#ifndef Tk_PointerEvent_TCL_DECLARED +#define Tk_PointerEvent_TCL_DECLARED /* 4 */ -EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp); +EXTERN void Tk_PointerEvent(VOID *hwnd, int x, int y); #endif -#ifndef TkGenWMConfigureEvent_TCL_DECLARED -#define TkGenWMConfigureEvent_TCL_DECLARED +#ifndef Tk_TranslateWinEvent_TCL_DECLARED +#define Tk_TranslateWinEvent_TCL_DECLARED /* 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); #endif #ifndef TkMacOSXInvalClipRgns_TCL_DECLARED #define TkMacOSXInvalClipRgns_TCL_DECLARED @@ -131,6 +161,14 @@ typedef struct TkPlatStubs { int magic; 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 */ @@ -140,12 +178,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 */ GWorldPtr (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */ ControlRef (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ @@ -168,6 +206,32 @@ extern TkPlatStubs *tkPlatStubsPtr; * Inline function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#ifndef Tk_AttachHWND +#define Tk_AttachHWND \ + (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ +#endif +#ifndef Tk_GetHINSTANCE +#define Tk_GetHINSTANCE \ + (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ +#endif +#ifndef Tk_GetHWND +#define Tk_GetHWND \ + (tkPlatStubsPtr->tk_GetHWND) /* 2 */ +#endif +#ifndef Tk_HWNDToWindow +#define Tk_HWNDToWindow \ + (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ +#endif +#ifndef Tk_PointerEvent +#define Tk_PointerEvent \ + (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ +#endif +#ifndef Tk_TranslateWinEvent +#define Tk_TranslateWinEvent \ + (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ +#endif +#endif /* UNIX */ #ifdef __WIN32__ /* WIN */ #ifndef Tk_AttachHWND #define Tk_AttachHWND \ @@ -195,29 +259,29 @@ extern TkPlatStubs *tkPlatStubsPtr; #endif #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ -#ifndef Tk_MacOSXSetEmbedHandler -#define Tk_MacOSXSetEmbedHandler \ - (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */ +#ifndef Tk_AttachHWND +#define Tk_AttachHWND \ + (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #endif -#ifndef Tk_MacOSXTurnOffMenus -#define Tk_MacOSXTurnOffMenus \ - (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */ +#ifndef Tk_GetHINSTANCE +#define Tk_GetHINSTANCE \ + (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ #endif -#ifndef Tk_MacOSXTkOwnsCursor -#define Tk_MacOSXTkOwnsCursor \ - (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */ +#ifndef Tk_GetHWND +#define Tk_GetHWND \ + (tkPlatStubsPtr->tk_GetHWND) /* 2 */ #endif -#ifndef TkMacOSXInitMenus -#define TkMacOSXInitMenus \ - (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */ +#ifndef Tk_HWNDToWindow +#define Tk_HWNDToWindow \ + (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ #endif -#ifndef TkMacOSXInitAppleEvents -#define TkMacOSXInitAppleEvents \ - (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */ +#ifndef Tk_PointerEvent +#define Tk_PointerEvent \ + (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ #endif -#ifndef TkGenWMConfigureEvent -#define TkGenWMConfigureEvent \ - (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */ +#ifndef Tk_TranslateWinEvent +#define Tk_TranslateWinEvent \ + (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ #endif #ifndef TkMacOSXInvalClipRgns #define TkMacOSXInvalClipRgns \ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 170ada7..4762b12 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -34,22 +34,65 @@ * Remove macros that will interfere with the definitions below. */ -#define Tk_CreateCanvasVisitor \ - ((void (*)(Tcl_Interp * interp, VOID * typePtr)) NULL) -#define Tk_GetCanvasVisitor \ - ((VOID * (*)(Tcl_Interp * interp, CONST char * name)) NULL) - MODULE_SCOPE TkIntStubs tkIntStubs; MODULE_SCOPE TkIntPlatStubs tkIntPlatStubs; MODULE_SCOPE TkIntXlibStubs tkIntXlibStubs; MODULE_SCOPE TkPlatStubs tkPlatStubs; MODULE_SCOPE TkStubs tkStubs; +#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 *); + +#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 @@ -175,76 +218,13 @@ TkIntStubs tkIntStubs = { TkpGetSubFonts, /* 110 */ TkpGetSystemDefault, /* 111 */ TkpMenuThreadInit, /* 112 */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 113 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ - TkClipBox, /* 113 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 113 */ /* Dummy entry for stubs table backwards compatibility */ TkClipBox, /* 113 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 114 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkCreateRegion, /* 114 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 114 */ /* Dummy entry for stubs table backwards compatibility */ - TkCreateRegion, /* 114 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 115 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkDestroyRegion, /* 115 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 115 */ /* Dummy entry for stubs table backwards compatibility */ - TkDestroyRegion, /* 115 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 116 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkIntersectRegion, /* 116 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 116 */ /* Dummy entry for stubs table backwards compatibility */ - TkIntersectRegion, /* 116 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 117 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkRectInRegion, /* 117 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 117 */ /* Dummy entry for stubs table backwards compatibility */ - TkRectInRegion, /* 117 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 118 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkSetRegion, /* 118 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 118 */ /* Dummy entry for stubs table backwards compatibility */ - TkSetRegion, /* 118 */ -#endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 119 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ TkUnionRectWithRegion, /* 119 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 119 */ /* Dummy entry for stubs table backwards compatibility */ - TkUnionRectWithRegion, /* 119 */ -#endif /* AQUA */ NULL, /* 120 */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ NULL, /* 121 */ @@ -297,16 +277,7 @@ TkIntStubs tkIntStubs = { TkFocusFree, /* 142 */ TkClipCleanup, /* 143 */ TkGCCleanup, /* 144 */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ - NULL, /* 145 */ -#endif /* X11 */ -#ifdef __WIN32__ /* WIN */ - TkSubtractRegion, /* 145 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - NULL, /* 145 */ /* Dummy entry for stubs table backwards compatibility */ TkSubtractRegion, /* 145 */ -#endif /* AQUA */ TkStylePkgInit, /* 146 */ TkStylePkgFree, /* 147 */ TkToplevelWindowForCommand, /* 148 */ @@ -671,6 +642,14 @@ TkIntXlibStubs tkIntXlibStubs = { TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, NULL, +#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 */ @@ -680,12 +659,12 @@ 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 */ |