From 4c2e9ac08b3332e2a53b28a352f24dc863be9873 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 13:34:36 +0000 Subject: implement TkSetPixmapColormap and TkpPrintWindowId for cygwin export TkWinChildProc for win32 backport TCHAR determination from tkWinPort.h FossilOrigin-Name: b8bf82483ca7c90eecc13f1845302764cfebb003 --- generic/tk.decls | 25 -------- generic/tkInt.decls | 42 ++++++++++++++ generic/tkIntPlatDecls.h | 100 ++++++++++++++++++++++++++++++-- generic/tkPlatDecls.h | 58 +------------------ generic/tkStubInit.c | 147 +++++++++++++++++++++++++++++++++++++---------- win/tkWinDialog.c | 2 +- win/tkWinInt.h | 3 - win/tkWinPort.h | 24 ++++++-- 8 files changed, 274 insertions(+), 127 deletions(-) diff --git a/generic/tk.decls b/generic/tk.decls index 2fae0b8..400c415 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1025,31 +1025,6 @@ declare 264 { 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/tkInt.decls b/generic/tkInt.decls index 3de82d7..5338578 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -659,6 +659,48 @@ declare 35 win { int TkWinGetPlatformTheme(void) } +# Exported through stub table since Tk 8.4.20/8.5.9 + +declare 36 win { + 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 { + 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 { + void TkpSync(Display *display) +} +declare 42 win { + Window TkUnixContainerId(TkWindow *winPtr) +} +declare 43 win { + int TkUnixDoOneXEvent(Tcl_Time *timePtr) +} +declare 44 win { + void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) +} +declare 45 win { + void TkWmCleanup(TkDisplay *dispPtr) +} +declare 46 win { + void TkSendCleanup(TkDisplay *dispPtr) +} +declare 47 win { + void TkFreeXId(TkDisplay *dispPtr) +} + ################################ # Mac specific functions diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index e9f4256..dd1e899 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -30,7 +30,7 @@ * Exported function declarations: */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* 0 */ EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); @@ -123,6 +123,34 @@ EXTERN int TkWinGetPlatformId _ANSI_ARGS_((void)); EXTERN void TkWinSetHINSTANCE _ANSI_ARGS_((HINSTANCE hInstance)); /* 35 */ EXTERN int TkWinGetPlatformTheme _ANSI_ARGS_((void)); +/* 36 */ +EXTERN LRESULT __stdcall TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam)); +/* 37 */ +EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); +/* 38 */ +EXTERN void TkFreeWindowId _ANSI_ARGS_((TkDisplay *dispPtr, + Window w)); +/* 39 */ +EXTERN void TkInitXId _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 40 */ +EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin, + Colormap colormap)); +/* 41 */ +EXTERN void TkpSync _ANSI_ARGS_((Display *display)); +/* 42 */ +EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow *winPtr)); +/* 43 */ +EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time *timePtr)); +/* 44 */ +EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, + Tk_Window menubar)); +/* 45 */ +EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 46 */ +EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 47 */ +EXTERN void TkFreeXId _ANSI_ARGS_((TkDisplay *dispPtr)); #endif /* __WIN32__ */ #ifdef MAC_TCL /* 0 */ @@ -385,7 +413,7 @@ EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin)); /* 53 */ EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void)); #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); /* 1 */ @@ -423,7 +451,7 @@ typedef struct TkIntPlatStubs { int magic; struct TkIntPlatStubHooks *hooks; -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) char * (*tkAlignImageData) _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); /* 0 */ VOID *reserved1; void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 2 */ @@ -460,6 +488,18 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */ void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */ int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */ + LRESULT __stdcall (*tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ + void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */ + void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 38 */ + void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 39 */ + int (*tkpCmapStressed) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 40 */ + void (*tkpSync) _ANSI_ARGS_((Display *display)); /* 41 */ + Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow *winPtr)); /* 42 */ + int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time *timePtr)); /* 43 */ + void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 44 */ + void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 45 */ + void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 46 */ + void (*tkFreeXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 47 */ #endif /* __WIN32__ */ #ifdef MAC_TCL void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 0 */ @@ -586,7 +626,7 @@ typedef struct TkIntPlatStubs { VOID *reserved52; unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 53 */ #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 0 */ void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 1 */ void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 2 */ @@ -617,7 +657,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; * Inline function declarations: */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) #ifndef TkAlignImageData #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ @@ -759,6 +799,54 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkWinGetPlatformTheme \ (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ #endif +#ifndef TkWinChildProc +#define TkWinChildProc \ + (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ +#endif +#ifndef TkCreateXEventSource +#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 */ +#endif +#ifndef TkpSync +#define TkpSync \ + (tkIntPlatStubsPtr->tkpSync) /* 41 */ +#endif +#ifndef TkUnixContainerId +#define TkUnixContainerId \ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 42 */ +#endif +#ifndef TkUnixDoOneXEvent +#define TkUnixDoOneXEvent \ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 43 */ +#endif +#ifndef TkUnixSetMenubar +#define TkUnixSetMenubar \ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 44 */ +#endif +#ifndef TkWmCleanup +#define TkWmCleanup \ + (tkIntPlatStubsPtr->tkWmCleanup) /* 45 */ +#endif +#ifndef TkSendCleanup +#define TkSendCleanup \ + (tkIntPlatStubsPtr->tkSendCleanup) /* 46 */ +#endif +#ifndef TkFreeXId +#define TkFreeXId \ + (tkIntPlatStubsPtr->tkFreeXId) /* 47 */ +#endif #endif /* __WIN32__ */ #ifdef MAC_TCL #ifndef TkGenerateActivateEvents @@ -1164,7 +1252,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ #endif #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ #ifndef TkCreateXEventSource #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index f9bce86..cf1ec21 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -29,25 +29,7 @@ * 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__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* 0 */ EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); @@ -135,15 +117,7 @@ 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__ +#if defined(__WIN32__) || defined(__CYGWIN__) Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ HWND (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */ @@ -193,33 +167,7 @@ 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__ +#if defined(__WIN32__) || defined(__CYGWIN__) #ifndef Tk_AttachHWND #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 22334bc..c533781 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -37,20 +37,52 @@ #include "tkIntPlatDecls.h" #include "tkIntXlibDecls.h" +#ifdef __WIN32__ + +static int +doNothing(void) +{ + /* dummy implementation, no need to do anything */ + return 0; +} + +/* + * Remove macros that will interfere with the definitions below. + */ +# undef TkFreeWindowId +# undef TkInitXId +# undef TkpCmapStressed +# undef TkpSync + +# define TkCreateXEventSource (void (*) ()) doNothing +# define TkFreeWindowId (void (*) _ANSI_ARGS_((TkDisplay *, Window))) doNothing +# define TkInitXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkpCmapStressed (int (*) _ANSI_ARGS_((Tk_Window, Colormap))) doNothing +# define TkpSync (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkUnixContainerId 0 +# define TkUnixDoOneXEvent 0 +# define TkUnixSetMenubar 0 +# define TkWmCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkSendCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkFreeXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing + +#else /* * 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 -#undef TkPutImage +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion +# undef TkPutImage +# undef TkSetPixmapColormap +# undef TkpPrintWindowId +# undef TkWinChildProc 0 -#ifndef __WIN32__ /* * Make sure that extensions which call XParseColor through the stub * table, call TkParseColor instead. [Bug 3486474] @@ -76,14 +108,16 @@ # define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion # ifdef __CYGWIN__ -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +# define Tk_GetHINSTANCE TkPlatGetHINSTANCE +# define TkSetPixmapColormap TkPlatSetPixmapColormap +# define TkpPrintWindowId TkPlatpPrintWindowId /* * Trick, so we don't have to include 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 *); TkIntStubs tkIntStubs; @@ -96,15 +130,62 @@ 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 +static void +TkSetPixmapColormap(pixmap, colormap) + Pixmap pixmap; + Colormap colormap; +{ +} + +static void +TkpPrintWindowId(buf, window) + 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)); +} + + /* 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__ */ @@ -311,7 +392,7 @@ TkIntStubs tkIntStubs = { TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) TkAlignImageData, /* 0 */ NULL, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -348,6 +429,18 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformId, /* 33 */ TkWinSetHINSTANCE, /* 34 */ 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 */ #endif /* __WIN32__ */ #ifdef MAC_TCL TkGenerateActivateEvents, /* 0 */ @@ -474,7 +567,7 @@ TkIntPlatStubs tkIntPlatStubs = { NULL, /* 52 */ TkpGetMS, /* 53 */ #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ TkFreeWindowId, /* 1 */ TkInitXId, /* 2 */ @@ -795,15 +888,7 @@ 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__ +#if defined(__WIN32__) || defined(__CYGWIN__) Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 775d06b..06f5a99 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2426,7 +2426,7 @@ ChooseDirectoryHookProc( * Directory must exist. Complain, then rehighlight text. */ - wsprintf(tmp, _T("Cannot change directory to \"%.200s\"."), + wsprintf(tmp, "Cannot change directory to \"%.200s\".", cdPtr->path); MessageBox(hwnd, tmp, NULL, MB_OK); SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1); diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 7ab4ff4..a1c50fe 100755 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -154,9 +154,6 @@ extern CONST int tkpWinBltModes[]; #define TCL_STORAGE_CLASS DLLEXPORT #endif -EXTERN LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam)); - /* * Special proc needed as tsd accessor function between * tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard diff --git a/win/tkWinPort.h b/win/tkWinPort.h index f991195..77408dc 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -40,16 +40,28 @@ #endif #include -#ifdef __CYGWIN__ -# define _T(x) L##x -#else -# include -#endif #ifdef _MSC_VER -# define hypot _hypot +# ifndef hypot +# define hypot _hypot +# endif #endif /* _MSC_VER */ +/* + * Pull in the typedef of TCHAR for windows. + */ +#include +#ifndef _TCHAR_DEFINED + /* Borland seems to forget to set this. */ + typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED +#endif +#if defined(_MSC_VER) && defined(__STDC__) + /* VS2005 SP1 misses this. See [Bug #3110161] */ + typedef _TCHAR TCHAR; +#endif + + #ifndef __GNUC__ # define strncasecmp strnicmp # define strcasecmp stricmp -- cgit v0.12 From 980442509e5699b442e699743aa2b916d76b1286 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 13:56:01 +0000 Subject: typo FossilOrigin-Name: 1203fa3c9a75f23a74e95c558a8981d6bcc586f4 --- generic/tkStubInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index c533781..01bda9e 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -81,7 +81,7 @@ doNothing(void) # undef TkPutImage # undef TkSetPixmapColormap # undef TkpPrintWindowId -# undef TkWinChildProc 0 +# undef TkWinChildProc /* * Make sure that extensions which call XParseColor through the stub -- cgit v0.12 From 074c6d344bdbeb0aec07b29761111253259d832e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 14:42:10 +0000 Subject: backport TCHAR determination from tkWinPort.h FossilOrigin-Name: 282c5ca9fbe48a19494c5849b2774d22d1090b5b --- win/tkWinPort.h | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 9deefce..73a511c 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -50,33 +50,21 @@ /* * Pull in the typedef of TCHAR for windows. */ -#if !defined(_TCHAR_DEFINED) -# include -# ifndef _TCHAR_DEFINED - /* Borland seems to forget to set this. */ - typedef _TCHAR TCHAR; -# define _TCHAR_DEFINED -# endif -# if defined(_MSC_VER) && defined(__STDC__) - /* VS2005 SP1 misses this. See [Bug #3110161] */ - typedef _TCHAR TCHAR; -# endif +#include +#ifndef _TCHAR_DEFINED + /* Borland seems to forget to set this. */ + typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED +#endif +#if defined(_MSC_VER) && defined(__STDC__) + /* VS2005 SP1 misses this. See [Bug #3110161] */ + typedef _TCHAR TCHAR; #endif -#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 -- cgit v0.12 From e0e9c47e3ab15bd7c139d333f19ca2525b83164c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 15:03:39 +0000 Subject: remove some unused CYGWIN stuff FossilOrigin-Name: 06f9f5b814eae8191dbf80c28249cdd9a2416275 --- win/winMain.c | 134 +--------------------------------------------------------- 1 file changed, 2 insertions(+), 132 deletions(-) diff --git a/win/winMain.c b/win/winMain.c index 2883ad7..eea7004 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -16,7 +16,6 @@ #undef WIN32_LEAN_AND_MEAN #include - /* * The following declarations refer to internal Tk routines. These interfaces * are available for use, but are not supported. @@ -37,10 +36,6 @@ extern Tcl_PackageInitProc Dde_SafeInit; static void WishPanic(CONST char *format, ...); -#if defined(__CYGWIN__) -static void setargv(int *argcPtr, char ***argvPtr); -#endif /* __CYGWIN__ */ - static BOOL consoleRequired = TRUE; /* @@ -112,12 +107,8 @@ WinMain( * Get our args from the c-runtime. Ignore lpszCmdLine. */ -#if defined(__CYGWIN__) - setargv(&argc, &argv); -#else argc = __argc; argv = __argv; -#endif /* * Forward slashes substituted for backslashes. @@ -289,7 +280,7 @@ WishPanic( ExitProcess(1); } -#if !defined(__GNUC__) || defined(TK_TEST) +#if defined(TK_TEST) /* *---------------------------------------------------------------------- * @@ -331,128 +322,7 @@ main( Tk_Main(argc, argv, Tcl_AppInit); return 0; } -#endif /* !__GNUC__ || TK_TEST */ - - -/* - *------------------------------------------------------------------------- - * - * setargv -- - * - * Parse the Windows command line string into argc/argv. Done here - * because we don't trust the builtin argument parser in crt0. Windows - * applications are responsible for breaking their command line into - * arguments. - * - * 2N backslashes + quote -> N backslashes + begin quoted string - * 2N + 1 backslashes + quote -> literal - * N backslashes + non-quote -> literal - * quote + quote in a quoted string -> single quote - * quote + quote not in quoted string -> empty string - * quote -> begin quoted string - * - * Results: - * Fills argcPtr with the number of arguments and argvPtr with the array - * of arguments. - * - * Side effects: - * Memory allocated. - * - *-------------------------------------------------------------------------- - */ - -#if defined(__CYGWIN__) -static void -setargv( - int *argcPtr, /* Filled with number of argument strings. */ - char ***argvPtr) /* Filled with argument strings (malloc'd). */ -{ - char *cmdLine, *p, *arg, *argSpace; - char **argv; - int argc, size, inquote, copy, slashes; - - cmdLine = GetCommandLine(); /* INTL: BUG */ - - /* - * Precompute an overly pessimistic guess at the number of arguments in - * the command line by counting non-space spans. - */ - - size = 2; - for (p = cmdLine; *p != '\0'; p++) { - if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - size++; - while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - p++; - } - if (*p == '\0') { - break; - } - } - } - argSpace = (char *) ckalloc( - (unsigned) (size * sizeof(char *) + strlen(cmdLine) + 1)); - argv = (char **) argSpace; - argSpace += size * sizeof(char *); - size--; - - p = cmdLine; - for (argc = 0; argc < size; argc++) { - argv[argc] = arg = argSpace; - while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - p++; - } - if (*p == '\0') { - break; - } - - inquote = 0; - slashes = 0; - while (1) { - copy = 1; - while (*p == '\\') { - slashes++; - p++; - } - if (*p == '"') { - if ((slashes & 1) == 0) { - copy = 0; - if ((inquote) && (p[1] == '"')) { - p++; - copy = 1; - } else { - inquote = !inquote; - } - } - slashes >>= 1; - } - - while (slashes) { - *arg = '\\'; - arg++; - slashes--; - } - - if ((*p == '\0') || (!inquote && - ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ - break; - } - if (copy != 0) { - *arg = *p; - arg++; - } - p++; - } - *arg = '\0'; - argSpace = arg + 1; - } - argv[argc] = NULL; - - *argcPtr = argc; - *argvPtr = argv; -} -#endif /* __CYGWIN__ */ - +#endif /* TK_TEST */ /* * Local Variables: * mode: c -- cgit v0.12 From 23b052e6e0e30539d958bd61e2f6a87dd3c2b982 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 18:58:20 +0000 Subject: fix some visual studio warnings, eliminate some ANSI_ARGS FossilOrigin-Name: 81524cf1a198db3d15e4de70773ad1e9b3583058 --- generic/tkIntPlatDecls.h | 2 +- generic/tkStubInit.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index dd1e899..a2006d9 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -488,7 +488,7 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */ void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */ int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */ - LRESULT __stdcall (*tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ + LRESULT (__stdcall *tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */ void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 38 */ void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 39 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 01bda9e..ffa8c2b 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -54,17 +54,17 @@ doNothing(void) # undef TkpCmapStressed # undef TkpSync -# define TkCreateXEventSource (void (*) ()) doNothing -# define TkFreeWindowId (void (*) _ANSI_ARGS_((TkDisplay *, Window))) doNothing -# define TkInitXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkpCmapStressed (int (*) _ANSI_ARGS_((Tk_Window, Colormap))) doNothing -# define TkpSync (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkCreateXEventSource (void (*) (void)) doNothing +# define TkFreeWindowId (void (*) (TkDisplay *, Window)) doNothing +# define TkInitXId (void (*) (TkDisplay *)) doNothing +# define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing +# define TkpSync (void (*) (Display *)) doNothing # define TkUnixContainerId 0 # define TkUnixDoOneXEvent 0 # define TkUnixSetMenubar 0 -# define TkWmCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkSendCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkFreeXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkWmCleanup (void (*) (TkDisplay *)) doNothing +# define TkSendCleanup (void (*) (TkDisplay *)) doNothing +# define TkFreeXId (void (*) (TkDisplay *)) doNothing #else /* -- cgit v0.12 From 704dfde80dd82532809511f107a82dfa326ffb88 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 23:06:39 +0000 Subject: give tkWinWm.c access to SM_XVIRTUALSCREEN and friends FossilOrigin-Name: a53aa64bb697ad430642eba0fd7b609b00c832b1 --- win/tkWin.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tkWin.h b/win/tkWin.h index d97adc7..00d3486 100644 --- a/win/tkWin.h +++ b/win/tkWin.h @@ -22,10 +22,10 @@ */ #ifndef WINVER -#define WINVER 0x0410 +#define WINVER 0x0500 #endif -#ifndef _WIN32_WINDOWS -#define _WIN32_WINDOWS 0x0410 +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 #endif #ifndef _TK -- cgit v0.12