diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-29 12:45:47 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-29 12:45:47 (GMT) |
commit | 29067ec103d779feffa6d5dea099666cc2785b76 (patch) | |
tree | 12d4d15c3f59ae70b1113469422fb33b9039d700 | |
parent | 20ae5845bf5393c40ddd12145483e4c6af9ef77e (diff) | |
parent | d7e1d66497a877b980042968a57edd01d2840818 (diff) | |
download | tk-29067ec103d779feffa6d5dea099666cc2785b76.zip tk-29067ec103d779feffa6d5dea099666cc2785b76.tar.gz tk-29067ec103d779feffa6d5dea099666cc2785b76.tar.bz2 |
merge core-8-4-branch, still to be tested on Unixtobetested
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 2 | ||||
-rw-r--r-- | generic/tkInt.decls | 27 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 8 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 90 | ||||
-rw-r--r-- | generic/tkMain.c | 104 | ||||
-rw-r--r-- | generic/tkStubInit.c | 180 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 2 | ||||
-rw-r--r-- | generic/tkWindow.c | 18 | ||||
-rw-r--r-- | unix/tkUnixPort.h | 18 | ||||
-rw-r--r-- | win/Makefile.in | 14 | ||||
-rw-r--r-- | win/tkWinPort.h | 2 |
12 files changed, 230 insertions, 244 deletions
@@ -1,3 +1,12 @@ +2012-05-25 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tkWindow.c: Simpify determination whether we are running on cygwin. + * generic/tkStubInit.c: Export Tk_GetHINSTANCE, TkSetPixmapColormap and + * generic/tkInt.decls: TkpPrintWindowId on the Cygwin dll, sync stub table + with Tk 8.6 win32 version. + * generic/tk*Decls.h: re-generated + * win/Makefile.in: Fix "make genstubs" when cross-compiling on UNIX + 2012-05-24 Jan Nijtmans <nijtmans@users.sf.net> * win/stubs.c: Change XSetCommand signature to match Xorg, diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index b30ca30..85c7de5 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -23,6 +23,8 @@ #ifdef __WIN32__ #include "tkWinInt.h" +#elif defined(__CYGWIN__) +#include "tkUnixInt.h" #endif /* diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 33921ba..20d0dd4 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -436,7 +436,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, @@ -750,42 +750,33 @@ declare 36 win { UINT message, WPARAM wParam, LPARAM lParam) } -# new for 8.4.20+, Cygwin only +# new for 8.4.20+/8.5.12+, Cygwin only declare 37 win { void TkCreateXEventSource(void) } declare 38 win { - void TkFreeWindowId(TkDisplay *dispPtr, Window w) -} -declare 39 win { - void TkInitXId(TkDisplay *dispPtr) -} -declare 40 win { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } -declare 41 win { +declare 39 win { void TkpSync(Display *display) } -declare 42 win { +declare 40 win { Window TkUnixContainerId(TkWindow *winPtr) } -declare 43 win { +declare 41 win { int TkUnixDoOneXEvent(Tcl_Time *timePtr) } -declare 44 win { +declare 42 win { void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) } -declare 45 win { +declare 43 win { void TkWmCleanup(TkDisplay *dispPtr) } -declare 46 win { +declare 44 win { void TkSendCleanup(TkDisplay *dispPtr) } -declare 47 win { - void TkFreeXId(TkDisplay *dispPtr) -} # only needed by tktest: -declare 48 win { +declare 45 win { int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv) } diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index acb9639..7f1c096 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -1854,11 +1854,10 @@ extern TkIntStubs *tkIntStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT +#ifndef __WIN32__ /* - * On X11, these macros are just wrappers for the equivalent X Region calls. + * 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 @@ -1879,8 +1878,7 @@ extern TkIntStubs *tkIntStubsPtr; (Region) b, (Region) r) #define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \ (Region) src, (Region) ret) - -#endif /* UNIX */ +#endif /* __WIN32__ */ #endif /* _TKINTDECLS */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 021be8e..1e0a758 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -231,59 +231,44 @@ EXTERN LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, /* 37 */ EXTERN void TkCreateXEventSource(void); #endif -#ifndef TkFreeWindowId_TCL_DECLARED -#define TkFreeWindowId_TCL_DECLARED -/* 38 */ -EXTERN void TkFreeWindowId(TkDisplay *dispPtr, Window w); -#endif -#ifndef TkInitXId_TCL_DECLARED -#define TkInitXId_TCL_DECLARED -/* 39 */ -EXTERN void TkInitXId(TkDisplay *dispPtr); -#endif #ifndef TkpCmapStressed_TCL_DECLARED #define TkpCmapStressed_TCL_DECLARED -/* 40 */ +/* 38 */ EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); #endif #ifndef TkpSync_TCL_DECLARED #define TkpSync_TCL_DECLARED -/* 41 */ +/* 39 */ EXTERN void TkpSync(Display *display); #endif #ifndef TkUnixContainerId_TCL_DECLARED #define TkUnixContainerId_TCL_DECLARED -/* 42 */ +/* 40 */ EXTERN Window TkUnixContainerId(TkWindow *winPtr); #endif #ifndef TkUnixDoOneXEvent_TCL_DECLARED #define TkUnixDoOneXEvent_TCL_DECLARED -/* 43 */ +/* 41 */ EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); #endif #ifndef TkUnixSetMenubar_TCL_DECLARED #define TkUnixSetMenubar_TCL_DECLARED -/* 44 */ +/* 42 */ EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); #endif #ifndef TkWmCleanup_TCL_DECLARED #define TkWmCleanup_TCL_DECLARED -/* 45 */ +/* 43 */ EXTERN void TkWmCleanup(TkDisplay *dispPtr); #endif #ifndef TkSendCleanup_TCL_DECLARED #define TkSendCleanup_TCL_DECLARED -/* 46 */ +/* 44 */ EXTERN void TkSendCleanup(TkDisplay *dispPtr); #endif -#ifndef TkFreeXId_TCL_DECLARED -#define TkFreeXId_TCL_DECLARED -/* 47 */ -EXTERN void TkFreeXId(TkDisplay *dispPtr); -#endif #ifndef TkpTestsendCmd_TCL_DECLARED #define TkpTestsendCmd_TCL_DECLARED -/* 48 */ +/* 45 */ EXTERN int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int argc, CONST char **argv); @@ -659,17 +644,14 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformTheme) (void); /* 35 */ LRESULT (__stdcall *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ void (*tkCreateXEventSource) (void); /* 37 */ - void (*tkFreeWindowId) (TkDisplay *dispPtr, Window w); /* 38 */ - void (*tkInitXId) (TkDisplay *dispPtr); /* 39 */ - int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 40 */ - void (*tkpSync) (Display *display); /* 41 */ - Window (*tkUnixContainerId) (TkWindow *winPtr); /* 42 */ - int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 43 */ - void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 44 */ - void (*tkWmCleanup) (TkDisplay *dispPtr); /* 45 */ - void (*tkSendCleanup) (TkDisplay *dispPtr); /* 46 */ - void (*tkFreeXId) (TkDisplay *dispPtr); /* 47 */ - int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp *interp, int argc, CONST char **argv); /* 48 */ + 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 */ @@ -909,49 +891,37 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */ #endif -#ifndef TkFreeWindowId -#define TkFreeWindowId \ - (tkIntPlatStubsPtr->tkFreeWindowId) /* 38 */ -#endif -#ifndef TkInitXId -#define TkInitXId \ - (tkIntPlatStubsPtr->tkInitXId) /* 39 */ -#endif #ifndef TkpCmapStressed #define TkpCmapStressed \ - (tkIntPlatStubsPtr->tkpCmapStressed) /* 40 */ + (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ #endif #ifndef TkpSync #define TkpSync \ - (tkIntPlatStubsPtr->tkpSync) /* 41 */ + (tkIntPlatStubsPtr->tkpSync) /* 39 */ #endif #ifndef TkUnixContainerId #define TkUnixContainerId \ - (tkIntPlatStubsPtr->tkUnixContainerId) /* 42 */ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ #endif #ifndef TkUnixDoOneXEvent #define TkUnixDoOneXEvent \ - (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 43 */ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ #endif #ifndef TkUnixSetMenubar #define TkUnixSetMenubar \ - (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 44 */ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ #endif #ifndef TkWmCleanup #define TkWmCleanup \ - (tkIntPlatStubsPtr->tkWmCleanup) /* 45 */ + (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ #endif #ifndef TkSendCleanup #define TkSendCleanup \ - (tkIntPlatStubsPtr->tkSendCleanup) /* 46 */ -#endif -#ifndef TkFreeXId -#define TkFreeXId \ - (tkIntPlatStubsPtr->tkFreeXId) /* 47 */ + (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #endif #ifndef TkpTestsendCmd #define TkpTestsendCmd \ - (tkIntPlatStubsPtr->tkpTestsendCmd) /* 48 */ + (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ #endif #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -1214,13 +1184,13 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT +#ifdef __CYGWIN__ + void TkFreeXId(TkDisplay *dispPtr); + void TkFreeWindowId(TkDisplay *dispPtr, Window w); + void TkInitXId(TkDisplay *dispPtr); +#endif + #ifdef __WIN32__ -#undef TkFreeWindowId -#undef TkInitXId -#undef TkpCmapStressed -#undef TkpSync -#define TkFreeWindowId(dispPtr,w) -#define TkInitXId(dispPtr) #define TkpCmapStressed(tkwin,colormap) (0) #define TkpSync(display) #endif diff --git a/generic/tkMain.c b/generic/tkMain.c index 69c7d25..c6d5238 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -18,6 +18,7 @@ #include "tkInt.h" #ifdef __WIN32__ #include "tkWinInt.h" +#include "../win/tclWinPort.h" #endif #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" @@ -44,7 +45,45 @@ static Tcl_ThreadDataKey dataKey; * it will conflict with a declaration elsewhere on some systems. */ -#if !defined(__WIN32__) && !defined(_WIN32) +#if defined(__WIN32__) || defined(_WIN32) +#define isatty WinIsTty +static int WinIsTty(int fd) { + HANDLE handle; + + /* + * For now, under Windows, we assume we are not running as a console mode + * app, so we need to use the GUI console. In order to enable this, we + * always claim to be running on a tty. This probably isn't the right + * way to do it. + */ + +#if !defined(STATIC_BUILD) + if (tclStubsPtr->reserved9 && TclpIsAtty) { + /* We are running on Cygwin */ + return TclpIsAtty(fd); + } +#endif + handle = GetStdHandle(STD_INPUT_HANDLE + fd); + + if ((handle == INVALID_HANDLE_VALUE) || (handle == 0) + || (GetFileType(handle) == FILE_TYPE_UNKNOWN)) { + /* + * If it's a bad or closed handle, then it's been connected + * to a wish console window. + */ + + return 1; + } else if (GetFileType(handle) == FILE_TYPE_CHAR) { + /* + * A character file handle is a tty by definition. + */ + + return 1; + } else { + return 0; + } +} +#else extern int isatty(int fd); extern char * strrchr(CONST char *string, int c); #endif @@ -74,7 +113,6 @@ static void StdinProc(ClientData clientData, int mask); * *---------------------------------------------------------------------- */ - void Tk_MainEx( int argc, /* Number of arguments. */ @@ -90,9 +128,6 @@ Tk_MainEx( int code, nullStdin = 0; Tcl_Channel inChannel, outChannel; ThreadSpecificData *tsdPtr; -#ifdef __WIN32__ - HANDLE handle; -#endif Tcl_DString appName; /* @@ -104,6 +139,27 @@ Tk_MainEx( abort(); } +#if defined(__WIN32__) && !defined(STATIC_BUILD) + if (tclStubsPtr->reserved9) { + /* We are running win32 Tk under Cygwin, so let's check + * whether the env("DISPLAY") variable or the -display + * argument is set. If so, we really want to run the + * Tk_MainEx function of libtk.dll, not this one. */ + if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { + loadCygwinTk: + Tcl_Panic("Should load libtk.dll now, not yet implemented"); + } else { + int i; + + for (i = 1; i < argc; ++i) { + if (!strcmp(argv[i], "-display")) { + goto loadCygwinTk; + } + } + } + } +#endif + tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -111,7 +167,12 @@ Tk_MainEx( tsdPtr->interp = interp; Tcl_Preserve((ClientData) interp); -#if defined(__WIN32__) && !defined(__CYGWIN__) +#if defined(__WIN32__) && !defined(STATIC_BUILD) + if (!tclStubsPtr->reserved9) { + /* Only initialize console when not running under cygwin */ + Tk_InitConsoleChannels(interp); + } +#elif defined(__WIN32__) Tk_InitConsoleChannels(interp); #endif @@ -194,37 +255,8 @@ Tk_MainEx( * Set the "tcl_interactive" variable. */ -#ifdef __WIN32__ - /* - * For now, under Windows, we assume we are not running as a console mode - * app, so we need to use the GUI console. In order to enable this, we - * always claim to be running on a tty. This probably isn't the right way - * to do it. - */ - - handle = GetStdHandle(STD_INPUT_HANDLE); - - if ((handle == INVALID_HANDLE_VALUE) || (handle == 0) - || (GetFileType(handle) == FILE_TYPE_UNKNOWN)) { - /* - * If it's a bad or closed handle, then it's been connected to a wish - * console window. - */ - - tsdPtr->tty = 1; - } else if (GetFileType(handle) == FILE_TYPE_CHAR) { - /* - * A character file handle is a tty by definition. - */ - - tsdPtr->tty = 1; - } else { - tsdPtr->tty = 0; - } - -#else tsdPtr->tty = isatty(0); -#endif + #if defined(MAC_OSX_TK) /* * On TkAqua, if we don't have a TTY and stdin is a special character file diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 03c794e..4a4c3a6 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -42,14 +42,10 @@ doNothing(void) /* * Remove macros that will interfere with the definitions below. */ -# undef TkFreeWindowId -# undef TkInitXId # undef TkpCmapStressed # undef TkpSync -# define TkCreateXEventSource (void (*) (void)) doNothing -# define TkFreeWindowId (void (*) (TkDisplay *, Window)) doNothing -# define TkInitXId (void (*) (TkDisplay *)) doNothing +# define TkCreateXEventSource (void (*) (void)) doNothing # define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing # define TkpSync (void (*) (Display *)) doNothing # define TkUnixContainerId 0 @@ -57,48 +53,19 @@ doNothing(void) # define TkUnixSetMenubar 0 # define TkWmCleanup (void (*) (TkDisplay *)) doNothing # define TkSendCleanup (void (*) (TkDisplay *)) doNothing -# define TkFreeXId (void (*) (TkDisplay *)) doNothing # define TkpTestsendCmd 0 -#else -/* - * Remove macros that will interfere with the definitions below. - */ - -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 -# undef TkSetPixmapColormap -# undef TkpPrintWindowId -# undef TkWinChildProc +#else /* !__WIN32__ */ -/* - * Make sure that extensions which call XParseColor through the stub - * table, call TkParseColor instead. [Bug 3486474] - */ -# define XParseColor TkParseColor +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion -# 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 (*) _ANSI_ARGS_((TkRegion, XRectangle *))) XClipBox # define TkCreateRegion (TkRegion (*) ()) XCreateRegion # define TkDestroyRegion (void (*) _ANSI_ARGS_((TkRegion))) XDestroyRegion @@ -108,18 +75,34 @@ MODULE_SCOPE TkStubs tkStubs; # define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion # define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion -# 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. + * Make sure that extensions which call XParseColor through the stub + * table, call TkParseColor instead. [Bug 3486474] */ +# define XParseColor TkParseColor + +# ifdef __CYGWIN__ -#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 + /* + * Remove macros that will interfere with the definitions below. + */ +# undef TkPutImage +# undef TkSetPixmapColormap +# undef TkpPrintWindowId +# undef TkWinChildProc + + + /* + * 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() +TkIntStubs tkIntStubs; + +void *Tk_GetHINSTANCE() { void *hInstance = NULL; @@ -144,46 +127,46 @@ TkpPrintWindowId(buf, window) sprintf(buf, "%#08lx", (unsigned long) (window)); } - /* 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 + /* 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__ */ /* @@ -449,17 +432,14 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ TkCreateXEventSource, /* 37 */ - TkFreeWindowId, /* 38 */ - TkInitXId, /* 39 */ - TkpCmapStressed, /* 40 */ - TkpSync, /* 41 */ - TkUnixContainerId, /* 42 */ - TkUnixDoOneXEvent, /* 43 */ - TkUnixSetMenubar, /* 44 */ - TkWmCleanup, /* 45 */ - TkSendCleanup, /* 46 */ - TkFreeXId, /* 47 */ - TkpTestsendCmd, /* 48 */ + 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 */ diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index d0cd4d2..d82949f 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -18,6 +18,8 @@ #ifdef __WIN32__ #include "tkWinInt.h" +#elif defined(__CYGWIN__) +#include "tkUnixInt.h" #endif #ifdef MAC_OSX_TK diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c432cbf..6892360 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -16,7 +16,7 @@ #ifdef __WIN32__ #include "tkWinInt.h" -#elif !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" #endif @@ -860,9 +860,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; @@ -870,14 +867,6 @@ TkCreateMainWindow( ClientData clientData; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 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 +951,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 @@ -3226,9 +3216,7 @@ Initialize( Tcl_SetMainLoop(Tk_MainLoop); -#ifdef Tk_InitStubs #undef Tk_InitStubs -#endif Tk_InitStubs(interp, TK_VERSION, 1); diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 8318724..4f530d2 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -128,15 +128,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 * @@ -151,6 +142,14 @@ # define LPARAM void * # define LRESULT void * #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); /* * Supply macros for seek offsets, if they're not already provided by @@ -199,6 +198,7 @@ * 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)) diff --git a/win/Makefile.in b/win/Makefile.in index 7958e3c..89b61cd 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -708,4 +708,16 @@ genstubs: $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ "$(GENERIC_DIR_NATIVE)" \ "$(GENERIC_DIR_NATIVE)/tk.decls" \ - "$(GENERIC_DIR_NATIVE)/tkInt.decls" + "$(GENERIC_DIR_NATIVE)/tkInt.decls" +# +# The list of all the targets that do not correspond to real files. This stops +# 'make' from getting confused when someone makes an error in a rule. +# + +.PHONY: all binaries libraries doc tkLibObjs objs tktest-real test test-classic +.PHONY: test-ttk testlang runtest shell demo gdb install install-strip +.PHONY: install-binaries install-libraries install-demos install-doc +.PHONY: install-private-headers clean distclean depend genstubs checkstubs +.PHONY: checkuchar checkexports rpm dist alldist allpatch html html-tcl html-tk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 907412b..83b67c6 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -95,6 +95,8 @@ * under Windows. */ +#define TkFreeWindowId(dispPtr,w) +#define TkInitXId(dispPtr) #define XFlush(display) #define XGrabServer(display) #define XUngrabServer(display) |