summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-29 15:23:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-29 15:23:25 (GMT)
commitfad48a7b6368bdb719b8b5cdc77f19ee4b089ee6 (patch)
tree395ef36a3124aa88061682c8f522fe266d2fb73a /generic
parent07212f98d3048b772094a64325e930e1c0364964 (diff)
parentc985425b2f03e2e14bf3f7ee9884cd74c184373e (diff)
downloadtk-fad48a7b6368bdb719b8b5cdc77f19ee4b089ee6.zip
tk-fad48a7b6368bdb719b8b5cdc77f19ee4b089ee6.tar.gz
tk-fad48a7b6368bdb719b8b5cdc77f19ee4b089ee6.tar.bz2
merge core-8-4-branch
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls27
-rw-r--r--generic/tkImgPhoto.c2
-rw-r--r--generic/tkInt.decls38
-rw-r--r--generic/tkIntDecls.h48
-rw-r--r--generic/tkIntPlatDecls.h103
-rw-r--r--generic/tkIntXlibDecls.h42
-rw-r--r--generic/tkMain.c103
-rw-r--r--generic/tkPlatDecls.h76
-rw-r--r--generic/tkStubInit.c213
-rw-r--r--generic/tkTextDisp.c2
-rw-r--r--generic/tkWindow.c22
11 files changed, 396 insertions, 280 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index 2fae0b8..f752151 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 {
@@ -1082,7 +1057,7 @@ declare 0 mac {
Tk_MacEmbedGetClipProc *getClipProc,
Tk_MacEmbedGetOffsetInParentProc *getOffsetProc)
}
-
+
declare 1 mac {
void Tk_MacTurnOffMenus(void)
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index ffbb47c..23db11a 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -25,6 +25,8 @@
#ifdef __WIN32__
#include "tkWinInt.h"
+#elif defined(__CYGWIN__)
+#include "tkUnixInt.h"
#endif
/*
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 1a62c47..f88186a 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -427,7 +427,7 @@ declare 119 {
TkRegion src, TkRegion dr_return)
}
declare 121 {mac aqua} {
- Pixmap TkpCreateNativeBitmap(Display *display, const char *source)
+ Pixmap TkpCreateNativeBitmap(Display *display, const char *source)
}
declare 122 {mac aqua} {
void TkpDefineNativeBitmaps(void)
@@ -659,6 +659,38 @@ 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+/8.5.12+, 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)
+}
################################
# Mac specific functions
@@ -1488,7 +1520,7 @@ declare 22 {mac aqua} {
unsigned int ui1, unsigned int ui2, int i3, int i4)
}
declare 23 {mac aqua} {
- void XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)
+ int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)
}
declare 24 {mac aqua} {
void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2,
@@ -1503,7 +1535,7 @@ declare 26 {mac aqua} {
int i1, int i2, int i3)
}
declare 27 {mac aqua} {
- void XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i)
+ int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i)
}
declare 28 {mac aqua} {
void XFreeColormap(Display *d, Colormap c)
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 23dcda4..879c964 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -388,30 +388,30 @@ EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle *rect,
EXTERN Pixmap TkpCreateNativeBitmap _ANSI_ARGS_((Display *display,
CONST char *source));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 121 */
EXTERN Pixmap TkpCreateNativeBitmap _ANSI_ARGS_((Display *display,
CONST char *source));
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#ifdef MAC_TCL
/* 122 */
EXTERN void TkpDefineNativeBitmaps _ANSI_ARGS_((void));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 122 */
EXTERN void TkpDefineNativeBitmaps _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 123 is reserved */
#ifdef MAC_TCL
/* 124 */
EXTERN Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display *display,
CONST char *name, int *width, int *height));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 124 */
EXTERN Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display *display,
CONST char *name, int *width, int *height));
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 125 is reserved */
/* Slot 126 is reserved */
/* Slot 127 is reserved */
@@ -597,40 +597,40 @@ typedef struct TkIntStubs {
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
VOID *reserved121;
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
VOID *reserved121;
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
Pixmap (*tkpCreateNativeBitmap) _ANSI_ARGS_((Display *display, CONST char *source)); /* 121 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
Pixmap (*tkpCreateNativeBitmap) _ANSI_ARGS_((Display *display, CONST char *source)); /* 121 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
VOID *reserved122;
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
VOID *reserved122;
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
void (*tkpDefineNativeBitmaps) _ANSI_ARGS_((void)); /* 122 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
void (*tkpDefineNativeBitmaps) _ANSI_ARGS_((void)); /* 122 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
VOID *reserved123;
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
VOID *reserved124;
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
VOID *reserved124;
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
Pixmap (*tkpGetNativeAppBitmap) _ANSI_ARGS_((Display *display, CONST char *name, int *width, int *height)); /* 124 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
Pixmap (*tkpGetNativeAppBitmap) _ANSI_ARGS_((Display *display, CONST char *name, int *width, int *height)); /* 124 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
VOID *reserved125;
VOID *reserved126;
VOID *reserved127;
@@ -1159,24 +1159,24 @@ extern TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpCreateNativeBitmap
#define TkpCreateNativeBitmap \
(tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#ifdef MAC_TCL
#ifndef TkpDefineNativeBitmaps
#define TkpDefineNativeBitmaps \
(tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpDefineNativeBitmaps
#define TkpDefineNativeBitmaps \
(tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 123 is reserved */
#ifdef MAC_TCL
#ifndef TkpGetNativeAppBitmap
@@ -1184,12 +1184,12 @@ extern TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkpGetNativeAppBitmap
#define TkpGetNativeAppBitmap \
(tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
/* Slot 125 is reserved */
/* Slot 126 is reserved */
/* Slot 127 is reserved */
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index e9f4256..badb8b6 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -30,7 +30,7 @@
* Exported function declarations:
*/
-#ifdef __WIN32__
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
/* 0 */
EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage *image,
int alignment, int bitOrder));
@@ -123,7 +123,28 @@ EXTERN int TkWinGetPlatformId _ANSI_ARGS_((void));
EXTERN void TkWinSetHINSTANCE _ANSI_ARGS_((HINSTANCE hInstance));
/* 35 */
EXTERN int TkWinGetPlatformTheme _ANSI_ARGS_((void));
-#endif /* __WIN32__ */
+/* 36 */
+EXTERN LRESULT __stdcall TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam));
+/* 37 */
+EXTERN void TkCreateXEventSource _ANSI_ARGS_((void));
+/* 38 */
+EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin,
+ Colormap colormap));
+/* 39 */
+EXTERN void TkpSync _ANSI_ARGS_((Display *display));
+/* 40 */
+EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow *winPtr));
+/* 41 */
+EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time *timePtr));
+/* 42 */
+EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin,
+ Tk_Window menubar));
+/* 43 */
+EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay *dispPtr));
+/* 44 */
+EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay *dispPtr));
+#endif /* WIN */
#ifdef MAC_TCL
/* 0 */
EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
@@ -260,7 +281,7 @@ EXTERN void TkMacPreprocessMenu _ANSI_ARGS_((void));
/* 66 */
EXTERN int TkpIsWindowFloating _ANSI_ARGS_((WindowRef window));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
TkWindow *winPtr, int active));
@@ -384,8 +405,8 @@ EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin));
/* Slot 52 is reserved */
/* 53 */
EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
/* 0 */
EXTERN void TkCreateXEventSource _ANSI_ARGS_((void));
/* 1 */
@@ -423,7 +444,7 @@ typedef struct TkIntPlatStubs {
int magic;
struct TkIntPlatStubHooks *hooks;
-#ifdef __WIN32__
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
char * (*tkAlignImageData) _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); /* 0 */
VOID *reserved1;
void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 2 */
@@ -460,7 +481,16 @@ typedef struct TkIntPlatStubs {
int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */
void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */
int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */
-#endif /* __WIN32__ */
+ LRESULT (__stdcall *tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */
+ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */
+ int (*tkpCmapStressed) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 38 */
+ void (*tkpSync) _ANSI_ARGS_((Display *display)); /* 39 */
+ Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow *winPtr)); /* 40 */
+ int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time *timePtr)); /* 41 */
+ void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 42 */
+ void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 43 */
+ void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 44 */
+#endif /* WIN */
#ifdef MAC_TCL
void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 0 */
VOID *reserved1;
@@ -530,7 +560,7 @@ typedef struct TkIntPlatStubs {
void (*tkMacPreprocessMenu) _ANSI_ARGS_((void)); /* 65 */
int (*tkpIsWindowFloating) _ANSI_ARGS_((WindowRef window)); /* 66 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 0 */
VOID *reserved1;
VOID *reserved2;
@@ -585,8 +615,8 @@ typedef struct TkIntPlatStubs {
void (*tkGenWMDestroyEvent) _ANSI_ARGS_((Tk_Window tkwin)); /* 51 */
VOID *reserved52;
unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 53 */
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#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 +647,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
* Inline function declarations:
*/
-#ifdef __WIN32__
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
#ifndef TkAlignImageData
#define TkAlignImageData \
(tkIntPlatStubsPtr->tkAlignImageData) /* 0 */
@@ -759,7 +789,43 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkWinGetPlatformTheme \
(tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */
#endif
-#endif /* __WIN32__ */
+#ifndef TkWinChildProc
+#define TkWinChildProc \
+ (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */
+#endif
+#ifndef TkCreateXEventSource
+#define TkCreateXEventSource \
+ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */
+#endif
+#ifndef TkpCmapStressed
+#define TkpCmapStressed \
+ (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */
+#endif
+#ifndef TkpSync
+#define TkpSync \
+ (tkIntPlatStubsPtr->tkpSync) /* 39 */
+#endif
+#ifndef TkUnixContainerId
+#define TkUnixContainerId \
+ (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */
+#endif
+#ifndef TkUnixDoOneXEvent
+#define TkUnixDoOneXEvent \
+ (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */
+#endif
+#ifndef TkUnixSetMenubar
+#define TkUnixSetMenubar \
+ (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */
+#endif
+#ifndef TkWmCleanup
+#define TkWmCleanup \
+ (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */
+#endif
+#ifndef TkSendCleanup
+#define TkSendCleanup \
+ (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */
+#endif
+#endif /* WIN */
#ifdef MAC_TCL
#ifndef TkGenerateActivateEvents
#define TkGenerateActivateEvents \
@@ -970,7 +1036,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkpIsWindowFloating) /* 66 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef TkGenerateActivateEvents
#define TkGenerateActivateEvents \
(tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */
@@ -1163,8 +1229,8 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkpGetMS \
(tkIntPlatStubsPtr->tkpGetMS) /* 53 */
#endif
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
#ifndef TkCreateXEventSource
#define TkCreateXEventSource \
(tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */
@@ -1226,4 +1292,11 @@ 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
+
+
#endif /* _TKINTPLATDECLS */
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 177e0c4..06bb0f0 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -36,7 +36,7 @@
* Exported function declarations:
*/
-#if defined(__WIN32__) || defined(__CYGWIN__)
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
/* 0 */
EXTERN int XSetDashes _ANSI_ARGS_((Display *display, GC gc,
int dash_offset, _Xconst char *dash_list,
@@ -363,7 +363,7 @@ EXTERN int XWarpPointer _ANSI_ARGS_((Display *d, Window s,
EXTERN int XFillRectangle _ANSI_ARGS_((Display *display,
Drawable d, GC gc, int x, int y,
unsigned int width, unsigned int height));
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
/* 0 */
EXTERN int XSetDashes _ANSI_ARGS_((Display *display, GC gc,
@@ -438,7 +438,7 @@ EXTERN void XDrawArc _ANSI_ARGS_((Display *d, Drawable dr, GC g,
int i1, int i2, unsigned int ui1,
unsigned int ui2, int i3, int i4));
/* 23 */
-EXTERN void XDrawLines _ANSI_ARGS_((Display *d, Drawable dr,
+EXTERN int XDrawLines _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XPoint *x, int i1, int i2));
/* 24 */
EXTERN void XDrawRectangle _ANSI_ARGS_((Display *d, Drawable dr,
@@ -452,7 +452,7 @@ EXTERN void XFillArc _ANSI_ARGS_((Display *d, Drawable dr, GC g,
EXTERN void XFillPolygon _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XPoint *x, int i1, int i2, int i3));
/* 27 */
-EXTERN void XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr,
+EXTERN int XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XRectangle *x, int i));
/* 28 */
EXTERN void XFreeColormap _ANSI_ARGS_((Display *d, Colormap c));
@@ -654,7 +654,7 @@ EXTERN Status XQueryTree _ANSI_ARGS_((Display *d, Window w1,
Window *w2, Window *w3, Window **w4,
unsigned int *ui));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
EXTERN int XSetDashes _ANSI_ARGS_((Display *display, GC gc,
int dash_offset, _Xconst char *dash_list,
@@ -728,7 +728,7 @@ EXTERN void XDrawArc _ANSI_ARGS_((Display *d, Drawable dr, GC g,
int i1, int i2, unsigned int ui1,
unsigned int ui2, int i3, int i4));
/* 23 */
-EXTERN void XDrawLines _ANSI_ARGS_((Display *d, Drawable dr,
+EXTERN int XDrawLines _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XPoint *x, int i1, int i2));
/* 24 */
EXTERN void XDrawRectangle _ANSI_ARGS_((Display *d, Drawable dr,
@@ -742,7 +742,7 @@ EXTERN void XFillArc _ANSI_ARGS_((Display *d, Drawable dr, GC g,
EXTERN void XFillPolygon _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XPoint *x, int i1, int i2, int i3));
/* 27 */
-EXTERN void XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr,
+EXTERN int XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr,
GC g, XRectangle *x, int i));
/* 28 */
EXTERN void XFreeColormap _ANSI_ARGS_((Display *d, Colormap c));
@@ -945,13 +945,13 @@ EXTERN Status XQueryTree _ANSI_ARGS_((Display *d, Window w1,
unsigned int *ui));
/* 91 */
EXTERN int XSync _ANSI_ARGS_((Display *display, Bool flag));
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
typedef struct TkIntXlibStubs {
int magic;
struct TkIntXlibStubHooks *hooks;
-#if defined(__WIN32__) || defined(__CYGWIN__)
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
int (*xSetDashes) _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n)); /* 0 */
XModifierKeymap * (*xGetModifierMapping) _ANSI_ARGS_((Display *d)); /* 1 */
XImage * (*xCreateImage) _ANSI_ARGS_((Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4)); /* 2 */
@@ -1052,14 +1052,14 @@ typedef struct TkIntXlibStubs {
int (*xSetFunction) _ANSI_ARGS_((Display *display, GC gc, int function)); /* 97 */
int (*xSetLineAttributes) _ANSI_ARGS_((Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style)); /* 98 */
int (*_XInitImageFuncPtrs) _ANSI_ARGS_((XImage *image)); /* 99 */
- XIC (*xCreateIC) _ANSI_ARGS_(TCL_VARARGS(XIM,xim)); /* 100 */
+ XIC (*xCreateIC) _ANSI_ARGS_((XIM xim, ...)); /* 100 */
XVisualInfo * (*xGetVisualInfo) _ANSI_ARGS_((Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return)); /* 101 */
void (*xSetWMClientMachine) _ANSI_ARGS_((Display *display, Window w, XTextProperty *text_prop)); /* 102 */
Status (*xStringListToTextProperty) _ANSI_ARGS_((char **list, int count, XTextProperty *text_prop_return)); /* 103 */
int (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 104 */
int (*xWarpPointer) _ANSI_ARGS_((Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy)); /* 105 */
int (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 106 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
int (*xSetDashes) _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n)); /* 0 */
XModifierKeymap * (*xGetModifierMapping) _ANSI_ARGS_((Display *d)); /* 1 */
@@ -1084,11 +1084,11 @@ typedef struct TkIntXlibStubs {
int (*xDefineCursor) _ANSI_ARGS_((Display *d, Window w, Cursor c)); /* 20 */
void (*xDestroyWindow) _ANSI_ARGS_((Display *d, Window w)); /* 21 */
void (*xDrawArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 22 */
- void (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 23 */
+ int (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 23 */
void (*xDrawRectangle) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 24 */
void (*xFillArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 25 */
void (*xFillPolygon) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3)); /* 26 */
- void (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 27 */
+ int (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 27 */
void (*xFreeColormap) _ANSI_ARGS_((Display *d, Colormap c)); /* 28 */
void (*xFreeColors) _ANSI_ARGS_((Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul)); /* 29 */
void (*xFreeModifiermap) _ANSI_ARGS_((XModifierKeymap *x)); /* 30 */
@@ -1153,7 +1153,7 @@ typedef struct TkIntXlibStubs {
void (*xQueryColors) _ANSI_ARGS_((Display *display, Colormap colormap, XColor *defs_in_out, int ncolors)); /* 89 */
Status (*xQueryTree) _ANSI_ARGS_((Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui)); /* 90 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
int (*xSetDashes) _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n)); /* 0 */
XModifierKeymap * (*xGetModifierMapping) _ANSI_ARGS_((Display *d)); /* 1 */
XImage * (*xCreateImage) _ANSI_ARGS_((Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4)); /* 2 */
@@ -1177,11 +1177,11 @@ typedef struct TkIntXlibStubs {
int (*xDefineCursor) _ANSI_ARGS_((Display *d, Window w, Cursor c)); /* 20 */
void (*xDestroyWindow) _ANSI_ARGS_((Display *d, Window w)); /* 21 */
void (*xDrawArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 22 */
- void (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 23 */
+ int (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 23 */
void (*xDrawRectangle) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 24 */
void (*xFillArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 25 */
void (*xFillPolygon) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3)); /* 26 */
- void (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 27 */
+ int (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 27 */
void (*xFreeColormap) _ANSI_ARGS_((Display *d, Colormap c)); /* 28 */
void (*xFreeColors) _ANSI_ARGS_((Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul)); /* 29 */
void (*xFreeModifiermap) _ANSI_ARGS_((XModifierKeymap *x)); /* 30 */
@@ -1246,7 +1246,7 @@ typedef struct TkIntXlibStubs {
void (*xQueryColors) _ANSI_ARGS_((Display *display, Colormap colormap, XColor *defs_in_out, int ncolors)); /* 89 */
Status (*xQueryTree) _ANSI_ARGS_((Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui)); /* 90 */
int (*xSync) _ANSI_ARGS_((Display *display, Bool flag)); /* 91 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
} TkIntXlibStubs;
#ifdef __cplusplus
@@ -1263,7 +1263,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
* Inline function declarations:
*/
-#if defined(__WIN32__) || defined(__CYGWIN__)
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
#ifndef XSetDashes
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
@@ -1689,7 +1689,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
#define XFillRectangle \
(tkIntXlibStubsPtr->xFillRectangle) /* 106 */
#endif
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
#ifndef XSetDashes
#define XSetDashes \
@@ -2056,7 +2056,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xQueryTree) /* 90 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef XSetDashes
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
@@ -2425,7 +2425,7 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
#define XSync \
(tkIntXlibStubsPtr->xSync) /* 91 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 65a42a6..f400c05 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -28,6 +28,7 @@
#endif
#ifdef __WIN32__
#include "tkWinInt.h"
+#include "../win/tclWinPort.h"
#endif
#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
@@ -55,7 +56,45 @@ static Tcl_ThreadDataKey dataKey;
* 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
#if !defined(MAC_TCL)
extern int isatty _ANSI_ARGS_((int fd));
#else
@@ -106,9 +145,6 @@ Tk_MainEx(argc, argv, appInitProc, interp)
Tcl_Channel inChannel, outChannel;
Tcl_DString appName;
ThreadSpecificData *tsdPtr;
-#ifdef __WIN32__
- HANDLE handle;
-#endif
/*
* Ensure that we are getting the matching version of Tcl. This is
@@ -119,6 +155,27 @@ Tk_MainEx(argc, argv, appInitProc, interp)
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));
@@ -126,7 +183,12 @@ Tk_MainEx(argc, argv, appInitProc, interp)
tsdPtr->interp = interp;
Tcl_Preserve((ClientData) interp);
-#if ((defined(__WIN32__) && !defined(__CYGWIN__)) || defined(MAC_TCL))
+#if defined(__WIN32__) && !defined(STATIC_BUILD)
+ if (!tclStubsPtr->reserved9) {
+ /* Only initialize console when not running under cygwin */
+ Tk_InitConsoleChannels(interp);
+ }
+#elif defined(__WIN32__) || defined(MAC_TCL)
Tk_InitConsoleChannels(interp);
#endif
@@ -194,37 +256,8 @@ Tk_MainEx(argc, argv, appInitProc, interp)
* 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/tkPlatDecls.h b/generic/tkPlatDecls.h
index f9bce86..3d08790 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__) /* WIN */
/* 0 */
EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin,
HWND hwnd));
@@ -63,7 +45,7 @@ EXTERN void Tk_PointerEvent _ANSI_ARGS_((HWND hwnd, int x, int y));
EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((HWND hwnd,
UINT message, WPARAM wParam, LPARAM lParam,
LRESULT *result));
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
/* 0 */
EXTERN void Tk_MacSetEmbedHandler _ANSI_ARGS_((
@@ -96,7 +78,7 @@ EXTERN int TkMacHaveAppearance _ANSI_ARGS_((void));
/* 10 */
EXTERN GWorldPtr TkMacGetDrawablePort _ANSI_ARGS_((Drawable drawable));
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
EXTERN void Tk_MacOSXSetEmbedHandler _ANSI_ARGS_((
Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
@@ -129,28 +111,20 @@ EXTERN ControlRef TkMacOSXGetRootControl _ANSI_ARGS_((
EXTERN void Tk_MacOSXSetupTkNotifier _ANSI_ARGS_((void));
/* 10 */
EXTERN int Tk_MacOSXIsAppInFront _ANSI_ARGS_((void));
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
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__) /* WIN */
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 */
Tk_Window (*tk_HWNDToWindow) _ANSI_ARGS_((HWND hwnd)); /* 3 */
void (*tk_PointerEvent) _ANSI_ARGS_((HWND hwnd, int x, int y)); /* 4 */
int (*tk_TranslateWinEvent) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)); /* 5 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
void (*tk_MacSetEmbedHandler) _ANSI_ARGS_((Tk_MacEmbedRegisterWinProc *registerWinProcPtr, Tk_MacEmbedGetGrafPortProc *getPortProcPtr, Tk_MacEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacEmbedGetClipProc *getClipProc, Tk_MacEmbedGetOffsetInParentProc *getOffsetProc)); /* 0 */
void (*tk_MacTurnOffMenus) _ANSI_ARGS_((void)); /* 1 */
@@ -164,7 +138,7 @@ typedef struct TkPlatStubs {
int (*tkMacHaveAppearance) _ANSI_ARGS_((void)); /* 9 */
GWorldPtr (*tkMacGetDrawablePort) _ANSI_ARGS_((Drawable drawable)); /* 10 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
void (*tk_MacOSXSetEmbedHandler) _ANSI_ARGS_((Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)); /* 0 */
void (*tk_MacOSXTurnOffMenus) _ANSI_ARGS_((void)); /* 1 */
void (*tk_MacOSXTkOwnsCursor) _ANSI_ARGS_((int tkOwnsIt)); /* 2 */
@@ -176,7 +150,7 @@ typedef struct TkPlatStubs {
ControlRef (*tkMacOSXGetRootControl) _ANSI_ARGS_((Drawable drawable)); /* 8 */
void (*tk_MacOSXSetupTkNotifier) _ANSI_ARGS_((void)); /* 9 */
int (*tk_MacOSXIsAppInFront) _ANSI_ARGS_((void)); /* 10 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
} TkPlatStubs;
#ifdef __cplusplus
@@ -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__) /* WIN */
#ifndef Tk_AttachHWND
#define Tk_AttachHWND \
(tkPlatStubsPtr->tk_AttachHWND) /* 0 */
@@ -244,7 +192,7 @@ extern TkPlatStubs *tkPlatStubsPtr;
#define Tk_TranslateWinEvent \
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
#ifndef Tk_MacSetEmbedHandler
#define Tk_MacSetEmbedHandler \
@@ -291,7 +239,7 @@ extern TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tkMacGetDrawablePort) /* 10 */
#endif
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
#ifndef Tk_MacOSXSetEmbedHandler
#define Tk_MacOSXSetEmbedHandler \
(tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
@@ -336,7 +284,7 @@ extern TkPlatStubs *tkPlatStubsPtr;
#define Tk_MacOSXIsAppInFront \
(tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */
#endif
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index d4f7d79..adaf319 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -37,35 +37,41 @@
#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 TkClipBox
-#undef TkCreateRegion
-#undef TkDestroyRegion
-#undef TkIntersectRegion
-#undef TkRectInRegion
-#undef TkSetRegion
-#undef TkUnionRectWithRegion
-#undef TkSubtractRegion
-#undef TkPutImage
+# undef TkpCmapStressed
+# undef TkpSync
-#ifndef __WIN32__
-/*
- * Make sure that extensions which call XParseColor through the stub
- * table, call TkParseColor instead. [Bug 3486474]
- */
-# define XParseColor TkParseColor
+# define TkCreateXEventSource (void (*) (void)) 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 (*) (TkDisplay *)) doNothing
+# define TkSendCleanup (void (*) (TkDisplay *)) doNothing
+
+#else /* !__WIN32__ */
+
+# 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
@@ -75,21 +81,34 @@
# define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion
# define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion
-# ifdef __CYGWIN__
-# define TkPutImage TkIntXlibPutImage
-# define Tk_GetHINSTANCE TkPlatGetHINSTANCE
-# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
-
/*
- * 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__
+
+ /*
+ * 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 *);
TkIntStubs tkIntStubs;
-static void *Tk_GetHINSTANCE()
+void *Tk_GetHINSTANCE()
{
void *hInstance = NULL;
@@ -97,22 +116,63 @@ static void *Tk_GetHINSTANCE()
(const char *) &tkIntStubs, &hInstance);
return hInstance;
}
-static void TkPutImage(unsigned long *colors, int ncolors, Display *display,
- Drawable d, GC gc, XImage *image, int destx, int desty,
- int srcx, int srcy, unsigned int width, unsigned int height)
+
+void
+TkSetPixmapColormap(pixmap, colormap)
+ Pixmap pixmap;
+ Colormap colormap;
+{
+}
+
+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. */
{
- XPutImage(display, d, gc, image, destx, desty, srcx, srcy, width, height);
+ 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
+ /* 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__ */
/*
@@ -250,40 +310,40 @@ TkIntStubs tkIntStubs = {
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
NULL, /* 121 */
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
NULL, /* 121 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
TkpCreateNativeBitmap, /* 121 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
TkpCreateNativeBitmap, /* 121 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
NULL, /* 122 */
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
NULL, /* 122 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
TkpDefineNativeBitmaps, /* 122 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
TkpDefineNativeBitmaps, /* 122 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
NULL, /* 123 */
#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
NULL, /* 124 */
#endif /* UNIX */
-#ifdef __WIN32__
+#if defined(__WIN32__) /* WIN */
NULL, /* 124 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
TkpGetNativeAppBitmap, /* 124 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
TkpGetNativeAppBitmap, /* 124 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
NULL, /* 125 */
NULL, /* 126 */
NULL, /* 127 */
@@ -317,7 +377,7 @@ TkIntStubs tkIntStubs = {
TkIntPlatStubs tkIntPlatStubs = {
TCL_STUB_MAGIC,
NULL,
-#ifdef __WIN32__
+#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
TkAlignImageData, /* 0 */
NULL, /* 1 */
TkGenerateActivateEvents, /* 2 */
@@ -354,7 +414,16 @@ TkIntPlatStubs tkIntPlatStubs = {
TkWinGetPlatformId, /* 33 */
TkWinSetHINSTANCE, /* 34 */
TkWinGetPlatformTheme, /* 35 */
-#endif /* __WIN32__ */
+ TkWinChildProc, /* 36 */
+ TkCreateXEventSource, /* 37 */
+ TkpCmapStressed, /* 38 */
+ TkpSync, /* 39 */
+ TkUnixContainerId, /* 40 */
+ TkUnixDoOneXEvent, /* 41 */
+ TkUnixSetMenubar, /* 42 */
+ TkWmCleanup, /* 43 */
+ TkSendCleanup, /* 44 */
+#endif /* WIN */
#ifdef MAC_TCL
TkGenerateActivateEvents, /* 0 */
NULL, /* 1 */
@@ -424,7 +493,7 @@ TkIntPlatStubs tkIntPlatStubs = {
TkMacPreprocessMenu, /* 65 */
TkpIsWindowFloating, /* 66 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
TkGenerateActivateEvents, /* 0 */
NULL, /* 1 */
NULL, /* 2 */
@@ -479,8 +548,8 @@ TkIntPlatStubs tkIntPlatStubs = {
TkGenWMDestroyEvent, /* 51 */
NULL, /* 52 */
TkpGetMS, /* 53 */
-#endif /* MAC_OSX_TK */
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
+#endif /* AQUA */
+#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */
TkCreateXEventSource, /* 0 */
TkFreeWindowId, /* 1 */
TkInitXId, /* 2 */
@@ -500,7 +569,7 @@ TkIntPlatStubs tkIntPlatStubs = {
TkIntXlibStubs tkIntXlibStubs = {
TCL_STUB_MAGIC,
NULL,
-#if defined(__WIN32__) || defined(__CYGWIN__)
+#if defined(__WIN32__) /* WIN */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -608,7 +677,7 @@ TkIntXlibStubs tkIntXlibStubs = {
XDrawLine, /* 104 */
XWarpPointer, /* 105 */
XFillRectangle, /* 106 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
@@ -702,7 +771,7 @@ TkIntXlibStubs tkIntXlibStubs = {
XQueryColors, /* 89 */
XQueryTree, /* 90 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -795,28 +864,20 @@ TkIntXlibStubs tkIntXlibStubs = {
XQueryColors, /* 89 */
XQueryTree, /* 90 */
XSync, /* 91 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
};
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__) /* WIN */
Tk_AttachHWND, /* 0 */
Tk_GetHINSTANCE, /* 1 */
Tk_GetHWND, /* 2 */
Tk_HWNDToWindow, /* 3 */
Tk_PointerEvent, /* 4 */
Tk_TranslateWinEvent, /* 5 */
-#endif /* __WIN32__ */
+#endif /* WIN */
#ifdef MAC_TCL
Tk_MacSetEmbedHandler, /* 0 */
Tk_MacTurnOffMenus, /* 1 */
@@ -830,7 +891,7 @@ TkPlatStubs tkPlatStubs = {
TkMacHaveAppearance, /* 9 */
TkMacGetDrawablePort, /* 10 */
#endif /* MAC_TCL */
-#ifdef MAC_OSX_TK
+#ifdef MAC_OSX_TK /* AQUA */
Tk_MacOSXSetEmbedHandler, /* 0 */
Tk_MacOSXTurnOffMenus, /* 1 */
Tk_MacOSXTkOwnsCursor, /* 2 */
@@ -842,7 +903,7 @@ TkPlatStubs tkPlatStubs = {
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
-#endif /* MAC_OSX_TK */
+#endif /* AQUA */
};
static TkStubHooks tkStubHooks = {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 1e7ca88..cd5d90f 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 TK_NO_DOUBLE_BUFFERING
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 98b89db..21675d0 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -16,7 +16,9 @@
#include "tkPort.h"
#include "tkInt.h"
-#if !( defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#ifdef __WIN32__
+#include "tkWinInt.h"
+#elif !(defined(MAC_TCL) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif
@@ -852,9 +854,6 @@ TkCreateMainWindow(interp, screenName, baseName)
Tk_Window tkwin;
int dummy;
int isSafe;
-#ifdef __WIN32__
- int isWin32 = 0;
-#endif
Tcl_HashEntry *hPtr;
register TkMainInfo *mainPtr;
register TkWindow *winPtr;
@@ -862,14 +861,6 @@ TkCreateMainWindow(interp, screenName, baseName)
ClientData clientData;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-#ifdef __WIN32__
- 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
@@ -953,8 +944,9 @@ TkCreateMainWindow(interp, screenName, baseName)
if (cmdPtr->objProc == NULL) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
-#ifdef __WIN32__
- if (!isWin32 && (cmdPtr->flags & WINMACONLY)) {
+#if defined(__WIN32__) && !defined(STATIC_BUILD)
+ if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->reserved9) {
+ /* We are running on Cygwin, so don't use the win32 dialogs */
continue;
}
#endif
@@ -3209,9 +3201,7 @@ Initialize(interp)
Tcl_SetMainLoop(Tk_MainLoop);
}
-#ifdef Tk_InitStubs
#undef Tk_InitStubs
-#endif
Tk_InitStubs(interp, TK_VERSION, 1);