diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-25 13:30:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-25 13:30:03 (GMT) |
commit | 75d0d5da127d9d9b7fbc4b5989c6510eb950e402 (patch) | |
tree | 255663c368de4388994f1372fc8643165b175ddd /generic | |
parent | a0029792b685e19df1d79a8170579d88416055b0 (diff) | |
download | tk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.zip tk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.tar.gz tk-75d0d5da127d9d9b7fbc4b5989c6510eb950e402.tar.bz2 |
implement various internal win32 stub functions for cygwin
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 23 | ||||
-rw-r--r-- | generic/tkInt.decls | 22 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 294 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 52 | ||||
-rw-r--r-- | generic/tkStubInit.c | 145 | ||||
-rw-r--r-- | generic/tkWindow.c | 25 |
6 files changed, 159 insertions, 402 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index c024cdb..2fae0b8 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1026,7 +1026,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 68b8788..3453f88 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -403,26 +403,26 @@ declare 111 { declare 112 { void TkpMenuThreadInit(void) } -declare 113 {mac aqua win} { +declare 113 { void TkClipBox(TkRegion rgn, XRectangle *rect_return) } -declare 114 {mac aqua win} { +declare 114 { TkRegion TkCreateRegion(void) } -declare 115 {mac aqua win} { +declare 115 { void TkDestroyRegion(TkRegion rgn) } -declare 116 {mac aqua win} { +declare 116 { void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return) } -declare 117 {mac aqua win} { +declare 117 { int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width, unsigned int height) } -declare 118 {mac aqua win} { +declare 118 { void TkSetRegion(Display *display, GC gc, TkRegion rgn) } -declare 119 {mac aqua win} { +declare 119 { void TkUnionRectWithRegion(XRectangle *rect, TkRegion src, TkRegion dr_return) } @@ -468,7 +468,7 @@ declare 143 { declare 144 { void TkGCCleanup(TkDisplay *dispPtr) } -declare 145 {mac win aqua} { +declare 145 { void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return) } declare 146 { @@ -655,6 +655,9 @@ declare 33 win { declare 34 win { void TkWinSetHINSTANCE(HINSTANCE hInstance) } +declare 35 win { + int TkWinGetPlatformTheme(void) +} ################################ # Mac specific functions @@ -836,9 +839,6 @@ declare 65 mac { declare 66 mac { int TkpIsWindowFloating(WindowRef window) } -declare 35 win { - int TkWinGetPlatformTheme(void) -} ################################ # Aqua specific functions diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 3654621..23dcda4 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -362,108 +362,26 @@ EXTERN Tcl_Obj * TkpGetSystemDefault _ANSI_ARGS_((Tk_Window tkwin, CONST char *dbName, CONST char *className)); /* 112 */ EXTERN void TkpMenuThreadInit _ANSI_ARGS_((void)); -#ifdef __WIN32__ -/* 113 */ -EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn, - XRectangle *rect_return)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL -/* 113 */ -EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn, - XRectangle *rect_return)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK /* 113 */ EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn, XRectangle *rect_return)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -/* 114 */ -EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL -/* 114 */ -EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK /* 114 */ EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -/* 115 */ -EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL /* 115 */ EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -/* 115 */ -EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -/* 116 */ -EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra, - TkRegion srcb, TkRegion dr_return)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL /* 116 */ EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -/* 116 */ -EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra, - TkRegion srcb, TkRegion dr_return)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -/* 117 */ -EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x, - int y, unsigned int width, - unsigned int height)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL -/* 117 */ -EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x, - int y, unsigned int width, - unsigned int height)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK /* 117 */ EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -/* 118 */ -EXTERN void TkSetRegion _ANSI_ARGS_((Display *display, GC gc, - TkRegion rgn)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL /* 118 */ EXTERN void TkSetRegion _ANSI_ARGS_((Display *display, GC gc, TkRegion rgn)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -/* 118 */ -EXTERN void TkSetRegion _ANSI_ARGS_((Display *display, GC gc, - TkRegion rgn)); -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ /* 119 */ EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle *rect, TkRegion src, TkRegion dr_return)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL -/* 119 */ -EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle *rect, - TkRegion src, TkRegion dr_return)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -/* 119 */ -EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle *rect, - TkRegion src, TkRegion dr_return)); -#endif /* MAC_OSX_TK */ /* Slot 120 is reserved */ #ifdef MAC_TCL /* 121 */ @@ -531,21 +449,9 @@ EXTERN void TkFocusFree _ANSI_ARGS_((TkMainInfo *mainPtr)); EXTERN void TkClipCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); /* 144 */ EXTERN void TkGCCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); -#ifdef __WIN32__ -/* 145 */ -EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra, - TkRegion srcb, TkRegion dr_return)); -#endif /* __WIN32__ */ -#ifdef MAC_TCL -/* 145 */ -EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra, - TkRegion srcb, TkRegion dr_return)); -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK /* 145 */ EXTERN void TkSubtractRegion _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); -#endif /* MAC_OSX_TK */ /* 146 */ EXTERN void TkStylePkgInit _ANSI_ARGS_((TkMainInfo *mainPtr)); /* 147 */ @@ -680,90 +586,13 @@ typedef struct TkIntStubs { void (*tkpGetSubFonts) _ANSI_ARGS_((Tcl_Interp *interp, Tk_Font tkfont)); /* 110 */ Tcl_Obj * (*tkpGetSystemDefault) _ANSI_ARGS_((Tk_Window tkwin, CONST char *dbName, CONST char *className)); /* 111 */ void (*tkpMenuThreadInit) _ANSI_ARGS_((void)); /* 112 */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved113; -#endif /* UNIX */ -#ifdef __WIN32__ - void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle *rect_return)); /* 113 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle *rect_return)); /* 113 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK - void (*tkClipBox) _ANSI_ARGS_((TkRegion rgn, XRectangle *rect_return)); /* 113 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved114; -#endif /* UNIX */ -#ifdef __WIN32__ TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK - TkRegion (*tkCreateRegion) _ANSI_ARGS_((void)); /* 114 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved115; -#endif /* UNIX */ -#ifdef __WIN32__ void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK - void (*tkDestroyRegion) _ANSI_ARGS_((TkRegion rgn)); /* 115 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved116; -#endif /* UNIX */ -#ifdef __WIN32__ void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK - void (*tkIntersectRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 116 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved117; -#endif /* UNIX */ -#ifdef __WIN32__ - int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK int (*tkRectInRegion) _ANSI_ARGS_((TkRegion rgn, int x, int y, unsigned int width, unsigned int height)); /* 117 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved118; -#endif /* UNIX */ -#ifdef __WIN32__ - void (*tkSetRegion) _ANSI_ARGS_((Display *display, GC gc, TkRegion rgn)); /* 118 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - void (*tkSetRegion) _ANSI_ARGS_((Display *display, GC gc, TkRegion rgn)); /* 118 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK void (*tkSetRegion) _ANSI_ARGS_((Display *display, GC gc, TkRegion rgn)); /* 118 */ -#endif /* MAC_OSX_TK */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved119; -#endif /* UNIX */ -#ifdef __WIN32__ - void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle *rect, TkRegion src, TkRegion dr_return)); /* 119 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL - void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle *rect, TkRegion src, TkRegion dr_return)); /* 119 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK void (*tkUnionRectWithRegion) _ANSI_ARGS_((XRectangle *rect, TkRegion src, TkRegion dr_return)); /* 119 */ -#endif /* MAC_OSX_TK */ VOID *reserved120; #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ VOID *reserved121; @@ -822,18 +651,7 @@ typedef struct TkIntStubs { void (*tkFocusFree) _ANSI_ARGS_((TkMainInfo *mainPtr)); /* 142 */ void (*tkClipCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 143 */ void (*tkGCCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 144 */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - VOID *reserved145; -#endif /* UNIX */ -#ifdef __WIN32__ - void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */ -#endif /* __WIN32__ */ -#ifdef MAC_TCL void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */ -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK - void (*tkSubtractRegion) _ANSI_ARGS_((TkRegion sra, TkRegion srcb, TkRegion dr_return)); /* 145 */ -#endif /* MAC_OSX_TK */ void (*tkStylePkgInit) _ANSI_ARGS_((TkMainInfo *mainPtr)); /* 146 */ void (*tkStylePkgFree) _ANSI_ARGS_((TkMainInfo *mainPtr)); /* 147 */ Tk_Window (*tkToplevelWindowForCommand) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *cmdName)); /* 148 */ @@ -1306,132 +1124,34 @@ extern TkIntStubs *tkIntStubsPtr; #define TkpMenuThreadInit \ (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */ #endif -#ifdef __WIN32__ -#ifndef TkClipBox -#define TkClipBox \ - (tkIntStubsPtr->tkClipBox) /* 113 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL #ifndef TkClipBox #define TkClipBox \ (tkIntStubsPtr->tkClipBox) /* 113 */ #endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -#ifndef TkClipBox -#define TkClipBox \ - (tkIntStubsPtr->tkClipBox) /* 113 */ -#endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkCreateRegion -#define TkCreateRegion \ - (tkIntStubsPtr->tkCreateRegion) /* 114 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL -#ifndef TkCreateRegion -#define TkCreateRegion \ - (tkIntStubsPtr->tkCreateRegion) /* 114 */ -#endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK #ifndef TkCreateRegion #define TkCreateRegion \ (tkIntStubsPtr->tkCreateRegion) /* 114 */ #endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkDestroyRegion -#define TkDestroyRegion \ - (tkIntStubsPtr->tkDestroyRegion) /* 115 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL -#ifndef TkDestroyRegion -#define TkDestroyRegion \ - (tkIntStubsPtr->tkDestroyRegion) /* 115 */ -#endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK #ifndef TkDestroyRegion #define TkDestroyRegion \ (tkIntStubsPtr->tkDestroyRegion) /* 115 */ #endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkIntersectRegion -#define TkIntersectRegion \ - (tkIntStubsPtr->tkIntersectRegion) /* 116 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL -#ifndef TkIntersectRegion -#define TkIntersectRegion \ - (tkIntStubsPtr->tkIntersectRegion) /* 116 */ -#endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK #ifndef TkIntersectRegion #define TkIntersectRegion \ (tkIntStubsPtr->tkIntersectRegion) /* 116 */ #endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkRectInRegion -#define TkRectInRegion \ - (tkIntStubsPtr->tkRectInRegion) /* 117 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL -#ifndef TkRectInRegion -#define TkRectInRegion \ - (tkIntStubsPtr->tkRectInRegion) /* 117 */ -#endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK #ifndef TkRectInRegion #define TkRectInRegion \ (tkIntStubsPtr->tkRectInRegion) /* 117 */ #endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkSetRegion -#define TkSetRegion \ - (tkIntStubsPtr->tkSetRegion) /* 118 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL #ifndef TkSetRegion #define TkSetRegion \ (tkIntStubsPtr->tkSetRegion) /* 118 */ #endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -#ifndef TkSetRegion -#define TkSetRegion \ - (tkIntStubsPtr->tkSetRegion) /* 118 */ -#endif -#endif /* MAC_OSX_TK */ -#ifdef __WIN32__ -#ifndef TkUnionRectWithRegion -#define TkUnionRectWithRegion \ - (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ -#endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL #ifndef TkUnionRectWithRegion #define TkUnionRectWithRegion \ (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ #endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -#ifndef TkUnionRectWithRegion -#define TkUnionRectWithRegion \ - (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ -#endif -#endif /* MAC_OSX_TK */ /* Slot 120 is reserved */ #ifdef MAC_TCL #ifndef TkpCreateNativeBitmap @@ -1520,24 +1240,10 @@ extern TkIntStubs *tkIntStubsPtr; #define TkGCCleanup \ (tkIntStubsPtr->tkGCCleanup) /* 144 */ #endif -#ifdef __WIN32__ #ifndef TkSubtractRegion #define TkSubtractRegion \ (tkIntStubsPtr->tkSubtractRegion) /* 145 */ #endif -#endif /* __WIN32__ */ -#ifdef MAC_TCL -#ifndef TkSubtractRegion -#define TkSubtractRegion \ - (tkIntStubsPtr->tkSubtractRegion) /* 145 */ -#endif -#endif /* MAC_TCL */ -#ifdef MAC_OSX_TK -#ifndef TkSubtractRegion -#define TkSubtractRegion \ - (tkIntStubsPtr->tkSubtractRegion) /* 145 */ -#endif -#endif /* MAC_OSX_TK */ #ifndef TkStylePkgInit #define TkStylePkgInit \ (tkIntStubsPtr->tkStylePkgInit) /* 146 */ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index ecc5919..f9bce86 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -29,6 +29,24 @@ * Exported function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +/* 0 */ +EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, + VOID *hwnd)); +/* 1 */ +EXTERN VOID * Tk_GetHINSTANCE _ANSI_ARGS_((void)); +/* 2 */ +EXTERN VOID * Tk_GetHWND _ANSI_ARGS_((Window window)); +/* 3 */ +EXTERN Tk_Window Tk_HWNDToWindow _ANSI_ARGS_((VOID *hwnd)); +/* 4 */ +EXTERN void Tk_PointerEvent _ANSI_ARGS_((VOID *hwnd, int x, + int y)); +/* 5 */ +EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((VOID *hwnd, + unsigned int message, int wParam, int lParam, + int *result)); +#endif /* UNIX */ #ifdef __WIN32__ /* 0 */ EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, @@ -117,6 +135,14 @@ typedef struct TkPlatStubs { int magic; struct TkPlatStubHooks *hooks; +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ + Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, VOID *hwnd)); /* 0 */ + VOID * (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ + VOID * (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */ + Tk_Window (*tk_HWNDToWindow) _ANSI_ARGS_((VOID *hwnd)); /* 3 */ + void (*tk_PointerEvent) _ANSI_ARGS_((VOID *hwnd, int x, int y)); /* 4 */ + int (*tk_TranslateWinEvent) _ANSI_ARGS_((VOID *hwnd, unsigned int message, int wParam, int lParam, int *result)); /* 5 */ +#endif /* UNIX */ #ifdef __WIN32__ Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ @@ -167,6 +193,32 @@ extern TkPlatStubs *tkPlatStubsPtr; * Inline function declarations: */ +#if !defined(__WIN32__) && !defined(MAC_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__ #ifndef Tk_AttachHWND #define Tk_AttachHWND \ 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 */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index d3de72d..a04777f 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -101,6 +101,7 @@ static CONST XSetWindowAttributes defAtts= { #define ISSAFE 1 #define PASSMAINWINDOW 2 +#define WINMACONLY 4 typedef struct { CONST char *name; /* Name of command. */ @@ -135,9 +136,9 @@ static CONST TkCmd commands[] = { {"tkwait", NULL, Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, #if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK) {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, PASSMAINWINDOW}, - {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, PASSMAINWINDOW}, - {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, PASSMAINWINDOW}, - {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, PASSMAINWINDOW}, + {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, WINMACONLY|PASSMAINWINDOW}, + {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW}, + {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, WINMACONLY|PASSMAINWINDOW}, #endif #if defined(__WIN32__) || defined(MAC_OSX_TK) {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, PASSMAINWINDOW}, @@ -851,6 +852,9 @@ TkCreateMainWindow(interp, screenName, baseName) Tk_Window tkwin; int dummy; int isSafe; +#ifdef __WIN32__ + int isWin32 = 0; +#endif Tcl_HashEntry *hPtr; register TkMainInfo *mainPtr; register TkWindow *winPtr; @@ -858,7 +862,15 @@ TkCreateMainWindow(interp, screenName, baseName) ClientData clientData; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - +#ifdef __WIN32__ + Tcl_Obj *stringObjPtr = Tcl_GetVar2Ex(interp, "::tcl_platform", "platform", 0); + + if (stringObjPtr + && !strcmp(Tcl_GetString(stringObjPtr), "windows")) { + isWin32 = 1; + } +#endif + /* * Panic if someone updated the TkWindow structure without * also updating the Tk_FakeWin structure (or vice versa). @@ -941,6 +953,11 @@ TkCreateMainWindow(interp, screenName, baseName) if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } +#ifdef __WIN32__ + if (!isWin32 && (cmdPtr->flags & WINMACONLY)) { + continue; + } +#endif if (cmdPtr->flags & PASSMAINWINDOW) { clientData = (ClientData) tkwin; } else { |