summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-31 09:30:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-31 09:30:22 (GMT)
commit0ad4cbd7bd60324dc875c7d8f472096589c2b024 (patch)
tree3ab0f8a9d922f9c36c5579ff2ee94478091498c8 /generic
parenta2b7afd83359a8b5149462e93b174ca5784d1e1a (diff)
downloadtk-0ad4cbd7bd60324dc875c7d8f472096589c2b024.zip
tk-0ad4cbd7bd60324dc875c7d8f472096589c2b024.tar.gz
tk-0ad4cbd7bd60324dc875c7d8f472096589c2b024.tar.bz2
Implement XFlush and various others for win32 as stubs, so win32 extensions using those can run under CYGWIN as well.
Allow tk86.dll to cooperate with the cygwin console.
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h2
-rw-r--r--generic/tkInt.decls25
-rw-r--r--generic/tkIntXlibDecls.h57
-rw-r--r--generic/tkMain.c10
-rw-r--r--generic/tkStubInit.c12
5 files changed, 98 insertions, 8 deletions
diff --git a/generic/tk.h b/generic/tk.h
index a9b96e3..a44cfa8 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -1471,7 +1471,7 @@ typedef struct Tk_ElementSpec {
#define Tk_Release Tcl_Release
/* Removed Tk_Main, use macro instead */
-#ifdef _WIN32
+#if defined(__WIN32__) || defined(__CYGWIN__)
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \
(Tcl_FindExecutable(0), (Tcl_CreateInterp)()))
#else
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 66a11c6..6709493 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1412,6 +1412,31 @@ declare 105 win {
void XWarpPointer(Display *d, Window s, Window dw, int sx, int sy,
unsigned int sw, unsigned int sh, int dx, int dy)
}
+# New in Tk 8.6
+declare 107 win {
+ int XFlush(Display *display)
+}
+declare 108 win {
+ int XGrabServer(Display *display)
+}
+declare 109 win {
+ int XUngrabServer(Display *display)
+}
+declare 110 win {
+ int XFree(void *data)
+}
+declare 111 win {
+ int XNoOp(Display *display)
+}
+declare 112 win {
+ int XSynchronize(Display *display, Bool onoff)
+}
+declare 113 win {
+ int XSync(Display *display, Bool discard)
+}
+declare 114 win {
+ VisualID XVisualIDFromVisual(Visual *visual)
+}
################################
# X functions for Aqua
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index bd899bf..a613cf1 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -36,7 +36,7 @@
* Exported function declarations:
*/
-#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
+#if defined(__WIN32__) /* WIN */
/* 0 */
EXTERN void XSetDashes(Display *display, GC gc, int dash_offset,
_Xconst char *dash_list, int n);
@@ -332,6 +332,22 @@ EXTERN void XWarpPointer(Display *d, Window s, Window dw, int sx,
EXTERN void XFillRectangle(Display *display, Drawable d, GC gc,
int x, int y, unsigned int width,
unsigned int height);
+/* 107 */
+EXTERN int XFlush(Display *display);
+/* 108 */
+EXTERN int XGrabServer(Display *display);
+/* 109 */
+EXTERN int XUngrabServer(Display *display);
+/* 110 */
+EXTERN int XFree(void *data);
+/* 111 */
+EXTERN int XNoOp(Display *display);
+/* 112 */
+EXTERN int XSynchronize(Display *display, Bool onoff);
+/* 113 */
+EXTERN int XSync(Display *display, Bool discard);
+/* 114 */
+EXTERN VisualID XVisualIDFromVisual(Visual *visual);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
@@ -602,7 +618,7 @@ typedef struct TkIntXlibStubs {
int magic;
const struct TkIntXlibStubHooks *hooks;
-#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
+#if defined(__WIN32__) /* WIN */
void (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */
XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */
@@ -710,6 +726,14 @@ typedef struct TkIntXlibStubs {
void (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 104 */
void (*xWarpPointer) (Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy); /* 105 */
void (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 106 */
+ int (*xFlush) (Display *display); /* 107 */
+ int (*xGrabServer) (Display *display); /* 108 */
+ int (*xUngrabServer) (Display *display); /* 109 */
+ int (*xFree) (void *data); /* 110 */
+ int (*xNoOp) (Display *display); /* 111 */
+ int (*xSynchronize) (Display *display, Bool onoff); /* 112 */
+ int (*xSync) (Display *display, Bool discard); /* 113 */
+ VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
void (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -821,7 +845,7 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
* Inline function declarations:
*/
-#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
+#if defined(__WIN32__) /* WIN */
#define XSetDashes \
(tkIntXlibStubsPtr->xSetDashes) /* 0 */
#define XGetModifierMapping \
@@ -1035,6 +1059,22 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xWarpPointer) /* 105 */
#define XFillRectangle \
(tkIntXlibStubsPtr->xFillRectangle) /* 106 */
+#define XFlush \
+ (tkIntXlibStubsPtr->xFlush) /* 107 */
+#define XGrabServer \
+ (tkIntXlibStubsPtr->xGrabServer) /* 108 */
+#define XUngrabServer \
+ (tkIntXlibStubsPtr->xUngrabServer) /* 109 */
+#define XFree \
+ (tkIntXlibStubsPtr->xFree) /* 110 */
+#define XNoOp \
+ (tkIntXlibStubsPtr->xNoOp) /* 111 */
+#define XSynchronize \
+ (tkIntXlibStubsPtr->xSynchronize) /* 112 */
+#define XSync \
+ (tkIntXlibStubsPtr->xSync) /* 113 */
+#define XVisualIDFromVisual \
+ (tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#define XSetDashes \
@@ -1230,4 +1270,15 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#if !(defined(__WIN32__) || defined(__CYGWIN__))
+/*
+ * The TkPutImage macro strips off the color table information, which isn't
+ * needed for X.
+ */
+
+#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
+ XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
+ desty, width, height);
+#endif
+
#endif /* _TKINTXLIBDECLS */
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 4932d36..03e74b0 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -53,6 +53,7 @@
* to strcmp here.
*/
#ifdef __WIN32__
+# include "tclInt.h"
# include "tkWinInt.h"
#else
# define TCHAR char
@@ -92,10 +93,11 @@
* it will conflict with a declaration elsewhere on some systems.
*/
-#if 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
@@ -103,6 +105,12 @@ static int WinIsTty(int fd) {
* 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 it's a bad or closed handle, then it's been connected to a wish
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index de5e00e..13ab403 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -80,8 +80,6 @@ TkpSync(Display *display)
#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
-TkIntStubs tkIntStubs;
-
void *Tk_GetHINSTANCE()
{
void *hInstance = NULL;
@@ -580,7 +578,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
static const TkIntXlibStubs tkIntXlibStubs = {
TCL_STUB_MAGIC,
0,
-#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
+#if defined(__WIN32__) /* WIN */
XSetDashes, /* 0 */
XGetModifierMapping, /* 1 */
XCreateImage, /* 2 */
@@ -688,6 +686,14 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XDrawLine, /* 104 */
XWarpPointer, /* 105 */
XFillRectangle, /* 106 */
+ XFlush, /* 107 */
+ XGrabServer, /* 108 */
+ XUngrabServer, /* 109 */
+ XFree, /* 110 */
+ XNoOp, /* 111 */
+ XSynchronize, /* 112 */
+ XSync, /* 113 */
+ XVisualIDFromVisual, /* 114 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */