summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tk.decls25
-rw-r--r--generic/tkInt.decls42
-rw-r--r--generic/tkIntPlatDecls.h100
-rw-r--r--generic/tkPlatDecls.h58
-rw-r--r--generic/tkStubInit.c147
-rw-r--r--win/tkWinDialog.c2
-rwxr-xr-xwin/tkWinInt.h3
-rw-r--r--win/tkWinPort.h24
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 <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 *);
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 <time.h>
-#ifdef __CYGWIN__
-# define _T(x) L##x
-#else
-# include <tchar.h>
-#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 <tchar.h>
+#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