diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-16 13:31:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-16 13:31:48 (GMT) |
commit | 31f8fd62815ade2416fca697fea79938ab61d230 (patch) | |
tree | 34f7f531464329534828bc183ab4079b2de3a103 | |
parent | 1781ae2223312ebc0d57a9861834a2be6904b53b (diff) | |
parent | c29a2d58d9c3de29bcd7e88011aea2b9c1bcd92e (diff) | |
download | tk-31f8fd62815ade2416fca697fea79938ab61d230.zip tk-31f8fd62815ade2416fca697fea79938ab61d230.tar.gz tk-31f8fd62815ade2416fca697fea79938ab61d230.tar.bz2 |
implement TkSetPixmapColormap and TkpPrintWindowId for cygwin
cleanup some more unused CYGWIN stuff
-rw-r--r-- | carbon/tkMacOSXPort.h | 2 | ||||
-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 | 47 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 2 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 63 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 100 | ||||
-rw-r--r-- | generic/tkStubInit.c | 240 | ||||
-rw-r--r-- | generic/tkWindow.c | 18 | ||||
-rw-r--r-- | macosx/tkMacOSXPort.h | 2 | ||||
-rw-r--r-- | unix/Makefile.in | 5 | ||||
-rw-r--r-- | unix/tkUnixPort.h | 24 | ||||
-rw-r--r-- | win/tkWinPort.h | 21 | ||||
-rw-r--r-- | win/winMain.c | 2 |
15 files changed, 342 insertions, 215 deletions
diff --git a/carbon/tkMacOSXPort.h b/carbon/tkMacOSXPort.h index b5bfcde..41da041 100644 --- a/carbon/tkMacOSXPort.h +++ b/carbon/tkMacOSXPort.h @@ -112,7 +112,7 @@ */ #define XFlush(display) -#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));} +#define XFree(data) {if ((data) != NULL) ckfree(data);} #define XGrabServer(display) #define XNoOp(display) {display->request++;} #define XUngrabServer(display) 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..5cc8e7a 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 diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index d50f07c..75954c2 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -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/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..499dfd4 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,57 @@ 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 +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion +# undef TkSetPixmapColormap +# undef TkpPrintWindowId +# undef TkWinChildProc + /* * 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 +99,127 @@ 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 + +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 # endif /* __CYGWIN__ */ -# 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 + * below should be made in the generic/tk.decls script. + */ + /* !BEGIN!: Do not edit below this line. */ static const TkIntStubs tkIntStubs = { @@ -333,7 +442,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 +480,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 +546,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 */ @@ -657,15 +775,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 +784,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 diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index b457711..1576ec7 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -112,7 +112,7 @@ */ #define XFlush(display) -#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));} +#define XFree(data) {if ((data) != NULL) ckfree(data);} #define XGrabServer(display) #define XNoOp(display) {display->request++;} #define XUngrabServer(display) diff --git a/unix/Makefile.in b/unix/Makefile.in index 3a20048..bf523ea 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -57,6 +57,7 @@ BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir) # Directory in which to install the .a or .so binary for the Tk library: LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) +DLL_INSTALL_DIR = @DLL_INSTALL_DIR@ # Path name to use when installing library scripts. SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY) @@ -735,9 +736,9 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} echo "}";\ ) > "$(PKG_INDEX)"; \ fi - @echo "Installing $(LIB_FILE) to @DLL_INSTALL_DIR@/" + @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ - @chmod 555 "@DLL_INSTALL_DIR@"/$(LIB_FILE) + @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)"/wish$(VERSION)${EXE_SUFFIX} @echo "Installing tkConfig.sh to $(CONFIG_INSTALL_DIR)/" diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 601ef57..bc432e7 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -113,15 +113,6 @@ # define NBBY 8 #endif -/* - * The TkPutImage macro strips off the color table information, which isn't - * needed for X. - */ - -#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \ - XPutImage(display, pixels, gc, image, srcx, srcy, destx, \ - desty, width, height); - #ifdef __CYGWIN__ # define UINT unsigned int # define HWND void * @@ -135,6 +126,16 @@ # define WPARAM void * # define LPARAM void * # define LRESULT void * +#else +/* + * The TkPutImage macro strips off the color table information, which isn't + * needed for X. + */ + +#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \ + XPutImage(display, pixels, gc, image, srcx, srcy, destx, \ + desty, width, height); + #endif /* @@ -167,7 +168,9 @@ #define TkpButtonSetDefaults() {} #define TkpDestroyButton(butPtr) {} #define TkSelUpdateClipboard(a,b) {} +#ifndef __CYGWIN__ #define TkSetPixmapColormap(p,c) {} +#endif /* * These calls implement native bitmaps which are not supported under @@ -182,8 +185,9 @@ * This macro stores a representation of the window handle in a string. * This should perhaps use the real size of an XID. */ - +#ifndef __CYGWIN__ #define TkpPrintWindowId(buf,w) \ sprintf((buf), "%#08lx", (unsigned long) (w)) +#endif #endif /* _UNIXPORT */ diff --git a/win/tkWinPort.h b/win/tkWinPort.h index e5ed7de..1b999ab 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -69,20 +69,9 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> -#ifdef __CYGWIN__ -# ifndef _vsnprintf -# define _vsnprintf vsnprintf -# endif -# ifndef _wcsicmp -# define _wcsicmp wcscasecmp -# endif -#else -# ifndef strncasecmp -# define strncasecmp strnicmp -# endif -# ifndef strcasecmp -# define strcasecmp stricmp -# endif +#ifndef __GNUC__ +# define strncasecmp strnicmp +# define strcasecmp stricmp #endif #define NBBY 8 @@ -113,17 +102,15 @@ * under Windows. */ -#define TkpCmapStressed(tkwin,colormap) (0) #define XFlush(display) #define XGrabServer(display) #define XUngrabServer(display) -#define TkpSync(display) /* * The following functions are implemented as macros under Windows. */ -#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));} +#define XFree(data) {if ((data) != NULL) ckfree(data);} #define XNoOp(display) {display->request++;} #define XSynchronize(display, bool) {display->request++;} #define XSync(display, bool) {display->request++;} diff --git a/win/winMain.c b/win/winMain.c index a182e3c..353c2b8 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -228,7 +228,7 @@ Tcl_AppInit( return TCL_OK; } -#if defined(__CYGWIN__) || defined(TK_TEST) +#if defined(TK_TEST) /* *---------------------------------------------------------------------- * |