diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-29 15:23:25 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-29 15:23:25 (GMT) |
commit | f31f1c2e93ea262f57ff94c1a7434e70b7682eee (patch) | |
tree | 395ef36a3124aa88061682c8f522fe266d2fb73a | |
parent | 4d1fdf3835f593b08205dc077ce91f707fd5ed5c (diff) | |
parent | 6936dd4b22d7a07ccf86b62109d18fd643cf927c (diff) | |
download | tk-f31f1c2e93ea262f57ff94c1a7434e70b7682eee.zip tk-f31f1c2e93ea262f57ff94c1a7434e70b7682eee.tar.gz tk-f31f1c2e93ea262f57ff94c1a7434e70b7682eee.tar.bz2 |
merge core-8-4-branch
-rwxr-xr-x | ChangeLog | 35 | ||||
-rw-r--r-- | generic/tk.decls | 27 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 2 | ||||
-rw-r--r-- | generic/tkInt.decls | 38 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 48 | ||||
-rw-r--r-- | generic/tkIntPlatDecls.h | 103 | ||||
-rw-r--r-- | generic/tkIntXlibDecls.h | 42 | ||||
-rw-r--r-- | generic/tkMain.c | 103 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 76 | ||||
-rw-r--r-- | generic/tkStubInit.c | 213 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 2 | ||||
-rw-r--r-- | generic/tkWindow.c | 22 | ||||
-rw-r--r-- | mac/tkMacDraw.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 12 | ||||
-rw-r--r-- | unix/Makefile.in | 15 | ||||
-rw-r--r-- | unix/tkUnixPort.h | 38 | ||||
-rw-r--r-- | win/Makefile.in | 29 | ||||
-rw-r--r-- | win/tkWinDialog.c | 2 | ||||
-rwxr-xr-x | win/tkWinDraw.c | 4 | ||||
-rwxr-xr-x | win/tkWinInt.h | 3 | ||||
-rw-r--r-- | win/tkWinPort.h | 24 | ||||
-rw-r--r-- | win/tkWinWm.c | 288 | ||||
-rw-r--r-- | xlib/xdraw.c | 4 |
23 files changed, 683 insertions, 455 deletions
@@ -1,3 +1,38 @@ +2012-05-09 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tkInt.decls: Change XFillRectangle(s)/XDrawLines(s) signature + * generic/tkIntXlibDeclsDecls.h: to match Xorg, needed for Cygwin. + * xlib/xdraw.c: + * mac/tkMacDraw.c: + * macosx/tkMacOSXDraw.c: + * win/tkWinDraw.c: + * win/Makefile.in: Generate same pkgIndex.tcl file for win32 and + * unix/Makefile.in: cygwin, one that is equally useable for both. + +2012-05-25 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tkWindow.c: Simpify determination whether we are running on cygwin. + * generic/tkStubInit.c: Export Tk_GetHINSTANCE, TkSetPixmapColormap and + * generic/tkInt.decls: TkpPrintWindowId on the Cygwin dll, sync stub table + with Tk 8.6 win32 version. + * generic/tk*Decls.h: re-generated + * win/Makefile.in: Fix "make genstubs" when cross-compiling on UNIX + +2012-05-24 Jan Nijtmans <nijtmans@users.sf.net> + + * win/stubs.c: Change XSetCommand signature to match Xorg, + * win/tkWinWm.c: needed for Cygwin. + * generic/tkInt.decls + * generic/tk*Decls.h: re-generated + +2012-05-09 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tkWinWm.c: Change TkpWmSetState signature to match Xorg, + * generic/tkInt.decls: needed for Cygwin. (not needed for Mac) + * generic/tkIntPlatDeclsDecls.h: + * generic/tkWindow.c: Don't check for cygwin in win32 static build. + * unix/tkUnixPort.h: Some more useful #defines for Cygwin + 2012-05-05 Jan Nijtmans <nijtmans@users.sf.net> * library/menu.tcl: [Bug 2768586]: Only do menu correction on Windows < Win7 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); diff --git a/mac/tkMacDraw.c b/mac/tkMacDraw.c index ddf23d2..720dd71 100644 --- a/mac/tkMacDraw.c +++ b/mac/tkMacDraw.c @@ -399,7 +399,7 @@ TkPutImage( *---------------------------------------------------------------------- */ -void +int XFillRectangles( Display* display, /* Display. */ Drawable d, /* Draw on this. */ @@ -433,6 +433,7 @@ XFillRectangles( } SetGWorld(saveWorld, saveDevice); + return 1; } /* @@ -451,7 +452,7 @@ XFillRectangles( *---------------------------------------------------------------------- */ -void +int XDrawLines( Display* display, /* Display. */ Drawable d, /* Draw on this. */ @@ -470,7 +471,7 @@ XDrawLines( display->request++; if (npoints < 2) { - return; /* TODO: generate BadValue error. */ + return 0; /* TODO: generate BadValue error. */ } GetGWorld(&saveWorld, &saveDevice); SetGWorld(destPort, NULL); @@ -495,6 +496,7 @@ XDrawLines( } SetGWorld(saveWorld, saveDevice); + return 1; } /* diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 63e26a1..6805f28 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -550,7 +550,7 @@ TkPutImage( *---------------------------------------------------------------------- */ -void +int XDrawLines( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -568,12 +568,12 @@ XDrawLines( * TODO: generate BadValue error. */ - return; + return 0; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) { - return; + return 0; } if (dc.context) { double prevx, prevy; @@ -614,6 +614,7 @@ XDrawLines( } } TkMacOSXRestoreDrawingContext(&dc); + return 1; } /* @@ -902,7 +903,7 @@ XDrawRectangles( *---------------------------------------------------------------------- */ -void +int XFillRectangles( Display* display, /* Display. */ Drawable d, /* Draw on this. */ @@ -917,7 +918,7 @@ XFillRectangles( display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) { - return; + return 0; } if (dc.context) { CGRect rect; @@ -944,6 +945,7 @@ XFillRectangles( } } TkMacOSXRestoreDrawingContext(&dc); + return 1; } /* diff --git a/unix/Makefile.in b/unix/Makefile.in index 8a3856b..80dd6a0 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -633,15 +633,16 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish (\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\ - echo "if {[string match CYGWIN* \$$::tcl_platform(os)]} {";\ - echo " if {([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\ - echo " } else {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\ - echo " }";\ + if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ + echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + else \ + echo "if {(\$$::tcl_platform(platform) eq \"unix\")";\ + echo " && ([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\ echo "} else {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\ echo "}";\ + fi \ ) > $(PKG_INDEX); \ fi @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 8445c82..6e03287 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -125,6 +125,31 @@ # define NBBY 8 #endif +#ifdef __CYGWIN__ +# define UINT unsigned int +# define HWND void * +# define HDC void * +# define HINSTANCE void * +# define COLORREF void * +# define HMENU void * +# define TkWinDCState void +# define HPALETTE void * +# define WNDPROC void * +# define WPARAM void * +# define LPARAM void * +# define LRESULT void * +#endif /* This really should be an #else, as soon as the Xlib stubs are enabled for 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 */ + /* * These macros are just wrappers for the equivalent X Region calls. */ @@ -141,14 +166,7 @@ #define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \ (Region) src, (Region) ret) -/* - * The TkPutImage macro strips off the color table information, which isn't - * needed for X. - */ - -#define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \ - XPutImage(display, pixels, gc, image, destx, desty, srcx, \ - srcy, width, height); +/* #endif */ /* * Supply macros for seek offsets, if they're not already provided by @@ -180,7 +198,9 @@ #define TkpButtonSetDefaults(specPtr) {} #define TkpDestroyButton(butPtr) {} #define TkSelUpdateClipboard(a,b) {} +#ifndef __CYGWIN__ #define TkSetPixmapColormap(p,c) {} +#endif /* * These calls implement native bitmaps which are not supported under @@ -196,8 +216,10 @@ * This should perhaps use the real size of an XID. */ +#ifndef __CYGWIN__ #define TkpPrintWindowId(buf,w) \ sprintf((buf), "%#08lx", (unsigned long) (w)) +#endif /* * The following declaration is used to get access to a private Tcl interface diff --git a/win/Makefile.in b/win/Makefile.in index 9304b43..714b0e9 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -427,10 +427,13 @@ install-binaries: binaries @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ - echo "if {[package vcompare [package provide Tcl]\ - $(TCLVERSION)] != 0} { return }";\ - echo "package ifneeded Tk $(VERSION)\ - [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\ + echo "if {(\$$::tcl_platform(platform) eq \"unix\")";\ + echo " && ([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\ + echo " package ifneeded Tk $(VERSION) [list load [file join \$$dir .. .. bin libtk$(VERSION).dll] Tk]";\ + echo "} else {";\ + echo " package ifneeded Tk $(VERSION) [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo "}";\ ) > $(PKG_INDEX); @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ do \ @@ -642,7 +645,19 @@ $(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \ @echo "This warning can be safely ignored, do not report as a bug!" genstubs: - $(TCL_EXE) "$(TCL_TOOL_DIR}\genStubs.tcl" \ + $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ "$(GENERIC_DIR_NATIVE)" \ - "$(GENERIC_DIR_NATIVE)\tk.decls" \ - "$(GENERIC_DIR_NATIVE)\tkInt.decls" + "$(GENERIC_DIR_NATIVE)/tk.decls" \ + "$(GENERIC_DIR_NATIVE)/tkInt.decls" +# +# The list of all the targets that do not correspond to real files. This stops +# 'make' from getting confused when someone makes an error in a rule. +# + +.PHONY: all binaries libraries doc tkLibObjs objs tktest-real test test-classic +.PHONY: test-ttk testlang runtest shell demo gdb install install-strip +.PHONY: install-binaries install-libraries install-demos install-doc +.PHONY: install-private-headers clean distclean depend genstubs checkstubs +.PHONY: checkuchar checkexports rpm dist alldist allpatch html html-tcl html-tk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/win/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/tkWinDraw.c b/win/tkWinDraw.c index 9130e39..9bdeec1 100755 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -724,7 +724,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles) } DeleteObject(brush); TkWinReleaseDrawableDC(d, dc, &state); - return 0; + return 1; } /* @@ -899,7 +899,7 @@ XDrawLines(display, d, gc, points, npoints, mode) DeleteObject(pen); TkWinReleaseDrawableDC(d, dc, &state); - return 0; + return 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 diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 6b157cd..32768cf 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -19,6 +19,7 @@ /* * These next two defines are only valid on Win2K/XP+. */ + #ifndef WS_EX_LAYERED #define WS_EX_LAYERED 0x00080000 #endif @@ -68,6 +69,7 @@ typedef struct ProtocolHandler { /* * Helper type passed via lParam to TkWmStackorderToplevelEnumProc */ + typedef struct TkWmStackorderToplevelPair { Tcl_HashTable *table; TkWindow **window_ptr; @@ -94,16 +96,19 @@ typedef struct { * items. We will reallocate these structures according to * how many images they need to contain. */ + typedef struct { int nNumImages; /* How many images? */ ICONIMAGE IconImages[1]; /* Image entries */ } BlockOfIconImages, *BlockOfIconImagesPtr; + /* * These two structures are used to read in icons from an * 'icon directory' (i.e. the contents of a .icr file, say). * We only use these structures temporarily, since we copy * the information we want into a BlockOfIconImages. */ + typedef struct { BYTE bWidth; /* Width of the image */ BYTE bHeight; /* Height of the image (times 2) */ @@ -114,6 +119,7 @@ typedef struct { DWORD dwBytesInRes; /* how many bytes in this resource? */ DWORD dwImageOffset; /* where in the file is this image */ } ICONDIRENTRY, *LPICONDIRENTRY; + typedef struct { WORD idReserved; /* Reserved */ WORD idType; /* resource type (1 for icons) */ @@ -137,6 +143,7 @@ typedef struct { * Icons loaded from .icr/.icr use the iconBlock field, icons * loaded from .exe/.dll use the hIcon field. */ + typedef struct WinIconInstance { int refCount; /* Number of instances that share this * data structure. */ @@ -258,7 +265,7 @@ typedef struct TkWmInfo { ProtocolHandler *protPtr; /* First in list of protocol handlers for * this window (NULL means none). */ int cmdArgc; /* Number of elements in cmdArgv below. */ - CONST char **cmdArgv; /* Array of strings to store in the + const char **cmdArgv; /* Array of strings to store in the * WM_COMMAND property. NULL means nothing * available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE @@ -350,7 +357,7 @@ static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin); static Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ - (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */ + (Tk_GeomLostSlaveProc *) NULL /* lostSlaveProc */ }; typedef struct ThreadSpecificData { @@ -383,7 +390,7 @@ static Tcl_ThreadDataKey dataKey; static int initialized; /* Flag indicating whether module has * been initialized. */ -/* +/* * A pointer to a shell proc which allows us to extract icons from * any file. We just initialize this when we start up (if we can) * and then it never changes @@ -450,9 +457,9 @@ static WinIconPtr GetIconFromPixmap _ANSI_ARGS_((Display *dsPtr, Pixmap pixmap)); static int ReadICOHeader _ANSI_ARGS_((Tcl_Channel channel)); static BOOL AdjustIconImagePointers _ANSI_ARGS_((LPICONIMAGE lpImage)); -static HICON MakeIconOrCursorFromResource +static HICON MakeIconOrCursorFromResource _ANSI_ARGS_((LPICONIMAGE lpIcon, BOOL isIcon)); -static HICON GetIcon _ANSI_ARGS_((WinIconPtr titlebaricon, +static HICON GetIcon _ANSI_ARGS_((WinIconPtr titlebaricon, int icon_size)); static int WinSetIcon _ANSI_ARGS_((Tcl_Interp *interp, WinIconPtr titlebaricon, Tk_Window tkw)); @@ -461,100 +468,100 @@ static void DecrIconRefCount _ANSI_ARGS_((WinIconPtr titlebaricon)); static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmColormapwindowsCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmCommandCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmDeiconifyCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmFocusmodelCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmFrameCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmGeometryCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmGridCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmGroupCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconbitmapCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconifyCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconmaskCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconnameCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconphotoCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconpositionCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmIconwindowCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmMaxsizeCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmMinsizeCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmOverrideredirectCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmPositionfromCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmProtocolCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmResizableCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmSizefromCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmStackorderCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmStateCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmTitleCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmTransientCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); + Tcl_Obj *const objv[])); static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr, TkWindow *winPtr)); /* Used in BytesPerLine */ #define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2) - + /* *---------------------------------------------------------------------- * @@ -573,7 +580,8 @@ static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr, * *---------------------------------------------------------------------- */ -static WORD + +static WORD DIBNumColors( LPSTR lpbi ) { WORD wBitCount; @@ -612,7 +620,7 @@ DIBNumColors( LPSTR lpbi ) * *---------------------------------------------------------------------- */ -static WORD +static WORD PaletteSize( LPSTR lpbi ) { return ((WORD)( DIBNumColors( lpbi ) * sizeof( RGBQUAD )) ); @@ -635,7 +643,7 @@ PaletteSize( LPSTR lpbi ) * *---------------------------------------------------------------------- */ -static LPSTR +static LPSTR FindDIBBits( LPSTR lpbi ) { return ( lpbi + *(LPDWORD)lpbi + PaletteSize( lpbi ) ); @@ -658,7 +666,7 @@ FindDIBBits( LPSTR lpbi ) * *---------------------------------------------------------------------- */ -static DWORD +static DWORD BytesPerLine( LPBITMAPINFOHEADER lpBMIH ) { return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount); @@ -681,7 +689,7 @@ BytesPerLine( LPBITMAPINFOHEADER lpBMIH ) * *---------------------------------------------------------------------- */ -static BOOL +static BOOL AdjustIconImagePointers( LPICONIMAGE lpImage ) { /* Sanity check */ @@ -691,13 +699,13 @@ AdjustIconImagePointers( LPICONIMAGE lpImage ) lpImage->lpbi = (LPBITMAPINFO)lpImage->lpBits; /* Width - simple enough */ lpImage->Width = lpImage->lpbi->bmiHeader.biWidth; - /* - * Icons are stored in funky format where height is doubled - * so account for that + /* + * Icons are stored in funky format where height is doubled + * so account for that */ lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2; /* How many colors? */ - lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes * + lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes * lpImage->lpbi->bmiHeader.biBitCount; /* XOR bits follow the header and color table */ lpImage->lpXOR = (LPBYTE)FindDIBBits(((LPSTR)lpImage->lpbi)); @@ -723,7 +731,8 @@ AdjustIconImagePointers( LPICONIMAGE lpImage ) * *---------------------------------------------------------------------- */ -static HICON + +static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) { HICON hIcon ; static FARPROC pfnCreateIconFromResourceEx=NULL; @@ -734,10 +743,10 @@ MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) { if (lpIcon->lpBits == NULL) return NULL; if (!initinfo) { - HMODULE hMod = GetModuleHandleA("USER32.DLL"); + HMODULE hMod = GetModuleHandle("USER32.DLL"); initinfo=1; if (hMod){ - pfnCreateIconFromResourceEx = + pfnCreateIconFromResourceEx = GetProcAddress(hMod, "CreateIconFromResourceEx"); } } @@ -754,7 +763,7 @@ MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) { if (hIcon == NULL) { /* We would break on NT if we try with a 16bpp image */ if (lpIcon->lpbi->bmiHeader.biBitCount != 16) { - hIcon = CreateIconFromResource(lpIcon->lpBits, lpIcon->dwNumBytes, + hIcon = CreateIconFromResource(lpIcon->lpBits, lpIcon->dwNumBytes, isIcon, 0x00030000); } } @@ -778,7 +787,7 @@ MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon) { * *---------------------------------------------------------------------- */ -static int +static int ReadICOHeader( Tcl_Channel channel ) { WORD Input; @@ -824,10 +833,11 @@ ReadICOHeader( Tcl_Channel channel ) * *---------------------------------------------------------------------- */ -static int + +static int InitWindowClass(WinIconPtr titlebaricon) { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (! tsdPtr->initialized) { @@ -843,17 +853,17 @@ InitWindowClass(WinIconPtr titlebaricon) initialized = 1; if (shgetfileinfoProc == NULL) { - HINSTANCE hInstance = LoadLibraryA("shell32"); + HINSTANCE hInstance = LoadLibrary("shell32"); if (hInstance != NULL) { - shgetfileinfoProc = + shgetfileinfoProc = (DWORD* (WINAPI *) (LPCTSTR pszPath, DWORD dwFileAttributes, - SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags)) GetProcAddress(hInstance, + SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags)) GetProcAddress(hInstance, "SHGetFileInfo"); FreeLibrary(hInstance); } } if (setLayeredWindowAttributesProc == NULL) { - HINSTANCE hInstance = LoadLibraryA("user32"); + HINSTANCE hInstance = LoadLibrary("user32"); if (hInstance != NULL) { setLayeredWindowAttributesProc = (BOOL (WINAPI *) (HWND hwnd, COLORREF crKey, @@ -915,6 +925,7 @@ InitWindowClass(WinIconPtr titlebaricon) * *---------------------------------------------------------------------- */ + static void InitWm(void) { @@ -949,6 +960,7 @@ InitWm(void) * *---------------------------------------------------------------------- */ + static int WinSetIcon(interp, titlebaricon, tkw) Tcl_Interp *interp; @@ -1109,7 +1121,7 @@ TkWinGetIcon(Tk_Window tkwin, DWORD iconsize) { WmInfo *wmPtr; HICON icon; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->iconPtr != NULL) { @@ -1167,7 +1179,7 @@ TkWinGetIcon(Tk_Window tkwin, DWORD iconsize) * icon assigned to the given file and use that. If both of those * fail, then NULL is returned, and an error message will already be * in the interpreter. - * + * * Results: * A WinIconPtr structure containing the icons in the file, with * its ref count already incremented. The calling procedure should @@ -1194,6 +1206,7 @@ TkWinGetIcon(Tk_Window tkwin, DWORD iconsize) * *---------------------------------------------------------------------- */ + static WinIconPtr ReadIconFromFile(interp, fileName) Tcl_Interp *interp; @@ -1219,7 +1232,7 @@ ReadIconFromFile(interp, fileName) SHFILEINFO sfiSM; Tcl_DString ds, ds2; DWORD *res; - CONST char *file; + const char *file; file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds); if (file == NULL) { return NULL; } @@ -1289,7 +1302,7 @@ ReadIconFromFile(interp, fileName) * calling procedure should either place this structure inside a * WmInfo structure, or it should pass it on to DecrIconRefCount() * to ensure no memory leaks occur. - * + * * If the given pixmap did not contain a valid icon structure, * return NULL. * @@ -1298,7 +1311,7 @@ ReadIconFromFile(interp, fileName) * it contains. If the structure is not wanted, it should be * passed to DecrIconRefCount, and in any case a valid ref count * should be ensured to avoid memory leaks. - * + * * Currently icon resources are not shared, so the ref count of * one of these structures will always be 0 or 1. However all we * need do is implement some sort of lookup function between @@ -1307,18 +1320,19 @@ ReadIconFromFile(interp, fileName) * *---------------------------------------------------------------------- */ -static WinIconPtr + +static WinIconPtr GetIconFromPixmap(dsPtr, pixmap) Display *dsPtr; Pixmap pixmap; { WinIconPtr titlebaricon = NULL; TkWinDrawable* twdPtr = (TkWinDrawable*) pixmap; - + if (twdPtr == NULL) { return NULL; } - + if (0 /* If we already have an icon for this pixmap */) { titlebaricon = NULL; /* Get the real value from a lookup */ titlebaricon->refCount++; @@ -1383,7 +1397,8 @@ GetIconFromPixmap(dsPtr, pixmap) * *---------------------------------------------------------------------- */ -static void + +static void DecrIconRefCount(WinIconPtr titlebaricon) { titlebaricon->refCount--; @@ -1414,7 +1429,8 @@ DecrIconRefCount(WinIconPtr titlebaricon) { * *---------------------------------------------------------------------- */ -static void + +static void FreeIconBlock(BlockOfIconImagesPtr lpIR) { int i; @@ -1446,11 +1462,12 @@ FreeIconBlock(BlockOfIconImagesPtr lpIR) * *---------------------------------------------------------------------- */ -static HICON + +static HICON GetIcon(WinIconPtr titlebaricon, int icon_size) { BlockOfIconImagesPtr lpIR; - + if (titlebaricon == NULL) { return NULL; } @@ -1471,8 +1488,8 @@ GetIcon(WinIconPtr titlebaricon, int icon_size) } } - /* - * If we get here, then just return the first one, + /* + * If we get here, then just return the first one, * it will have to do! */ if (lpIR->nNumImages >= 1) { @@ -1499,7 +1516,8 @@ GetIcon(WinIconPtr titlebaricon, int icon_size) * *---------------------------------------------------------------------- */ -static BlockOfIconImagesPtr + +static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) { BlockOfIconImagesPtr lpIR, lpNew; @@ -1511,8 +1529,8 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) /* Open the file */ channel = Tcl_FSOpenFileChannel(interp, fileName, "r", 0); if (channel == NULL) { - Tcl_AppendResult(interp,"Error opening file \"", - Tcl_GetString(fileName), + Tcl_AppendResult(interp,"Error opening file \"", + Tcl_GetString(fileName), "\" for reading",(char*)NULL); return NULL; } @@ -1541,7 +1559,7 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) return NULL; } /* Adjust the size of the struct to account for the images */ - lpNew = (BlockOfIconImagesPtr) ckrealloc((char*)lpIR, + lpNew = (BlockOfIconImagesPtr) ckrealloc((char*)lpIR, sizeof(BlockOfIconImages) + ((lpIR->nNumImages-1) * sizeof(ICONIMAGE))); if (lpNew == NULL) { Tcl_AppendResult(interp,"Error allocating memory",(char*)NULL); @@ -1559,7 +1577,7 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) return NULL; } /* Read in the icon directory entries */ - dwBytesRead = Tcl_Read(channel, (char*)lpIDE, + dwBytesRead = Tcl_Read(channel, (char*)lpIDE, lpIR->nNumImages * sizeof( ICONDIRENTRY )); if (dwBytesRead != lpIR->nNumImages * sizeof( ICONDIRENTRY )) { Tcl_AppendResult(interp,"Error reading file",(char*)NULL); @@ -1586,7 +1604,7 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) goto readError; } /* Read it in */ - dwBytesRead = Tcl_Read(channel, (char *) lpIR->IconImages[i].lpBits, + dwBytesRead = Tcl_Read(channel, (char *) lpIR->IconImages[i].lpBits, lpIDE[i].dwBytesInRes); if (dwBytesRead != lpIDE[i].dwBytesInRes) { Tcl_AppendResult(interp,"Error reading file",(char*)NULL); @@ -1638,6 +1656,7 @@ ReadIconOrCursorFromFile(Tcl_Interp* interp, Tcl_Obj* fileName, BOOL isIcon) * *---------------------------------------------------------------------- */ + static TkWindow * GetTopLevel(hwnd) HWND hwnd; @@ -2358,22 +2377,21 @@ TkpWmSetState(winPtr, state) if (wmPtr->flags & WM_NEVER_MAPPED) { wmPtr->hints.initial_state = state; - return 1; - } - - wmPtr->flags |= WM_SYNC_PENDING; - if (state == WithdrawnState) { - cmd = SW_HIDE; - } else if (state == IconicState) { - cmd = SW_SHOWMINNOACTIVE; - } else if (state == NormalState) { - cmd = SW_SHOWNOACTIVATE; - } else if (state == ZoomState) { - cmd = SW_SHOWMAXIMIZED; + } else { + wmPtr->flags |= WM_SYNC_PENDING; + if (state == WithdrawnState) { + cmd = SW_HIDE; + } else if (state == IconicState) { + cmd = SW_SHOWMINNOACTIVE; + } else if (state == NormalState) { + cmd = SW_SHOWNOACTIVATE; + } else if (state == ZoomState) { + cmd = SW_SHOWMAXIMIZED; + } + + ShowWindow(wmPtr->wrapper, cmd); + wmPtr->flags &= ~WM_SYNC_PENDING; } - - ShowWindow(wmPtr->wrapper, cmd); - wmPtr->flags &= ~WM_SYNC_PENDING; return 1; } @@ -2581,10 +2599,10 @@ Tk_WmObjCmd(clientData, interp, objc, objv) * interpreter. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { Tk_Window tkwin = (Tk_Window) clientData; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "frame", "geometry", "grid", "group", "iconbitmap", @@ -2749,7 +2767,7 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; @@ -2818,7 +2836,7 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr; @@ -3061,7 +3079,7 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -3132,7 +3150,7 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList; @@ -3226,12 +3244,12 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; int cmdArgc; - CONST char **cmdArgv; + const char **cmdArgv; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3266,7 +3284,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv) wmPtr->cmdArgc = cmdArgc; wmPtr->cmdArgv = cmdArgv; if (!(wmPtr->flags & WM_NEVER_MAPPED)) { - XSetCommand(winPtr->display, winPtr->window, (char **)cmdArgv, cmdArgc); + XSetCommand(winPtr->display, winPtr->window, (char **) cmdArgv, cmdArgc); } return TCL_OK; } @@ -3294,7 +3312,7 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -3380,10 +3398,10 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "active", "passive", (char *) NULL }; enum options { OPT_ACTIVE, OPT_PASSIVE }; @@ -3434,7 +3452,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; @@ -3479,7 +3497,7 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; @@ -3542,7 +3560,7 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; @@ -3631,7 +3649,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; @@ -3694,7 +3712,7 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ @@ -3817,7 +3835,7 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { @@ -3872,7 +3890,7 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; @@ -3930,7 +3948,7 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -3983,7 +4001,7 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ Tk_PhotoHandle photo; @@ -4097,7 +4115,7 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; @@ -4153,7 +4171,7 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; @@ -4261,7 +4279,7 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -4311,7 +4329,7 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -4362,7 +4380,7 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; @@ -4420,10 +4438,10 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "program", "user", (char *) NULL }; enum options { OPT_PROGRAM, OPT_USER }; @@ -4483,7 +4501,7 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; @@ -4574,7 +4592,7 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -4637,10 +4655,10 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "program", "user", (char *) NULL }; enum options { OPT_PROGRAM, OPT_USER }; @@ -4701,10 +4719,10 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { TkWindow **windows, **window_ptr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "isabove", "isbelow", (char *) NULL }; enum options { OPT_ISABOVE, OPT_ISBELOW }; @@ -4818,10 +4836,10 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "normal", "iconic", "withdrawn", "zoomed", (char *) NULL }; enum options { OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; @@ -4927,7 +4945,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -4984,7 +5002,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr; @@ -5110,7 +5128,7 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv) TkWindow *winPtr; /* Toplevel to work with */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ + Tcl_Obj *const objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -6100,7 +6118,7 @@ TkWmProtocolEventProc(winPtr, eventPtr) * Cache atom name, as we might destroy the window as a * result of the eval. */ - CONST char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol); + const char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol); Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; @@ -7716,3 +7734,11 @@ TkWinSetForegroundWindow(winPtr) SetForegroundWindow(Tk_GetHWND(winPtr->window)); } } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/xlib/xdraw.c b/xlib/xdraw.c index 6c405ad..46eee3e 100644 --- a/xlib/xdraw.c +++ b/xlib/xdraw.c @@ -41,7 +41,7 @@ XDrawLine(display, d, gc, x1, y1, x2, y2) points[0].y = y1; points[1].x = x2; points[1].y = y2; - XDrawLines(display, d, gc, points, 2, CoordModeOrigin); + return XDrawLines(display, d, gc, points, 2, CoordModeOrigin); return 0; } @@ -77,6 +77,6 @@ XFillRectangle(display, d, gc, x, y, width, height) rectangle.y = y; rectangle.width = width; rectangle.height = height; - XFillRectangles(display, d, gc, &rectangle, 1); + return XFillRectangles(display, d, gc, &rectangle, 1); return 0; } |