From f6b9aa40d70f1d9a0402cbeb02445ef4a778b0e5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 9 May 2012 20:54:06 +0000 Subject: Change TkpWmSetState signature to match UNIX, needed for Cygwin Don't check for cygwin in win32 static build Some more useful #defines for Cygwin FossilOrigin-Name: 6024bffd608ba21d35cbe4fe4da47a6e1e84cd7f --- ChangeLog | 8 ++ generic/tkInt.decls | 2 +- generic/tkIntPlatDecls.h | 4 +- generic/tkWindow.c | 6 +- unix/tkUnixPort.h | 15 +++ win/tkWinWm.c | 289 ++++++++++++++++++++++++++--------------------- 6 files changed, 187 insertions(+), 137 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2823b44..38e1af5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-05-09 Jan Nijtmans + + * win/tkWinWm.c: Change TkpWmSetState signature to match UNIX, + * 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 * library/menu.tcl: [Bug 2768586]: Only do menu correction on Windows < Win7 diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 3453f88..3de82d7 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -568,7 +568,7 @@ declare 8 win { void TkpSetCursor(TkpCursor cursor) } declare 9 win { - void TkpWmSetState(TkWindow *winPtr, int state) + int TkpWmSetState(TkWindow *winPtr, int state) } declare 10 win { void TkSetPixmapColormap(Pixmap pixmap, Colormap colormap) diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index b59ab19..e9f4256 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -53,7 +53,7 @@ EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow *winPtr)); /* 8 */ EXTERN void TkpSetCursor _ANSI_ARGS_((TkpCursor cursor)); /* 9 */ -EXTERN void TkpWmSetState _ANSI_ARGS_((TkWindow *winPtr, +EXTERN int TkpWmSetState _ANSI_ARGS_((TkWindow *winPtr, int state)); /* 10 */ EXTERN void TkSetPixmapColormap _ANSI_ARGS_((Pixmap pixmap, @@ -433,7 +433,7 @@ typedef struct TkIntPlatStubs { int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *string, Window *idPtr)); /* 6 */ void (*tkpSetCapture) _ANSI_ARGS_((TkWindow *winPtr)); /* 7 */ void (*tkpSetCursor) _ANSI_ARGS_((TkpCursor cursor)); /* 8 */ - void (*tkpWmSetState) _ANSI_ARGS_((TkWindow *winPtr, int state)); /* 9 */ + int (*tkpWmSetState) _ANSI_ARGS_((TkWindow *winPtr, int state)); /* 9 */ void (*tkSetPixmapColormap) _ANSI_ARGS_((Pixmap pixmap, Colormap colormap)); /* 10 */ void (*tkWinCancelMouseTimer) _ANSI_ARGS_((void)); /* 11 */ void (*tkWinClipboardRender) _ANSI_ARGS_((TkDisplay *dispPtr, UINT format)); /* 12 */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 98b89db..67db10c 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -852,7 +852,7 @@ TkCreateMainWindow(interp, screenName, baseName) Tk_Window tkwin; int dummy; int isSafe; -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(STATIC_BUILD) int isWin32 = 0; #endif Tcl_HashEntry *hPtr; @@ -862,7 +862,7 @@ TkCreateMainWindow(interp, screenName, baseName) ClientData clientData; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(STATIC_BUILD) Tcl_Obj *stringObjPtr = Tcl_GetVar2Ex(interp, "::tcl_platform", "platform", 0); if (stringObjPtr @@ -953,7 +953,7 @@ TkCreateMainWindow(interp, screenName, baseName) if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(STATIC_BUILD) if (!isWin32 && (cmdPtr->flags & WINMACONLY)) { continue; } diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 8445c82..f0affb8 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -150,6 +150,21 @@ XPutImage(display, pixels, gc, image, destx, desty, srcx, \ srcy, width, height); +#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 + /* * Supply macros for seek offsets, if they're not already provided by * an include file. diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 59287c8..ac4ea34 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; @@ -2347,7 +2366,7 @@ TkWmUnmapWindow(winPtr) *---------------------------------------------------------------------- */ -void +int TkpWmSetState(winPtr, state) TkWindow *winPtr; /* Toplevel window to operate on. */ int state; /* One of IconicState, ZoomState, NormalState, @@ -2358,22 +2377,22 @@ TkpWmSetState(winPtr, state) if (wmPtr->flags & WM_NEVER_MAPPED) { wmPtr->hints.initial_state = state; - return; - } - - 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; } /* @@ -2580,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", @@ -2748,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; @@ -2817,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; @@ -3060,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; @@ -3131,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; @@ -3225,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?"); @@ -3293,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; @@ -3379,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 }; @@ -3433,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; @@ -3478,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; @@ -3541,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; @@ -3630,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; @@ -3693,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) */ @@ -3816,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) { @@ -3871,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; @@ -3929,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; @@ -3982,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; @@ -4096,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; @@ -4152,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; @@ -4260,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; @@ -4310,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; @@ -4361,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; @@ -4419,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 }; @@ -4482,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; @@ -4573,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; @@ -4636,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 }; @@ -4700,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 }; @@ -4817,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 }; @@ -4926,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; @@ -4983,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; @@ -5109,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; @@ -6099,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; @@ -7715,3 +7734,11 @@ TkWinSetForegroundWindow(winPtr) SetForegroundWindow(Tk_GetHWND(winPtr->window)); } } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ -- cgit v0.12 From 4c2e9ac08b3332e2a53b28a352f24dc863be9873 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 13:34:36 +0000 Subject: implement TkSetPixmapColormap and TkpPrintWindowId for cygwin export TkWinChildProc for win32 backport TCHAR determination from tkWinPort.h FossilOrigin-Name: b8bf82483ca7c90eecc13f1845302764cfebb003 --- generic/tk.decls | 25 -------- generic/tkInt.decls | 42 ++++++++++++++ generic/tkIntPlatDecls.h | 100 ++++++++++++++++++++++++++++++-- generic/tkPlatDecls.h | 58 +------------------ generic/tkStubInit.c | 147 +++++++++++++++++++++++++++++++++++++---------- win/tkWinDialog.c | 2 +- win/tkWinInt.h | 3 - win/tkWinPort.h | 24 ++++++-- 8 files changed, 274 insertions(+), 127 deletions(-) diff --git a/generic/tk.decls b/generic/tk.decls index 2fae0b8..400c415 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1025,31 +1025,6 @@ declare 264 { interface tkPlat ################################ -# Unix specific functions -# - -declare 0 unix { - Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd) -} -declare 1 unix { - void *Tk_GetHINSTANCE(void) -} -declare 2 unix { - void *Tk_GetHWND(Window window) -} -declare 3 unix { - Tk_Window Tk_HWNDToWindow(void *hwnd) -} -declare 4 unix { - void Tk_PointerEvent(void *hwnd, int x, int y) -} -declare 5 unix { - int Tk_TranslateWinEvent(void *hwnd, - unsigned int message, int wParam, int lParam, int *result) -} - - -################################ # Windows specific functions declare 0 win { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 3de82d7..5338578 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -659,6 +659,48 @@ declare 35 win { int TkWinGetPlatformTheme(void) } +# Exported through stub table since Tk 8.4.20/8.5.9 + +declare 36 win { + LRESULT __stdcall TkWinChildProc(HWND hwnd, + UINT message, WPARAM wParam, LPARAM lParam) +} + +# new for 8.4.20+, Cygwin only +declare 37 win { + void TkCreateXEventSource(void) +} +declare 38 win { + void TkFreeWindowId(TkDisplay *dispPtr, Window w) +} +declare 39 win { + void TkInitXId(TkDisplay *dispPtr) +} +declare 40 win { + int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) +} +declare 41 win { + void TkpSync(Display *display) +} +declare 42 win { + Window TkUnixContainerId(TkWindow *winPtr) +} +declare 43 win { + int TkUnixDoOneXEvent(Tcl_Time *timePtr) +} +declare 44 win { + void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) +} +declare 45 win { + void TkWmCleanup(TkDisplay *dispPtr) +} +declare 46 win { + void TkSendCleanup(TkDisplay *dispPtr) +} +declare 47 win { + void TkFreeXId(TkDisplay *dispPtr) +} + ################################ # Mac specific functions diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index e9f4256..dd1e899 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -30,7 +30,7 @@ * Exported function declarations: */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* 0 */ EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); @@ -123,6 +123,34 @@ EXTERN int TkWinGetPlatformId _ANSI_ARGS_((void)); EXTERN void TkWinSetHINSTANCE _ANSI_ARGS_((HINSTANCE hInstance)); /* 35 */ EXTERN int TkWinGetPlatformTheme _ANSI_ARGS_((void)); +/* 36 */ +EXTERN LRESULT __stdcall TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam)); +/* 37 */ +EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); +/* 38 */ +EXTERN void TkFreeWindowId _ANSI_ARGS_((TkDisplay *dispPtr, + Window w)); +/* 39 */ +EXTERN void TkInitXId _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 40 */ +EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin, + Colormap colormap)); +/* 41 */ +EXTERN void TkpSync _ANSI_ARGS_((Display *display)); +/* 42 */ +EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow *winPtr)); +/* 43 */ +EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time *timePtr)); +/* 44 */ +EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, + Tk_Window menubar)); +/* 45 */ +EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 46 */ +EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); +/* 47 */ +EXTERN void TkFreeXId _ANSI_ARGS_((TkDisplay *dispPtr)); #endif /* __WIN32__ */ #ifdef MAC_TCL /* 0 */ @@ -385,7 +413,7 @@ EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin)); /* 53 */ EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void)); #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); /* 1 */ @@ -423,7 +451,7 @@ typedef struct TkIntPlatStubs { int magic; struct TkIntPlatStubHooks *hooks; -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) char * (*tkAlignImageData) _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); /* 0 */ VOID *reserved1; void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 2 */ @@ -460,6 +488,18 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */ void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */ int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */ + LRESULT __stdcall (*tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ + void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */ + void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 38 */ + void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 39 */ + int (*tkpCmapStressed) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 40 */ + void (*tkpSync) _ANSI_ARGS_((Display *display)); /* 41 */ + Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow *winPtr)); /* 42 */ + int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time *timePtr)); /* 43 */ + void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 44 */ + void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 45 */ + void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 46 */ + void (*tkFreeXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 47 */ #endif /* __WIN32__ */ #ifdef MAC_TCL void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 0 */ @@ -586,7 +626,7 @@ typedef struct TkIntPlatStubs { VOID *reserved52; unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 53 */ #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 0 */ void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 1 */ void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 2 */ @@ -617,7 +657,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; * Inline function declarations: */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) #ifndef TkAlignImageData #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ @@ -759,6 +799,54 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkWinGetPlatformTheme \ (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ #endif +#ifndef TkWinChildProc +#define TkWinChildProc \ + (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ +#endif +#ifndef TkCreateXEventSource +#define TkCreateXEventSource \ + (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */ +#endif +#ifndef TkFreeWindowId +#define TkFreeWindowId \ + (tkIntPlatStubsPtr->tkFreeWindowId) /* 38 */ +#endif +#ifndef TkInitXId +#define TkInitXId \ + (tkIntPlatStubsPtr->tkInitXId) /* 39 */ +#endif +#ifndef TkpCmapStressed +#define TkpCmapStressed \ + (tkIntPlatStubsPtr->tkpCmapStressed) /* 40 */ +#endif +#ifndef TkpSync +#define TkpSync \ + (tkIntPlatStubsPtr->tkpSync) /* 41 */ +#endif +#ifndef TkUnixContainerId +#define TkUnixContainerId \ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 42 */ +#endif +#ifndef TkUnixDoOneXEvent +#define TkUnixDoOneXEvent \ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 43 */ +#endif +#ifndef TkUnixSetMenubar +#define TkUnixSetMenubar \ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 44 */ +#endif +#ifndef TkWmCleanup +#define TkWmCleanup \ + (tkIntPlatStubsPtr->tkWmCleanup) /* 45 */ +#endif +#ifndef TkSendCleanup +#define TkSendCleanup \ + (tkIntPlatStubsPtr->tkSendCleanup) /* 46 */ +#endif +#ifndef TkFreeXId +#define TkFreeXId \ + (tkIntPlatStubsPtr->tkFreeXId) /* 47 */ +#endif #endif /* __WIN32__ */ #ifdef MAC_TCL #ifndef TkGenerateActivateEvents @@ -1164,7 +1252,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ #endif #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ #ifndef TkCreateXEventSource #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index f9bce86..cf1ec21 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -29,25 +29,7 @@ * Exported function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -/* 0 */ -EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, - VOID *hwnd)); -/* 1 */ -EXTERN VOID * Tk_GetHINSTANCE _ANSI_ARGS_((void)); -/* 2 */ -EXTERN VOID * Tk_GetHWND _ANSI_ARGS_((Window window)); -/* 3 */ -EXTERN Tk_Window Tk_HWNDToWindow _ANSI_ARGS_((VOID *hwnd)); -/* 4 */ -EXTERN void Tk_PointerEvent _ANSI_ARGS_((VOID *hwnd, int x, - int y)); -/* 5 */ -EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((VOID *hwnd, - unsigned int message, int wParam, int lParam, - int *result)); -#endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) /* 0 */ EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); @@ -135,15 +117,7 @@ typedef struct TkPlatStubs { int magic; struct TkPlatStubHooks *hooks; -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, VOID *hwnd)); /* 0 */ - VOID * (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ - VOID * (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */ - Tk_Window (*tk_HWNDToWindow) _ANSI_ARGS_((VOID *hwnd)); /* 3 */ - void (*tk_PointerEvent) _ANSI_ARGS_((VOID *hwnd, int x, int y)); /* 4 */ - int (*tk_TranslateWinEvent) _ANSI_ARGS_((VOID *hwnd, unsigned int message, int wParam, int lParam, int *result)); /* 5 */ -#endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ HWND (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */ @@ -193,33 +167,7 @@ extern TkPlatStubs *tkPlatStubsPtr; * Inline function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -#ifndef Tk_AttachHWND -#define Tk_AttachHWND \ - (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ -#endif -#ifndef Tk_GetHINSTANCE -#define Tk_GetHINSTANCE \ - (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ -#endif -#ifndef Tk_GetHWND -#define Tk_GetHWND \ - (tkPlatStubsPtr->tk_GetHWND) /* 2 */ -#endif -#ifndef Tk_HWNDToWindow -#define Tk_HWNDToWindow \ - (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ -#endif -#ifndef Tk_PointerEvent -#define Tk_PointerEvent \ - (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ -#endif -#ifndef Tk_TranslateWinEvent -#define Tk_TranslateWinEvent \ - (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ -#endif -#endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) #ifndef Tk_AttachHWND #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 22334bc..c533781 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -37,20 +37,52 @@ #include "tkIntPlatDecls.h" #include "tkIntXlibDecls.h" +#ifdef __WIN32__ + +static int +doNothing(void) +{ + /* dummy implementation, no need to do anything */ + return 0; +} + +/* + * Remove macros that will interfere with the definitions below. + */ +# undef TkFreeWindowId +# undef TkInitXId +# undef TkpCmapStressed +# undef TkpSync + +# define TkCreateXEventSource (void (*) ()) doNothing +# define TkFreeWindowId (void (*) _ANSI_ARGS_((TkDisplay *, Window))) doNothing +# define TkInitXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkpCmapStressed (int (*) _ANSI_ARGS_((Tk_Window, Colormap))) doNothing +# define TkpSync (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkUnixContainerId 0 +# define TkUnixDoOneXEvent 0 +# define TkUnixSetMenubar 0 +# define TkWmCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkSendCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkFreeXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing + +#else /* * Remove macros that will interfere with the definitions below. */ -#undef TkClipBox -#undef TkCreateRegion -#undef TkDestroyRegion -#undef TkIntersectRegion -#undef TkRectInRegion -#undef TkSetRegion -#undef TkUnionRectWithRegion -#undef TkSubtractRegion -#undef TkPutImage +# undef TkClipBox +# undef TkCreateRegion +# undef TkDestroyRegion +# undef TkIntersectRegion +# undef TkRectInRegion +# undef TkSetRegion +# undef TkUnionRectWithRegion +# undef TkSubtractRegion +# undef TkPutImage +# undef TkSetPixmapColormap +# undef TkpPrintWindowId +# undef TkWinChildProc 0 -#ifndef __WIN32__ /* * Make sure that extensions which call XParseColor through the stub * table, call TkParseColor instead. [Bug 3486474] @@ -76,14 +108,16 @@ # define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion # ifdef __CYGWIN__ -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +# define Tk_GetHINSTANCE TkPlatGetHINSTANCE +# define TkSetPixmapColormap TkPlatSetPixmapColormap +# define TkpPrintWindowId TkPlatpPrintWindowId /* * Trick, so we don't have to include here, which in any * case lacks this function anyway. */ +#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); TkIntStubs tkIntStubs; @@ -96,15 +130,62 @@ static void *Tk_GetHINSTANCE() (const char *) &tkIntStubs, &hInstance); return hInstance; } - /* TODO: To be implemented for Cygwin */ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 -# else /* !__CYGWIN__ */ -# define TkPutImage 0 +static void +TkSetPixmapColormap(pixmap, colormap) + Pixmap pixmap; + Colormap colormap; +{ +} + +static void +TkpPrintWindowId(buf, window) + char *buf; /* Pointer to string large enough to hold + * the hex representation of a pointer. */ + Window window; /* Window to be printed into buffer. */ +{ + sprintf(buf, "%#08lx", (unsigned long) (window)); +} + + /* TODO: To be implemented for Cygwin */ +# define Tk_AttachHWND 0 +# define Tk_GetHWND 0 +# define Tk_HWNDToWindow 0 +# define Tk_PointerEvent 0 +# define Tk_TranslateWinEvent 0 +# define TkAlignImageData 0 +# define TkGenerateActivateEvents 0 +# define TkpGetMS 0 +# define TkPointerDeadWindow 0 +# define TkpSetCapture 0 +# define TkpSetCursor 0 +# define TkWinCancelMouseTimer 0 +# define TkWinClipboardRender 0 +# define TkWinEmbeddedEventProc 0 +# define TkWinFillRect 0 +# define TkWinGetBorderPixels 0 +# define TkWinGetDrawableDC 0 +# define TkWinGetModifierState 0 +# define TkWinGetSystemPalette 0 +# define TkWinGetWrapperWindow 0 +# define TkWinHandleMenuEvent 0 +# define TkWinIndexOfColor 0 +# define TkWinReleaseDrawableDC 0 +# define TkWinResendEvent 0 +# define TkWinSelectPalette 0 +# define TkWinSetMenu 0 +# define TkWinSetWindowPos 0 +# define TkWinWmCleanup 0 +# define TkWinXCleanup 0 +# define TkWinXInit 0 +# define TkWinSetForegroundWindow 0 +# define TkWinDialogDebug 0 +# define TkWinGetMenuSystemDefault 0 +# define TkWinGetPlatformId 0 +# define TkWinSetHINSTANCE 0 +# define TkWinGetPlatformTheme 0 +# define TkWinChildProc 0 + # endif /* __CYGWIN__ */ # endif /* !MAC_TCL && !MACC_OSX_TCL */ #endif /* !__WIN32__ */ @@ -311,7 +392,7 @@ TkIntStubs tkIntStubs = { TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) TkAlignImageData, /* 0 */ NULL, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -348,6 +429,18 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformId, /* 33 */ TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ + TkWinChildProc, /* 36 */ + TkCreateXEventSource, /* 37 */ + TkFreeWindowId, /* 38 */ + TkInitXId, /* 39 */ + TkpCmapStressed, /* 40 */ + TkpSync, /* 41 */ + TkUnixContainerId, /* 42 */ + TkUnixDoOneXEvent, /* 43 */ + TkUnixSetMenubar, /* 44 */ + TkWmCleanup, /* 45 */ + TkSendCleanup, /* 46 */ + TkFreeXId, /* 47 */ #endif /* __WIN32__ */ #ifdef MAC_TCL TkGenerateActivateEvents, /* 0 */ @@ -474,7 +567,7 @@ TkIntPlatStubs tkIntPlatStubs = { NULL, /* 52 */ TkpGetMS, /* 53 */ #endif /* MAC_OSX_TK */ -#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ TkFreeWindowId, /* 1 */ TkInitXId, /* 2 */ @@ -795,15 +888,7 @@ TkIntXlibStubs tkIntXlibStubs = { TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, NULL, -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - Tk_AttachHWND, /* 0 */ - Tk_GetHINSTANCE, /* 1 */ - Tk_GetHWND, /* 2 */ - Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ -#endif /* UNIX */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__CYGWIN__) Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 775d06b..06f5a99 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2426,7 +2426,7 @@ ChooseDirectoryHookProc( * Directory must exist. Complain, then rehighlight text. */ - wsprintf(tmp, _T("Cannot change directory to \"%.200s\"."), + wsprintf(tmp, "Cannot change directory to \"%.200s\".", cdPtr->path); MessageBox(hwnd, tmp, NULL, MB_OK); SendDlgItemMessage(hwnd, edt10, EM_SETSEL, 0, -1); diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 7ab4ff4..a1c50fe 100755 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -154,9 +154,6 @@ extern CONST int tkpWinBltModes[]; #define TCL_STORAGE_CLASS DLLEXPORT #endif -EXTERN LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam)); - /* * Special proc needed as tsd accessor function between * tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard diff --git a/win/tkWinPort.h b/win/tkWinPort.h index f991195..77408dc 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -40,16 +40,28 @@ #endif #include -#ifdef __CYGWIN__ -# define _T(x) L##x -#else -# include -#endif #ifdef _MSC_VER -# define hypot _hypot +# ifndef hypot +# define hypot _hypot +# endif #endif /* _MSC_VER */ +/* + * Pull in the typedef of TCHAR for windows. + */ +#include +#ifndef _TCHAR_DEFINED + /* Borland seems to forget to set this. */ + typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED +#endif +#if defined(_MSC_VER) && defined(__STDC__) + /* VS2005 SP1 misses this. See [Bug #3110161] */ + typedef _TCHAR TCHAR; +#endif + + #ifndef __GNUC__ # define strncasecmp strnicmp # define strcasecmp stricmp -- cgit v0.12 From 980442509e5699b442e699743aa2b916d76b1286 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 13:56:01 +0000 Subject: typo FossilOrigin-Name: 1203fa3c9a75f23a74e95c558a8981d6bcc586f4 --- generic/tkStubInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index c533781..01bda9e 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -81,7 +81,7 @@ doNothing(void) # undef TkPutImage # undef TkSetPixmapColormap # undef TkpPrintWindowId -# undef TkWinChildProc 0 +# undef TkWinChildProc /* * Make sure that extensions which call XParseColor through the stub -- cgit v0.12 From 23b052e6e0e30539d958bd61e2f6a87dd3c2b982 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 May 2012 18:58:20 +0000 Subject: fix some visual studio warnings, eliminate some ANSI_ARGS FossilOrigin-Name: 81524cf1a198db3d15e4de70773ad1e9b3583058 --- generic/tkIntPlatDecls.h | 2 +- generic/tkStubInit.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index dd1e899..a2006d9 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -488,7 +488,7 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */ void (*tkWinSetHINSTANCE) _ANSI_ARGS_((HINSTANCE hInstance)); /* 34 */ int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */ - LRESULT __stdcall (*tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ + LRESULT (__stdcall *tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */ void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 38 */ void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 39 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 01bda9e..ffa8c2b 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -54,17 +54,17 @@ doNothing(void) # undef TkpCmapStressed # undef TkpSync -# define TkCreateXEventSource (void (*) ()) doNothing -# define TkFreeWindowId (void (*) _ANSI_ARGS_((TkDisplay *, Window))) doNothing -# define TkInitXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkpCmapStressed (int (*) _ANSI_ARGS_((Tk_Window, Colormap))) doNothing -# define TkpSync (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkCreateXEventSource (void (*) (void)) doNothing +# define TkFreeWindowId (void (*) (TkDisplay *, Window)) doNothing +# define TkInitXId (void (*) (TkDisplay *)) doNothing +# define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing +# define TkpSync (void (*) (Display *)) doNothing # define TkUnixContainerId 0 # define TkUnixDoOneXEvent 0 # define TkUnixSetMenubar 0 -# define TkWmCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkSendCleanup (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing -# define TkFreeXId (void (*) _ANSI_ARGS_((TkDisplay *))) doNothing +# define TkWmCleanup (void (*) (TkDisplay *)) doNothing +# define TkSendCleanup (void (*) (TkDisplay *)) doNothing +# define TkFreeXId (void (*) (TkDisplay *)) doNothing #else /* -- cgit v0.12 From 5228f1801569ac4b5a91362a71f20302b2f7b712 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 24 May 2012 20:59:46 +0000 Subject: Change XSetCommand signature to match Xorg, needed for Cygwin FossilOrigin-Name: 5522569059fa01225d7953422ea27439aaca231d --- ChangeLog | 9 ++++++++- generic/tkInt.decls | 2 +- generic/tkIntDecls.h | 48 ++++++++++++++++++++++++------------------------ generic/tkIntPlatDecls.h | 24 ++++++++++++------------ generic/tkIntXlibDecls.h | 28 ++++++++++++++-------------- generic/tkPlatDecls.h | 24 ++++++++++++------------ generic/tkStubInit.c | 48 ++++++++++++++++++++++++------------------------ win/stubs.c | 2 +- win/tkWinWm.c | 2 +- 9 files changed, 97 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38e1af5..75cbd42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ +2012-05-24 Jan Nijtmans + + * 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 - * win/tkWinWm.c: Change TkpWmSetState signature to match UNIX, + * 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. diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 5338578..61d5775 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1290,7 +1290,7 @@ declare 61 win { Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) } declare 62 win { - void XSetCommand(Display *d, Window w, const char **c, int i) + void XSetCommand(Display *d, Window w, char **c, int i) } declare 63 win { void XSetIconName(Display *d, Window w, _Xconst char *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 a2006d9..14a1f7d 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -30,7 +30,7 @@ * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage *image, int alignment, int bitOrder)); @@ -151,7 +151,7 @@ EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); /* 47 */ EXTERN void TkFreeXId _ANSI_ARGS_((TkDisplay *dispPtr)); -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL /* 0 */ EXTERN void TkGenerateActivateEvents _ANSI_ARGS_(( @@ -288,7 +288,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)); @@ -412,7 +412,7 @@ EXTERN void TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin)); /* Slot 52 is reserved */ /* 53 */ EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void)); -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ #if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); @@ -451,7 +451,7 @@ typedef struct TkIntPlatStubs { int magic; struct TkIntPlatStubHooks *hooks; -#if defined(__WIN32__) || defined(__CYGWIN__) +#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 */ @@ -500,7 +500,7 @@ typedef struct TkIntPlatStubs { void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 45 */ void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 46 */ void (*tkFreeXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 47 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow *winPtr, int active)); /* 0 */ VOID *reserved1; @@ -570,7 +570,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; @@ -625,7 +625,7 @@ typedef struct TkIntPlatStubs { void (*tkGenWMDestroyEvent) _ANSI_ARGS_((Tk_Window tkwin)); /* 51 */ VOID *reserved52; unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 53 */ -#endif /* MAC_OSX_TK */ +#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 */ @@ -657,7 +657,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef TkAlignImageData #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ @@ -847,7 +847,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkFreeXId \ (tkIntPlatStubsPtr->tkFreeXId) /* 47 */ #endif -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL #ifndef TkGenerateActivateEvents #define TkGenerateActivateEvents \ @@ -1058,7 +1058,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 */ @@ -1251,7 +1251,7 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkpGetMS \ (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ #endif -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ #if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ #ifndef TkCreateXEventSource #define TkCreateXEventSource \ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 77f6b4d..0ca0da4 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -36,7 +36,7 @@ * Exported function declarations: */ -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ /* 0 */ EXTERN void XSetDashes _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, @@ -229,7 +229,7 @@ EXTERN Status XSendEvent _ANSI_ARGS_((Display *d, Window w, Bool b, long l, XEvent *x)); /* 62 */ EXTERN void XSetCommand _ANSI_ARGS_((Display *d, Window w, - CONST char **c, int i)); + char **c, int i)); /* 63 */ EXTERN void XSetIconName _ANSI_ARGS_((Display *d, Window w, _Xconst char *c)); @@ -363,7 +363,7 @@ EXTERN void XWarpPointer _ANSI_ARGS_((Display *d, Window s, EXTERN void 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 void XSetDashes _ANSI_ARGS_((Display *display, GC gc, @@ -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 void XSetDashes _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, @@ -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; -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ void (*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 */ @@ -1014,7 +1014,7 @@ typedef struct TkIntXlibStubs { void (*xResizeWindow) _ANSI_ARGS_((Display *d, Window w, unsigned int ui1, unsigned int ui2)); /* 59 */ void (*xSelectInput) _ANSI_ARGS_((Display *d, Window w, long l)); /* 60 */ Status (*xSendEvent) _ANSI_ARGS_((Display *d, Window w, Bool b, long l, XEvent *x)); /* 61 */ - void (*xSetCommand) _ANSI_ARGS_((Display *d, Window w, CONST char **c, int i)); /* 62 */ + void (*xSetCommand) _ANSI_ARGS_((Display *d, Window w, char **c, int i)); /* 62 */ void (*xSetIconName) _ANSI_ARGS_((Display *d, Window w, _Xconst char *c)); /* 63 */ void (*xSetInputFocus) _ANSI_ARGS_((Display *d, Window w, int i, Time t)); /* 64 */ void (*xSetSelectionOwner) _ANSI_ARGS_((Display *d, Atom a, Window w, Time t)); /* 65 */ @@ -1059,7 +1059,7 @@ typedef struct TkIntXlibStubs { void (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 104 */ void (*xWarpPointer) _ANSI_ARGS_((Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy)); /* 105 */ void (*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 void (*xSetDashes) _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n)); /* 0 */ XModifierKeymap * (*xGetModifierMapping) _ANSI_ARGS_((Display *d)); /* 1 */ @@ -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 */ void (*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 */ @@ -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: */ -#ifdef __WIN32__ +#if defined(__WIN32__) /* 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/tkPlatDecls.h b/generic/tkPlatDecls.h index cf1ec21..3d08790 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -29,7 +29,7 @@ * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); @@ -45,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_(( @@ -78,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, @@ -111,20 +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(__CYGWIN__) +#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 */ @@ -138,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 */ @@ -150,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 @@ -167,7 +167,7 @@ extern TkPlatStubs *tkPlatStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef Tk_AttachHWND #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ @@ -192,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 \ @@ -239,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 */ @@ -284,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 ffa8c2b..e175a99 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -325,40 +325,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 */ @@ -392,7 +392,7 @@ TkIntStubs tkIntStubs = { TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ NULL, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -441,7 +441,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkWmCleanup, /* 45 */ TkSendCleanup, /* 46 */ TkFreeXId, /* 47 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL TkGenerateActivateEvents, /* 0 */ NULL, /* 1 */ @@ -511,7 +511,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 */ @@ -566,7 +566,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkGenWMDestroyEvent, /* 51 */ NULL, /* 52 */ TkpGetMS, /* 53 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ #if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ TkFreeWindowId, /* 1 */ @@ -587,7 +587,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, NULL, -#ifdef __WIN32__ +#if defined(__WIN32__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -695,7 +695,7 @@ TkIntXlibStubs tkIntXlibStubs = { XDrawLine, /* 104 */ XWarpPointer, /* 105 */ XFillRectangle, /* 106 */ -#endif /* __WIN32__ */ +#endif /* WIN */ #ifdef MAC_TCL XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ @@ -789,7 +789,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 */ @@ -882,20 +882,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(__CYGWIN__) +#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 */ @@ -909,7 +909,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 */ @@ -921,7 +921,7 @@ TkPlatStubs tkPlatStubs = { TkMacOSXGetRootControl, /* 8 */ Tk_MacOSXSetupTkNotifier, /* 9 */ Tk_MacOSXIsAppInFront, /* 10 */ -#endif /* MAC_OSX_TK */ +#endif /* AQUA */ }; static TkStubHooks tkStubHooks = { diff --git a/win/stubs.c b/win/stubs.c index 5fbc8d1..60d2dc8 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -253,7 +253,7 @@ void XSetCommand(display, w, argv, argc) Display* display; Window w; - CONST char** argv; + char** argv; int argc; { } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index ac4ea34..32768cf 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -3284,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, cmdArgv, cmdArgc); + XSetCommand(winPtr->display, winPtr->window, (char **) cmdArgv, cmdArgc); } return TCL_OK; } -- cgit v0.12 From b3c2ac38909466a3f130c650ff542029d443aabb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 25 May 2012 12:19:47 +0000 Subject: Simpify determination whether we are running on cygwin. Export Tk_GetHINSTANCE, TkSetPixmapColormap and TkpPrintWindowId on the Cygwin dll. Fix "make genstubs" when cross-compiling on UNIX FossilOrigin-Name: 09a6f0324fef2bead73be8c7594dd45cc63e8126 --- ChangeLog | 9 +++ generic/tkImgPhoto.c | 2 + generic/tkInt.decls | 24 ++----- generic/tkIntPlatDecls.h | 69 ++++++++----------- generic/tkMain.c | 105 ++++++++++++++++++---------- generic/tkStubInit.c | 174 +++++++++++++++++++++-------------------------- generic/tkTextDisp.c | 2 + generic/tkWindow.c | 20 ++---- unix/tkUnixPort.h | 53 ++++++++------- win/Makefile.in | 25 +++++-- 10 files changed, 251 insertions(+), 232 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75cbd42..0b7dcec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-05-25 Jan Nijtmans + + * 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 * win/stubs.c: Change XSetCommand signature to match Xorg, 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 61d5775..df2ad29 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -666,41 +666,31 @@ declare 36 win { UINT message, WPARAM wParam, LPARAM lParam) } -# new for 8.4.20+, Cygwin only +# new for 8.4.20+/8.5.12+, Cygwin only declare 37 win { void TkCreateXEventSource(void) } declare 38 win { - void TkFreeWindowId(TkDisplay *dispPtr, Window w) -} -declare 39 win { - void TkInitXId(TkDisplay *dispPtr) -} -declare 40 win { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } -declare 41 win { +declare 39 win { void TkpSync(Display *display) } -declare 42 win { +declare 40 win { Window TkUnixContainerId(TkWindow *winPtr) } -declare 43 win { +declare 41 win { int TkUnixDoOneXEvent(Tcl_Time *timePtr) } -declare 44 win { +declare 42 win { void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) } -declare 45 win { +declare 43 win { void TkWmCleanup(TkDisplay *dispPtr) } -declare 46 win { +declare 44 win { void TkSendCleanup(TkDisplay *dispPtr) } -declare 47 win { - void TkFreeXId(TkDisplay *dispPtr) -} - ################################ # Mac specific functions diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 14a1f7d..badb8b6 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -129,28 +129,21 @@ EXTERN LRESULT __stdcall TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, /* 37 */ EXTERN void TkCreateXEventSource _ANSI_ARGS_((void)); /* 38 */ -EXTERN void TkFreeWindowId _ANSI_ARGS_((TkDisplay *dispPtr, - Window w)); -/* 39 */ -EXTERN void TkInitXId _ANSI_ARGS_((TkDisplay *dispPtr)); -/* 40 */ EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); -/* 41 */ +/* 39 */ EXTERN void TkpSync _ANSI_ARGS_((Display *display)); -/* 42 */ +/* 40 */ EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow *winPtr)); -/* 43 */ +/* 41 */ EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time *timePtr)); -/* 44 */ +/* 42 */ EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); -/* 45 */ +/* 43 */ EXTERN void TkWmCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); -/* 46 */ +/* 44 */ EXTERN void TkSendCleanup _ANSI_ARGS_((TkDisplay *dispPtr)); -/* 47 */ -EXTERN void TkFreeXId _ANSI_ARGS_((TkDisplay *dispPtr)); #endif /* WIN */ #ifdef MAC_TCL /* 0 */ @@ -490,16 +483,13 @@ typedef struct TkIntPlatStubs { int (*tkWinGetPlatformTheme) _ANSI_ARGS_((void)); /* 35 */ LRESULT (__stdcall *tkWinChildProc) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); /* 36 */ void (*tkCreateXEventSource) _ANSI_ARGS_((void)); /* 37 */ - void (*tkFreeWindowId) _ANSI_ARGS_((TkDisplay *dispPtr, Window w)); /* 38 */ - void (*tkInitXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 39 */ - int (*tkpCmapStressed) _ANSI_ARGS_((Tk_Window tkwin, Colormap colormap)); /* 40 */ - void (*tkpSync) _ANSI_ARGS_((Display *display)); /* 41 */ - Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow *winPtr)); /* 42 */ - int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time *timePtr)); /* 43 */ - void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 44 */ - void (*tkWmCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 45 */ - void (*tkSendCleanup) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 46 */ - void (*tkFreeXId) _ANSI_ARGS_((TkDisplay *dispPtr)); /* 47 */ + 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 */ @@ -807,45 +797,33 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */ #endif -#ifndef TkFreeWindowId -#define TkFreeWindowId \ - (tkIntPlatStubsPtr->tkFreeWindowId) /* 38 */ -#endif -#ifndef TkInitXId -#define TkInitXId \ - (tkIntPlatStubsPtr->tkInitXId) /* 39 */ -#endif #ifndef TkpCmapStressed #define TkpCmapStressed \ - (tkIntPlatStubsPtr->tkpCmapStressed) /* 40 */ + (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ #endif #ifndef TkpSync #define TkpSync \ - (tkIntPlatStubsPtr->tkpSync) /* 41 */ + (tkIntPlatStubsPtr->tkpSync) /* 39 */ #endif #ifndef TkUnixContainerId #define TkUnixContainerId \ - (tkIntPlatStubsPtr->tkUnixContainerId) /* 42 */ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ #endif #ifndef TkUnixDoOneXEvent #define TkUnixDoOneXEvent \ - (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 43 */ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ #endif #ifndef TkUnixSetMenubar #define TkUnixSetMenubar \ - (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 44 */ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ #endif #ifndef TkWmCleanup #define TkWmCleanup \ - (tkIntPlatStubsPtr->tkWmCleanup) /* 45 */ + (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ #endif #ifndef TkSendCleanup #define TkSendCleanup \ - (tkIntPlatStubsPtr->tkSendCleanup) /* 46 */ -#endif -#ifndef TkFreeXId -#define TkFreeXId \ - (tkIntPlatStubsPtr->tkFreeXId) /* 47 */ + (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #endif #endif /* WIN */ #ifdef MAC_TCL @@ -1314,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/tkMain.c b/generic/tkMain.c index 65a42a6..af2448e 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 @@ -90,6 +129,8 @@ static void StdinProc _ANSI_ARGS_((ClientData clientData, * *---------------------------------------------------------------------- */ +int LoadCygwinTk(Tcl_Interp *interp); + void Tk_MainEx(argc, argv, appInitProc, interp) int argc; /* Number of arguments. */ @@ -106,9 +147,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 +157,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 +185,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 +258,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/tkStubInit.c b/generic/tkStubInit.c index e175a99..adaf319 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -49,14 +49,10 @@ doNothing(void) /* * Remove macros that will interfere with the definitions below. */ -# undef TkFreeWindowId -# undef TkInitXId # undef TkpCmapStressed # undef TkpSync -# define TkCreateXEventSource (void (*) (void)) doNothing -# define TkFreeWindowId (void (*) (TkDisplay *, Window)) doNothing -# define TkInitXId (void (*) (TkDisplay *)) doNothing +# define TkCreateXEventSource (void (*) (void)) doNothing # define TkpCmapStressed (int (*) (Tk_Window, Colormap)) doNothing # define TkpSync (void (*) (Display *)) doNothing # define TkUnixContainerId 0 @@ -64,40 +60,18 @@ doNothing(void) # define TkUnixSetMenubar 0 # define TkWmCleanup (void (*) (TkDisplay *)) doNothing # define TkSendCleanup (void (*) (TkDisplay *)) doNothing -# define TkFreeXId (void (*) (TkDisplay *)) doNothing -#else -/* - * Remove macros that will interfere with the definitions below. - */ -# undef TkClipBox -# undef TkCreateRegion -# undef TkDestroyRegion -# undef TkIntersectRegion -# undef TkRectInRegion -# undef TkSetRegion -# undef TkUnionRectWithRegion -# undef TkSubtractRegion -# undef TkPutImage -# undef TkSetPixmapColormap -# undef TkpPrintWindowId -# undef TkWinChildProc +#else /* !__WIN32__ */ -/* - * Make sure that extensions which call XParseColor through the stub - * table, call TkParseColor instead. [Bug 3486474] - */ -# define XParseColor TkParseColor +# 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 @@ -107,22 +81,34 @@ doNothing(void) # define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion # define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion -# ifdef __CYGWIN__ -# define Tk_GetHINSTANCE TkPlatGetHINSTANCE -# define TkSetPixmapColormap TkPlatSetPixmapColormap -# define TkpPrintWindowId TkPlatpPrintWindowId - /* - * Trick, so we don't have to include here, which in any - * case lacks this function anyway. + * 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 here, which in any + * case lacks this function anyway. + */ -#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +# 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; @@ -131,14 +117,14 @@ static void *Tk_GetHINSTANCE() return hInstance; } -static void +void TkSetPixmapColormap(pixmap, colormap) Pixmap pixmap; Colormap colormap; { } -static void +void TkpPrintWindowId(buf, window) char *buf; /* Pointer to string large enough to hold * the hex representation of a pointer. */ @@ -147,47 +133,46 @@ TkpPrintWindowId(buf, window) sprintf(buf, "%#08lx", (unsigned long) (window)); } - /* TODO: To be implemented for Cygwin */ -# define Tk_AttachHWND 0 -# define Tk_GetHWND 0 -# define Tk_HWNDToWindow 0 -# define Tk_PointerEvent 0 -# define Tk_TranslateWinEvent 0 -# define TkAlignImageData 0 -# define TkGenerateActivateEvents 0 -# define TkpGetMS 0 -# define TkPointerDeadWindow 0 -# define TkpSetCapture 0 -# define TkpSetCursor 0 -# define TkWinCancelMouseTimer 0 -# define TkWinClipboardRender 0 -# define TkWinEmbeddedEventProc 0 -# define TkWinFillRect 0 -# define TkWinGetBorderPixels 0 -# define TkWinGetDrawableDC 0 -# define TkWinGetModifierState 0 -# define TkWinGetSystemPalette 0 -# define TkWinGetWrapperWindow 0 -# define TkWinHandleMenuEvent 0 -# define TkWinIndexOfColor 0 -# define TkWinReleaseDrawableDC 0 -# define TkWinResendEvent 0 -# define TkWinSelectPalette 0 -# define TkWinSetMenu 0 -# define TkWinSetWindowPos 0 -# define TkWinWmCleanup 0 -# define TkWinXCleanup 0 -# define TkWinXInit 0 -# define TkWinSetForegroundWindow 0 -# define TkWinDialogDebug 0 -# define TkWinGetMenuSystemDefault 0 -# define TkWinGetPlatformId 0 -# define TkWinSetHINSTANCE 0 -# define TkWinGetPlatformTheme 0 -# define TkWinChildProc 0 + /* 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__ */ /* @@ -431,16 +416,13 @@ TkIntPlatStubs tkIntPlatStubs = { TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ TkCreateXEventSource, /* 37 */ - TkFreeWindowId, /* 38 */ - TkInitXId, /* 39 */ - TkpCmapStressed, /* 40 */ - TkpSync, /* 41 */ - TkUnixContainerId, /* 42 */ - TkUnixDoOneXEvent, /* 43 */ - TkUnixSetMenubar, /* 44 */ - TkWmCleanup, /* 45 */ - TkSendCleanup, /* 46 */ - TkFreeXId, /* 47 */ + TkpCmapStressed, /* 38 */ + TkpSync, /* 39 */ + TkUnixContainerId, /* 40 */ + TkUnixDoOneXEvent, /* 41 */ + TkUnixSetMenubar, /* 42 */ + TkWmCleanup, /* 43 */ + TkSendCleanup, /* 44 */ #endif /* WIN */ #ifdef MAC_TCL TkGenerateActivateEvents, /* 0 */ 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 67db10c..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; -#if defined(__WIN32__) && !defined(STATIC_BUILD) - 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)); -#if defined(__WIN32__) && !defined(STATIC_BUILD) - 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 @@ -954,7 +945,8 @@ TkCreateMainWindow(interp, screenName, baseName) Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } #if defined(__WIN32__) && !defined(STATIC_BUILD) - if (!isWin32 && (cmdPtr->flags & WINMACONLY)) { + 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/unix/tkUnixPort.h b/unix/tkUnixPort.h index f0affb8..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,29 +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); - -#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 +/* #endif */ /* * Supply macros for seek offsets, if they're not already provided by @@ -195,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 @@ -211,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..6612230 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -429,8 +429,13 @@ install-binaries: binaries @(\ echo "if {[package vcompare [package provide Tcl]\ $(TCLVERSION)] != 0} { return }";\ - echo "package ifneeded Tk $(VERSION)\ + echo "if {([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 +647,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. -- cgit v0.12 From 54074d88128fab0baea266c43a77bc6e9e8e2ca5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 May 2012 15:08:30 +0000 Subject: Change XFillRectangle(s)/XDrawLines(s) signature to match Xorg, needed for Cygwin. Generate same pkgIndex.tcl file for win32 and cygwin, one that is equally useable for both. FossilOrigin-Name: 4b760eba559b5980f9e68ce32bf28d04c06f1191 --- ChangeLog | 11 +++++++++++ generic/tk.decls | 2 +- generic/tkInt.decls | 18 +++++++++--------- generic/tkIntXlibDecls.h | 48 ++++++++++++++++++++++++------------------------ generic/tkMain.c | 2 -- mac/tkMacDraw.c | 8 +++++--- macosx/tkMacOSXDraw.c | 12 +++++++----- unix/Makefile.in | 15 ++++++++------- win/Makefile.in | 12 +++++------- win/tkWinDraw.c | 10 ++++++---- xlib/xdraw.c | 8 ++++---- 11 files changed, 80 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b7dcec..7577bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-05-09 Jan Nijtmans + + * 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 * generic/tkWindow.c: Simpify determination whether we are running on cygwin. diff --git a/generic/tk.decls b/generic/tk.decls index 400c415..f752151 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1057,7 +1057,7 @@ declare 0 mac { Tk_MacEmbedGetClipProc *getClipProc, Tk_MacEmbedGetOffsetInParentProc *getOffsetProc) } - + declare 1 mac { void Tk_MacTurnOffMenus(void) } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index df2ad29..3084743 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) @@ -1173,7 +1173,7 @@ declare 30 win { unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 31 win { - 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 32 win { void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, @@ -1188,7 +1188,7 @@ declare 34 win { int i1, int i2, int i3) } declare 35 win { - 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 36 win { void XForceScreenSaver(Display *d, int i) @@ -1422,11 +1422,11 @@ declare 103 win { XTextProperty *text_prop_return) } declare 104 win { - void XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, + int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2) } declare 106 win { - void XFillRectangle(Display *display, Drawable d, GC gc, + int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height) } declare 105 win { @@ -1519,7 +1519,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, @@ -1534,7 +1534,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) @@ -1721,11 +1721,11 @@ declare 81 {mac aqua} { void XForceScreenSaver(Display *display, int mode) } declare 82 {mac aqua} { - void XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, + int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2) } declare 83 {mac aqua} { - void XFillRectangle(Display *display, Drawable d, GC gc, + int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height) } declare 84 {mac aqua} { diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 0ca0da4..c3e5d6a 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -134,7 +134,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)); /* 31 */ -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)); /* 32 */ EXTERN void XDrawRectangle _ANSI_ARGS_((Display *d, Drawable dr, @@ -148,7 +148,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)); /* 35 */ -EXTERN void XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr, +EXTERN int XFillRectangles _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 36 */ EXTERN void XForceScreenSaver _ANSI_ARGS_((Display *d, int i)); @@ -353,14 +353,14 @@ EXTERN void XSetWMClientMachine _ANSI_ARGS_((Display *display, EXTERN Status XStringListToTextProperty _ANSI_ARGS_((char **list, int count, XTextProperty *text_prop_return)); /* 104 */ -EXTERN void XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, +EXTERN int XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 105 */ EXTERN void XWarpPointer _ANSI_ARGS_((Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy)); /* 106 */ -EXTERN void XFillRectangle _ANSI_ARGS_((Display *display, +EXTERN int XFillRectangle _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); #endif /* WIN */ @@ -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)); @@ -621,10 +621,10 @@ EXTERN void XDrawSegments _ANSI_ARGS_((Display *display, EXTERN void XForceScreenSaver _ANSI_ARGS_((Display *display, int mode)); /* 82 */ -EXTERN void XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, +EXTERN int XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 83 */ -EXTERN void XFillRectangle _ANSI_ARGS_((Display *display, +EXTERN int XFillRectangle _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 84 */ @@ -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)); @@ -911,10 +911,10 @@ EXTERN void XDrawSegments _ANSI_ARGS_((Display *display, EXTERN void XForceScreenSaver _ANSI_ARGS_((Display *display, int mode)); /* 82 */ -EXTERN void XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, +EXTERN int XDrawLine _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 83 */ -EXTERN void XFillRectangle _ANSI_ARGS_((Display *display, +EXTERN int XFillRectangle _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 84 */ @@ -983,11 +983,11 @@ typedef struct TkIntXlibStubs { void (*xDeleteProperty) _ANSI_ARGS_((Display *d, Window w, Atom a)); /* 28 */ void (*xDestroyWindow) _ANSI_ARGS_((Display *d, Window w)); /* 29 */ void (*xDrawArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 30 */ - void (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 31 */ + int (*xDrawLines) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2)); /* 31 */ void (*xDrawRectangle) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2)); /* 32 */ void (*xFillArc) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4)); /* 33 */ void (*xFillPolygon) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3)); /* 34 */ - void (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 35 */ + int (*xFillRectangles) _ANSI_ARGS_((Display *d, Drawable dr, GC g, XRectangle *x, int i)); /* 35 */ void (*xForceScreenSaver) _ANSI_ARGS_((Display *d, int i)); /* 36 */ void (*xFreeColormap) _ANSI_ARGS_((Display *d, Colormap c)); /* 37 */ void (*xFreeColors) _ANSI_ARGS_((Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul)); /* 38 */ @@ -1056,9 +1056,9 @@ typedef struct TkIntXlibStubs { 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 */ - void (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 104 */ + int (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 104 */ void (*xWarpPointer) _ANSI_ARGS_((Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy)); /* 105 */ - void (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 106 */ + int (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 106 */ #endif /* WIN */ #ifdef MAC_TCL void (*xSetDashes) _ANSI_ARGS_((Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n)); /* 0 */ @@ -1084,11 +1084,11 @@ typedef struct TkIntXlibStubs { void (*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 */ @@ -1143,8 +1143,8 @@ typedef struct TkIntXlibStubs { Status (*xStringListToTextProperty) _ANSI_ARGS_((char **list, int count, XTextProperty *text_prop_return)); /* 79 */ void (*xDrawSegments) _ANSI_ARGS_((Display *display, Drawable d, GC gc, XSegment *segments, int nsegments)); /* 80 */ void (*xForceScreenSaver) _ANSI_ARGS_((Display *display, int mode)); /* 81 */ - void (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */ - void (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */ + int (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */ + int (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */ void (*xClearWindow) _ANSI_ARGS_((Display *d, Window w)); /* 84 */ void (*xDrawPoint) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y)); /* 85 */ void (*xDrawPoints) _ANSI_ARGS_((Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode)); /* 86 */ @@ -1177,11 +1177,11 @@ typedef struct TkIntXlibStubs { void (*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 */ @@ -1236,8 +1236,8 @@ typedef struct TkIntXlibStubs { Status (*xStringListToTextProperty) _ANSI_ARGS_((char **list, int count, XTextProperty *text_prop_return)); /* 79 */ void (*xDrawSegments) _ANSI_ARGS_((Display *display, Drawable d, GC gc, XSegment *segments, int nsegments)); /* 80 */ void (*xForceScreenSaver) _ANSI_ARGS_((Display *display, int mode)); /* 81 */ - void (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */ - void (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */ + int (*xDrawLine) _ANSI_ARGS_((Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2)); /* 82 */ + int (*xFillRectangle) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height)); /* 83 */ void (*xClearWindow) _ANSI_ARGS_((Display *d, Window w)); /* 84 */ void (*xDrawPoint) _ANSI_ARGS_((Display *display, Drawable d, GC gc, int x, int y)); /* 85 */ void (*xDrawPoints) _ANSI_ARGS_((Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode)); /* 86 */ diff --git a/generic/tkMain.c b/generic/tkMain.c index af2448e..f400c05 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -129,8 +129,6 @@ static void StdinProc _ANSI_ARGS_((ClientData clientData, * *---------------------------------------------------------------------- */ -int LoadCygwinTk(Tcl_Interp *interp); - void Tk_MainEx(argc, argv, appInitProc, interp) int argc; /* Number of arguments. */ 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/win/Makefile.in b/win/Makefile.in index 6612230..714b0e9 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -427,14 +427,12 @@ install-binaries: binaries @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ - echo "if {[package vcompare [package provide Tcl]\ - $(TCLVERSION)] != 0} { return }";\ - echo "if {([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 "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 " 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); \ diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 805dde3..fea17d3 100755 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -620,7 +620,7 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x, *---------------------------------------------------------------------- */ -void +int XFillRectangles(display, d, gc, rectangles, nrectangles) Display* display; Drawable d; @@ -635,7 +635,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles) HBRUSH brush, oldBrush; if (d == None) { - return; + return 0; } dc = TkWinGetDrawableDC(display, d, &state); @@ -722,6 +722,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles) } DeleteObject(brush); TkWinReleaseDrawableDC(d, dc, &state); + return 1; } /* @@ -871,7 +872,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func) *---------------------------------------------------------------------- */ -void +int XDrawLines(display, d, gc, points, npoints, mode) Display* display; Drawable d; @@ -885,7 +886,7 @@ XDrawLines(display, d, gc, points, npoints, mode) HDC dc; if (d == None) { - return; + return 0; } dc = TkWinGetDrawableDC(display, d, &state); @@ -896,6 +897,7 @@ XDrawLines(display, d, gc, points, npoints, mode) DeleteObject(pen); TkWinReleaseDrawableDC(d, dc, &state); + return 1; } /* diff --git a/xlib/xdraw.c b/xlib/xdraw.c index 281a7e8..8ec924a 100644 --- a/xlib/xdraw.c +++ b/xlib/xdraw.c @@ -28,7 +28,7 @@ *---------------------------------------------------------------------- */ -void +int XDrawLine(display, d, gc, x1, y1, x2, y2) Display* display; Drawable d; @@ -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); } /* @@ -61,7 +61,7 @@ XDrawLine(display, d, gc, x1, y1, x2, y2) *---------------------------------------------------------------------- */ -void +int XFillRectangle(display, d, gc, x, y, width, height) Display* display; Drawable d; @@ -76,5 +76,5 @@ 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); } -- cgit v0.12