diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-26 06:07:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-26 06:07:25 (GMT) |
commit | e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262 (patch) | |
tree | 5c662f5e1b8c73c18c27fbcf410c1faf0d43297e /generic | |
parent | 1781ae2223312ebc0d57a9861834a2be6904b53b (diff) | |
parent | 6092901c18b64a83b6d7ccb7e4c63679afb801b1 (diff) | |
download | tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.zip tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.tar.gz tk-e4f1d0b0e561cd967dc477cc6d7c843e2a5bf262.tar.bz2 |
implement TkSetPixmapColormap and TkpPrintWindowId for cygwin.
cleanup some more unused CYGWIN stuff .
Change XSetCommand signature to match Xorg, needed for Cygwin
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 25 | ||||
-rw-r--r-- | generic/tkGrab.c | 4 | ||||
-rw-r--r-- | generic/tkImgPhoto.h | 2 | ||||
-rw-r--r-- | generic/tkInt.decls | 49 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 8 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 63 | ||||
-rw-r--r-- | generic/tkIntXlibDecls.h | 11 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 100 | ||||
-rw-r--r-- | generic/tkStubInit.c | 260 | ||||
-rw-r--r-- | generic/tkWindow.c | 18 |
10 files changed, 342 insertions, 198 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index 897d84a..e54b804 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1086,31 +1086,6 @@ declare 275 { interface tkPlat ################################ -# Unix specific functions -# - -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 declare 0 win { diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 835beac..695690b 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -12,7 +12,9 @@ #include "tkInt.h" -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#ifdef __WIN32__ +#include "tkWinInt.h" +#elif !(defined(__WIN32__) || defined(MAC_OSX_TK)) #include "tkUnixInt.h" #endif diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 7f338ab..7bef76b 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -19,6 +19,8 @@ #include "tkInt.h" #ifdef __WIN32__ #include "tkWinInt.h" +#elif defined(__CYGWIN__) +#include "tkUnixInt.h" #endif /* diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 2d67616..7e33de4 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -275,6 +275,9 @@ declare 74 { declare 75 { int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string) } +# +# Slot 76 unused (WAS: TkpWindowWasRecentlyDeleted) +# declare 77 { void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr) } @@ -429,7 +432,7 @@ declare 122 aqua { } declare 124 aqua { Pixmap TkpGetNativeAppBitmap(Display *display, - const char *name, int *width, int *height) + const char *name, int *width, int *height) } declare 135 { void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, @@ -645,6 +648,10 @@ interface tkIntPlat declare 0 x11 { void TkCreateXEventSource(void) } +# +# Slot 1 unused (WAS: TkFreeWindowId) +# Slot 2 unused (WAS: TkInitXId) +# declare 3 x11 { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } @@ -669,6 +676,9 @@ declare 9 x11 { declare 10 x11 { void TkSendCleanup(TkDisplay *dispPtr) } +# +# Slot 11 unused (WAS: TkFreeXId) +# declare 12 x11 { int TkpWmSetState(TkWindow *winPtr, int state) } @@ -797,13 +807,44 @@ declare 35 win { int TkWinGetPlatformTheme(void) } -# Exported through stub table since Tk 8.5.9 +# Exported through stub table since Tk 8.4.20/8.5.9 declare 36 win { - LRESULT CALLBACK TkWinChildProc(HWND hwnd, + LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } +# new for 8.4.20+, Cygwin only +declare 37 win { + void TkCreateXEventSource(void) +} +declare 38 win { + int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) +} +declare 39 win { + void TkpSync(Display *display) +} +declare 40 win { + Window TkUnixContainerId(TkWindow *winPtr) +} +declare 41 win { + int TkUnixDoOneXEvent(Tcl_Time *timePtr) +} +declare 42 win { + void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) +} +declare 43 win { + void TkWmCleanup(TkDisplay *dispPtr) +} +declare 44 win { + void TkSendCleanup(TkDisplay *dispPtr) +} +# only needed by tktest: +declare 45 win { + int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int argc, + const char **argv) +} + ################################ # Aqua specific functions @@ -1213,7 +1254,7 @@ declare 61 win { Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) } declare 62 win { - void XSetCommand(Display *d, Window w, const char **c, int i) + void XSetCommand(Display *d, Window w, char **c, int i) } declare 63 win { void XSetIconName(Display *d, Window w, _Xconst char *c) diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index d50f07c..8d36ec0 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -675,7 +675,7 @@ typedef struct TkIntStubs { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved121)(void); #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ void (*reserved121)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -685,7 +685,7 @@ typedef struct TkIntStubs { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved122)(void); #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ void (*reserved122)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -696,7 +696,7 @@ typedef struct TkIntStubs { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved124)(void); #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ void (*reserved124)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -1148,7 +1148,7 @@ extern const TkIntStubs *tkIntStubsPtr; /* * On X11, these macros are just wrappers for the equivalent X Region calls. */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #undef TkClipBox #undef TkCreateRegion diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 9ad8a4f..b940db9 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -30,7 +30,7 @@ * Exported function declarations: */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN char * TkAlignImageData(XImage *image, int alignment, int bitOrder); @@ -116,8 +116,28 @@ EXTERN void TkWinSetHINSTANCE(HINSTANCE hInstance); /* 35 */ EXTERN int TkWinGetPlatformTheme(void); /* 36 */ -EXTERN LRESULT CALLBACK TkWinChildProc(HWND hwnd, UINT message, +EXTERN LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +/* 37 */ +EXTERN void TkCreateXEventSource(void); +/* 38 */ +EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); +/* 39 */ +EXTERN void TkpSync(Display *display); +/* 40 */ +EXTERN Window TkUnixContainerId(TkWindow *winPtr); +/* 41 */ +EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); +/* 42 */ +EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); +/* 43 */ +EXTERN void TkWmCleanup(TkDisplay *dispPtr); +/* 44 */ +EXTERN void TkSendCleanup(TkDisplay *dispPtr); +/* 45 */ +EXTERN int TkpTestsendCmd(ClientData clientData, + Tcl_Interp *interp, int argc, + const char **argv); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ @@ -230,7 +250,7 @@ EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); /* 53 */ EXTERN unsigned long TkpGetMS(void); #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource(void); /* Slot 1 is reserved */ @@ -265,7 +285,7 @@ typedef struct TkIntPlatStubs { int magic; const struct TkIntPlatStubHooks *hooks; -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ @@ -302,7 +322,16 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformId) (void); /* 33 */ void (*tkWinSetHINSTANCE) (HINSTANCE hInstance); /* 34 */ int (*tkWinGetPlatformTheme) (void); /* 35 */ - LRESULT (CALLBACK *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ + LRESULT (__stdcall *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ + void (*tkCreateXEventSource) (void); /* 37 */ + int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 38 */ + void (*tkpSync) (Display *display); /* 39 */ + Window (*tkUnixContainerId) (TkWindow *winPtr); /* 40 */ + int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 41 */ + void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ + void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ + void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ + int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); /* 45 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */ @@ -360,7 +389,7 @@ typedef struct TkIntPlatStubs { void (*reserved52)(void); unsigned long (*tkpGetMS) (void); /* 53 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*reserved2)(void); @@ -392,7 +421,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; * Inline function declarations: */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ /* Slot 1 is reserved */ @@ -466,6 +495,24 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ #define TkWinChildProc \ (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ +#define TkCreateXEventSource \ + (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */ +#define TkpCmapStressed \ + (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ +#define TkpSync \ + (tkIntPlatStubsPtr->tkpSync) /* 39 */ +#define TkUnixContainerId \ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ +#define TkUnixDoOneXEvent \ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ +#define TkUnixSetMenubar \ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ +#define TkWmCleanup \ + (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ +#define TkSendCleanup \ + (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ +#define TkpTestsendCmd \ + (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define TkGenerateActivateEvents \ @@ -569,7 +616,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; #define TkpGetMS \ (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ /* Slot 1 is reserved */ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index c816779..a55ee53 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -36,7 +36,7 @@ * Exported function declarations: */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ /* 0 */ EXTERN void XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); @@ -211,8 +211,7 @@ EXTERN void XSelectInput(Display *d, Window w, long l); EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x); /* 62 */ -EXTERN void XSetCommand(Display *d, Window w, const char **c, - int i); +EXTERN void XSetCommand(Display *d, Window w, char **c, int i); /* 63 */ EXTERN void XSetIconName(Display *d, Window w, _Xconst char *c); /* 64 */ @@ -603,7 +602,7 @@ typedef struct TkIntXlibStubs { int magic; const struct TkIntXlibStubHooks *hooks; -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ void (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ @@ -666,7 +665,7 @@ typedef struct TkIntXlibStubs { void (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 59 */ void (*xSelectInput) (Display *d, Window w, long l); /* 60 */ Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 61 */ - void (*xSetCommand) (Display *d, Window w, const char **c, int i); /* 62 */ + void (*xSetCommand) (Display *d, Window w, char **c, int i); /* 62 */ void (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 63 */ void (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 64 */ void (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 65 */ @@ -822,7 +821,7 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; * Inline function declarations: */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ #define XSetDashes \ (tkIntXlibStubsPtr->xSetDashes) /* 0 */ #define XGetModifierMapping \ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 74f4ccd..057d38c 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -33,23 +33,7 @@ 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 */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd); /* 1 */ @@ -67,19 +51,23 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message, #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ -EXTERN Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd); +EXTERN void Tk_MacOSXSetEmbedHandler( + Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, + Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, + Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, + Tk_MacOSXEmbedGetClipProc *getClipProc, + Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 1 */ -EXTERN void * Tk_GetHINSTANCE(void); +EXTERN void Tk_MacOSXTurnOffMenus(void); /* 2 */ -EXTERN void * Tk_GetHWND(Window window); +EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt); /* 3 */ -EXTERN Tk_Window Tk_HWNDToWindow(void *hwnd); +EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp); /* 4 */ -EXTERN void Tk_PointerEvent(void *hwnd, int x, int y); +EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp); /* 5 */ -EXTERN int Tk_TranslateWinEvent(void *hwnd, - unsigned int message, int wParam, int lParam, - int *result); +EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, + int width, int height, int flags); /* 6 */ EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin); /* 7 */ @@ -96,15 +84,7 @@ 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 */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */ HWND (*tk_GetHWND) (Window window); /* 2 */ @@ -113,12 +93,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 */ - 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 (*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 */ void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */ void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */ void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ @@ -141,21 +121,7 @@ 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 */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #define Tk_GetHINSTANCE \ @@ -170,18 +136,18 @@ extern const TkPlatStubs *tkPlatStubsPtr; (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ -#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 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 TkMacOSXInvalClipRgns \ (tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */ #define TkMacOSXGetDrawablePort \ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index e19180f..6ba0bda 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,12 +30,6 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" -/* - * WARNING: The contents of this file is automatically generated by the - * tools/genStubs.tcl script. Any modifications to the function declarations - * below should be made in the generic/tk.decls script. - */ - static const TkIntStubs tkIntStubs; /* @@ -44,50 +38,46 @@ static const TkIntStubs tkIntStubs; #undef Tk_MainEx -#undef TkClipBox -#undef TkCreateRegion -#undef TkDestroyRegion -#undef TkIntersectRegion -#undef TkRectInRegion -#undef TkSetRegion -#undef TkUnionRectWithRegion -#undef TkSubtractRegion -#undef TkPutImage - -#ifndef __WIN32__ +#ifdef __WIN32__ + +int +TkpCmapStressed(Tk_Window tkwin, Colormap colormap) +{ + /* dummy implementation, no need to do anything */ + return 0; +} +void +TkpSync(Display *display) +{ + /* dummy implementation, no need to do anything */ +} + +# define TkCreateXEventSource (void (*) (void)) TkpSync +# define TkUnixContainerId 0 +# define TkUnixDoOneXEvent 0 +# define TkUnixSetMenubar 0 +# define TkWmCleanup (void (*) (TkDisplay *)) TkpSync +# define TkSendCleanup (void (*) (TkDisplay *)) TkpSync +# define TkpTestsendCmd 0 + +#else + /* * Make sure that extensions which call XParseColor through the stub * table, call TkParseColor instead. [Bug 3486474] */ # define XParseColor TkParseColor -# ifndef __CYGWIN__ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 -# define Tk_GetHINSTANCE 0 -# endif -# if !defined(MAC_TCL) && !defined(MAC_OSX_TCL) -# 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__ -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +# ifdef __CYGWIN__ + +# define Tk_GetHINSTANCE TkPlatGetHINSTANCE /* * Trick, so we don't have to include <windows.h> here, which in any * case lacks this function anyway. */ +#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); static void *Tk_GetHINSTANCE() @@ -98,19 +88,148 @@ static void *Tk_GetHINSTANCE() (const char *) &tkIntStubs, &hInstance); return hInstance; } - /* TODO: To be implemented for Cygwin */ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 - -# else /* !__CYGWIN__ */ -# define TkPutImage 0 -# endif /* __CYGWIN__ */ -# endif /* !MAC_TCL && !MACC_OSX_TCL */ + +void +TkSetPixmapColormap( + Pixmap pixmap, + Colormap colormap) +{ +} + +void +TkpPrintWindowId( + char *buf, /* Pointer to string large enough to hold + * the hex representation of a pointer. */ + Window window) /* Window to be printed into buffer. */ +{ + sprintf(buf, "%#08lx", (unsigned long) (window)); +} + +void +TkPutImage( + unsigned long *colors, /* Array of pixel values used by this image. + * May be NULL. */ + int ncolors, /* Number of colors used, or 0. */ + Display *display, + Drawable d, /* Destination drawable. */ + GC gc, + XImage *image, /* Source image. */ + int src_x, int src_y, /* Offset of subimage. */ + int dest_x, int dest_y, /* Position of subimage origin in drawable. */ + unsigned int width, unsigned int height) + /* Dimensions of subimage. */ +{ + XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height); +} + +TkRegion TkCreateRegion() +{ + return (TkRegion) XCreateRegion(); +} + +void TkDestroyRegion(TkRegion r) +{ + XDestroyRegion((Region)r); +} + +void TkSetRegion(Display *d, GC g, TkRegion r) +{ + XSetRegion(d, g, (Region)r); +} + +void TkUnionRectWithRegion(XRectangle *a, TkRegion b, TkRegion c) +{ + XUnionRectWithRegion(a, (Region) b, (Region) c); +} + +void TkClipBox(TkRegion a, XRectangle *b) +{ + XClipBox((Region) a, b); +} + +void TkIntersectRegion(TkRegion a, TkRegion b, TkRegion c) +{ + XIntersectRegion((Region) a, (Region) b, (Region) c); +} + +int TkRectInRegion (TkRegion r, int a, int b, unsigned int c, unsigned int d) +{ + return XRectInRegion((Region) r, a, b, c, d); +} + +void TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c) +{ + XSubtractRegion((Region) a, (Region) b, (Region) c); +} + + /* TODO: To be implemented for Cygwin */ +# define Tk_AttachHWND 0 +# define Tk_GetHWND 0 +# define Tk_HWNDToWindow 0 +# define Tk_PointerEvent 0 +# define Tk_TranslateWinEvent 0 +# define TkAlignImageData 0 +# define TkGenerateActivateEvents 0 +# define TkpGetMS 0 +# define TkPointerDeadWindow 0 +# define TkpSetCapture 0 +# define TkpSetCursor 0 +# define TkWinCancelMouseTimer 0 +# define TkWinClipboardRender 0 +# define TkWinEmbeddedEventProc 0 +# define TkWinFillRect 0 +# define TkWinGetBorderPixels 0 +# define TkWinGetDrawableDC 0 +# define TkWinGetModifierState 0 +# define TkWinGetSystemPalette 0 +# define TkWinGetWrapperWindow 0 +# define TkWinHandleMenuEvent 0 +# define TkWinIndexOfColor 0 +# define TkWinReleaseDrawableDC 0 +# define TkWinResendEvent 0 +# define TkWinSelectPalette 0 +# define TkWinSetMenu 0 +# define TkWinSetWindowPos 0 +# define TkWinWmCleanup 0 +# define TkWinXCleanup 0 +# define TkWinXInit 0 +# define TkWinSetForegroundWindow 0 +# define TkWinDialogDebug 0 +# define TkWinGetMenuSystemDefault 0 +# define TkWinGetPlatformId 0 +# define TkWinSetHINSTANCE 0 +# define TkWinGetPlatformTheme 0 +# define TkWinChildProc 0 + +#elif !defined(MAC_OSC_TK) /* UNIX */ + +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion + +# 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 + +# endif #endif /* !__WIN32__ */ +/* + * WARNING: The contents of this file is automatically generated by the + * tools/genStubs.tcl script. Any modifications to the function declarations + * below should be made in the generic/tk.decls script. + */ + /* !BEGIN!: Do not edit below this line. */ static const TkIntStubs tkIntStubs = { @@ -240,7 +359,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 121 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 121 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -250,7 +369,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 122 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 122 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -261,7 +380,7 @@ static const TkIntStubs tkIntStubs = { #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 124 */ #endif /* X11 */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ 0, /* 124 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -333,7 +452,7 @@ static const TkIntStubs tkIntStubs = { static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -371,6 +490,15 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ + TkCreateXEventSource, /* 37 */ + TkpCmapStressed, /* 38 */ + TkpSync, /* 39 */ + TkUnixContainerId, /* 40 */ + TkUnixDoOneXEvent, /* 41 */ + TkUnixSetMenubar, /* 42 */ + TkWmCleanup, /* 43 */ + TkSendCleanup, /* 44 */ + TkpTestsendCmd, /* 45 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ TkGenerateActivateEvents, /* 0 */ @@ -428,7 +556,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { 0, /* 52 */ TkpGetMS, /* 53 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -449,7 +577,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { static const TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, 0, -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -657,15 +785,7 @@ 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 */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ @@ -674,12 +794,12 @@ static const TkPlatStubs tkPlatStubs = { Tk_TranslateWinEvent, /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - Tk_AttachHWND, /* 0 */ - Tk_GetHINSTANCE, /* 1 */ - Tk_GetHWND, /* 2 */ - Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ + Tk_MacOSXSetEmbedHandler, /* 0 */ + Tk_MacOSXTurnOffMenus, /* 1 */ + Tk_MacOSXTkOwnsCursor, /* 2 */ + TkMacOSXInitMenus, /* 3 */ + TkMacOSXInitAppleEvents, /* 4 */ + TkGenWMConfigureEvent, /* 5 */ TkMacOSXInvalClipRgns, /* 6 */ TkMacOSXGetDrawablePort, /* 7 */ TkMacOSXGetRootControl, /* 8 */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 278c8bc..b2c5310 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -14,7 +14,9 @@ #include "tkInt.h" -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#ifdef __WIN32__ +#include "tkWinInt.h" +#elif !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) #include "tkUnixInt.h" #endif @@ -859,9 +861,6 @@ TkCreateMainWindow( { Tk_Window tkwin; int dummy, isSafe; -#if defined(__WIN32__) && !defined(STATIC_BUILD) - int isWin32 = 0; -#endif Tcl_HashEntry *hPtr; register TkMainInfo *mainPtr; register TkWindow *winPtr; @@ -869,14 +868,6 @@ TkCreateMainWindow( ClientData clientData; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); -#if defined(__WIN32__) && !defined(STATIC_BUILD) - 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 @@ -962,7 +953,8 @@ TkCreateMainWindow( Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } #if defined(__WIN32__) && !defined(STATIC_BUILD) - if (!isWin32 && (cmdPtr->flags & WINMACONLY)) { + if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->reserved9) { + /* We are running on Cygwin, so don't use the win32 dialogs */ continue; } #endif |