diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-24 07:56:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-24 07:56:41 (GMT) |
commit | bc56730d2abae5198c3667a55729e01684f3cb29 (patch) | |
tree | a67f18bf70f2081877ab48b4aecd142c54848262 /win/tkWinWm.c | |
parent | abbe37191732849b4d22072a8572f29205025457 (diff) | |
download | tk-bc56730d2abae5198c3667a55729e01684f3cb29.zip tk-bc56730d2abae5198c3667a55729e01684f3cb29.tar.gz tk-bc56730d2abae5198c3667a55729e01684f3cb29.tar.bz2 |
Replace all instances of Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar() with Tcl_UniCharToUtfDString()/Tcl_UtfToUniCharDString(), if possible (only for -DTCL_UTF_MAX=3, which is the default and only supported option)
Backported, as far as possible, from 8.7. This helps moving away from Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar(), even though it only becomes deprecated in 8.7.
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r-- | win/tkWinWm.c | 266 |
1 files changed, 147 insertions, 119 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index bddbe05..9307503 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -66,7 +66,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ - ((unsigned) ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)) + ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength) /* * Helper type passed via lParam to TkWmStackorderToplevelEnumProc @@ -856,7 +856,7 @@ static int InitWindowClass( WinIconPtr titlebaricon) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -1117,7 +1117,7 @@ TkWinGetIcon( { WmInfo *wmPtr; HICON icon; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->iconPtr != NULL) { @@ -1241,10 +1241,10 @@ ReadIconFromFile( if (file == NULL) { return NULL; } - Tcl_WinUtfToTChar(file, -1, &ds2); - Tcl_DStringFree(&ds); - res = (DWORD *)SHGetFileInfoW((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfiSM, + Tcl_DStringInit(&ds2); + res = (DWORD *)SHGetFileInfoW(Tcl_UtfToWCharDString(file, -1, &ds2), 0, &sfiSM, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON); + Tcl_DStringFree(&ds); if (res != 0) { SHFILEINFOW sfi; @@ -1260,7 +1260,7 @@ ReadIconFromFile( size = sizeof(BlockOfIconImages) + ((res != 0) ? sizeof(ICONIMAGE) : 0); - lpIR = ckalloc(size); + lpIR = (BlockOfIconImagesPtr)ckalloc(size); if (lpIR == NULL) { if (res != 0) { DestroyIcon(sfi.hIcon); @@ -1291,7 +1291,7 @@ ReadIconFromFile( Tcl_DStringFree(&ds2); } if (lpIR != NULL) { - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; } @@ -1367,7 +1367,7 @@ GetIconFromPixmap( return NULL; } - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); if (lpIR == NULL) { DestroyIcon(hIcon); return NULL; @@ -1388,7 +1388,7 @@ GetIconFromPixmap( lpIR->IconImages[0].lpXOR = 0; lpIR->IconImages[0].lpAND = 0; - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; return titlebaricon; @@ -1593,7 +1593,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource structure */ - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); /* * Read in the header @@ -1611,14 +1611,14 @@ ReadIconOrCursorFromFile( * Adjust the size of the struct to account for the images. */ - lpIR = ckrealloc(lpIR, sizeof(BlockOfIconImages) + lpIR = (BlockOfIconImagesPtr)ckrealloc(lpIR, sizeof(BlockOfIconImages) + (lpIR->nNumImages - 1) * sizeof(ICONIMAGE)); /* * Allocate enough memory for the icon directory entries. */ - lpIDE = ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); + lpIDE = (LPICONDIRENTRY)ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); /* * Read in the icon directory entries. @@ -1653,7 +1653,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource. */ - lpIR->IconImages[i].lpBits = ckalloc(lpIDE[i].dwBytesInRes); + lpIR->IconImages[i].lpBits = (LPBYTE)ckalloc(lpIDE[i].dwBytesInRes); lpIR->IconImages[i].dwNumBytes = lpIDE[i].dwBytesInRes; /* @@ -1732,7 +1732,7 @@ static TkWindow * GetTopLevel( HWND hwnd) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1769,7 +1769,7 @@ SetLimits( HWND hwnd, MINMAXINFO *info) { - register WmInfo *wmPtr; + WmInfo *wmPtr; int maxWidth, maxHeight; int minWidth, minHeight; int base; @@ -1874,7 +1874,7 @@ TkWinWmCleanup( } initialized = 0; - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { return; @@ -1905,7 +1905,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - register WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL @@ -1990,7 +1990,7 @@ static void UpdateWrapper( TkWindow *winPtr) /* Top-level window to redecorate. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; HWND parentHWND, oldWrapper = wmPtr->wrapper; HWND child, nextHWND, focusHWND; int x, y, width, height, state; @@ -1999,7 +1999,7 @@ UpdateWrapper( HICON hBigIcon = NULL; Tcl_DString titleString; int *childStateInfo = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window == None) { @@ -2121,7 +2121,8 @@ UpdateWrapper( */ tsdPtr->createWindow = winPtr; - Tcl_WinUtfToTChar(((wmPtr->title != NULL) ? + Tcl_DStringInit(&titleString); + Tcl_UtfToWCharDString(((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), -1, &titleString); wmPtr->wrapper = CreateWindowExW(wmPtr->exStyle, @@ -2208,7 +2209,7 @@ UpdateWrapper( WmInfo *wmPtr2; - childStateInfo = ckalloc(wmPtr->numTransients * sizeof(int)); + childStateInfo = (int *)ckalloc(wmPtr->numTransients * sizeof(int)); state = 0; for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { @@ -2354,8 +2355,8 @@ TkWmMapWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - ThreadSpecificData *tsdPtr = + WmInfo *wmPtr = winPtr->wmInfoPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -2580,7 +2581,7 @@ void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; WmInfo *wmPtr2; if (wmPtr == NULL) { @@ -2594,7 +2595,7 @@ TkWmDeadWindow( if (winPtr->dispPtr->firstWmPtr == wmPtr) { winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { - register WmInfo *prevPtr; + WmInfo *prevPtr; for (prevPtr = winPtr->dispPtr->firstWmPtr; ; prevPtr = prevPtr->nextPtr) { @@ -2741,6 +2742,8 @@ void TkWmSetClass( TkWindow *winPtr) /* Newly-created top-level window. */ { + (void)winPtr; + /* Do nothing */ return; } @@ -2762,7 +2765,6 @@ TkWmSetClass( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_WmObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -2770,7 +2772,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", @@ -2796,7 +2798,7 @@ Tk_WmObjCmd( WMOPT_WITHDRAW }; int index; - size_t length; + int length; const char *argv1; TkWindow *winPtr, **winPtrPtr = &winPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -2807,8 +2809,7 @@ Tk_WmObjCmd( return TCL_ERROR; } - argv1 = Tcl_GetString(objv[1]); - length = objv[1]->length; + argv1 = Tcl_GetStringFromObj(objv[1], &length); if ((argv1[0] == 't') && !strncmp(argv1, "tracing", length) && (length >= 3)) { int wmTracing; @@ -2951,8 +2952,9 @@ WmAspectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3021,11 +3023,11 @@ WmAttributesCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; int i, boolean; - size_t length; + int length; int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; @@ -3072,8 +3074,7 @@ WmAttributesCmd( return TCL_OK; } for (i = 3; i < objc; i += 2) { - string = Tcl_GetString(objv[i]); - length = objv[i]->length; + string = Tcl_GetStringFromObj(objv[i], &length); if ((length < 2) || (string[0] != '-')) { goto configArgs; } @@ -3141,9 +3142,8 @@ WmAttributesCmd( } wmPtr->alpha = dval; } else { /* -transparentcolor */ - const char *crefstr = Tcl_GetString(objv[i+1]); + const char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length); - length = objv[i+1]->length; if (length == 0) { /* reset to no transparent color */ if (wmPtr->crefObj) { @@ -3319,9 +3319,10 @@ WmClientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; - size_t length; + int length; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -3334,8 +3335,7 @@ WmClientCmd( } return TCL_OK; } - argv3 = Tcl_GetString(objv[3]); - length = objv[3]->length; + argv3 = Tcl_GetStringFromObj(objv[3], &length); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); @@ -3350,7 +3350,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); memcpy(wmPtr->clientMachine, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -3390,7 +3390,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2; int i, windowObjc, gotToplevel; Tcl_Obj **windowObjv, *resultObj; @@ -3417,7 +3417,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc + 1) * sizeof(TkWindow*)); + cmapList = (TkWindow**)ckalloc((windowObjc + 1) * sizeof(TkWindow*)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], @@ -3484,10 +3484,11 @@ WmCommandCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3553,7 +3554,8 @@ WmDeiconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3605,7 +3607,7 @@ WmFocusmodelCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; @@ -3613,6 +3615,7 @@ WmFocusmodelCmd( OPT_ACTIVE, OPT_PASSIVE }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -3657,11 +3660,15 @@ static int WmForgetCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *dummy, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + (void)tkwin; + (void)dummy; + (void)objc; + (void)objv; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3709,9 +3716,10 @@ WmFrameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3754,10 +3762,11 @@ WmGeometryCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -3822,8 +3831,9 @@ WmGridCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3920,10 +3930,10 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; const char *argv3; - size_t length; + int length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); @@ -3935,8 +3945,7 @@ WmGroupCmd( } return TCL_OK; } - argv3 = Tcl_GetString(objv[3]); - length = objv[3]->length; + argv3 = Tcl_GetStringFromObj(objv[3], &length); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; if (wmPtr->leaderName != NULL) { @@ -3953,7 +3962,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); memcpy(wmPtr->leaderName, argv3, length + 1); } return TCL_OK; @@ -3984,9 +3993,10 @@ WmIconbitmapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); @@ -4120,7 +4130,9 @@ WmIconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; @@ -4185,7 +4197,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -4243,9 +4255,10 @@ WmIconnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; - size_t length; + int length; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -4259,9 +4272,8 @@ WmIconnameCmd( if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } - argv3 = Tcl_GetString(objv[3]); - length = objv[3]->length; - wmPtr->iconName = ckalloc(length + 1); + argv3 = Tcl_GetStringFromObj(objv[3], &length); + wmPtr->iconName = (char *)ckalloc(length + 1); memcpy(wmPtr->iconName, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); @@ -4307,6 +4319,7 @@ WmIconphotoCmd( unsigned size; BITMAPINFO bmInfo; ICONINFO iconInfo; + (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4344,7 +4357,7 @@ WmIconphotoCmd( */ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); - lpIR = attemptckalloc(size); + lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } @@ -4449,7 +4462,7 @@ WmIconphotoCmd( lpIR->IconImages[i-startObj].hIcon = hIcon; } - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr) != TCL_OK) { @@ -4488,8 +4501,9 @@ WmIconpositionCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -4544,7 +4558,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; @@ -4654,8 +4668,11 @@ WmManageCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + (void)objc; + (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4708,8 +4725,9 @@ WmMaxsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4759,8 +4777,9 @@ WmMinsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4810,9 +4829,10 @@ WmOverrideredirectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -4882,7 +4902,7 @@ WmPositionfromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; @@ -4890,6 +4910,7 @@ WmPositionfromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -4950,12 +4971,13 @@ WmProtocolCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; - size_t cmdLength; + int cmdLength; Tcl_Obj *resultObj; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -5009,10 +5031,9 @@ WmProtocolCmd( break; } } - cmd = Tcl_GetString(objv[4]); - cmdLength = objv[4]->length; + cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -5047,8 +5068,9 @@ WmResizableCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -5109,7 +5131,7 @@ WmSizefromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; @@ -5117,6 +5139,7 @@ WmSizefromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -5306,7 +5329,7 @@ WmStateCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", "zoomed", NULL }; @@ -5314,6 +5337,7 @@ WmStateCmd( OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; int index; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -5446,10 +5470,11 @@ WmTitleCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; - size_t length; + int length; HWND wrapper; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -5468,7 +5493,8 @@ WmTitleCmd( int size = 256; GetWindowTextW(wrapper, buf, size); - Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &titleString); + Tcl_DStringInit(&titleString); + Tcl_WCharToUtfDString(buf, wcslen(buf), &titleString); Tcl_SetObjResult(interp, Tcl_NewStringObj( Tcl_DStringValue(&titleString), Tcl_DStringLength(&titleString))); @@ -5481,15 +5507,15 @@ WmTitleCmd( if (wmPtr->title != NULL) { ckfree(wmPtr->title); } - argv3 = Tcl_GetString(objv[3]); - length = objv[3]->length; - wmPtr->title = ckalloc(length + 1); + argv3 = Tcl_GetStringFromObj(objv[3], &length); + wmPtr->title = (char *)ckalloc(length + 1); memcpy(wmPtr->title, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) { Tcl_DString titleString; - Tcl_WinUtfToTChar(wmPtr->title, -1, &titleString); + Tcl_DStringInit(&titleString); + Tcl_UtfToWCharDString(wmPtr->title, -1, &titleString); SetWindowTextW(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString)); Tcl_DStringFree(&titleString); } @@ -5522,7 +5548,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr, *w; WmInfo *wmPtr2; @@ -5650,7 +5676,8 @@ WmWithdrawCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5695,13 +5722,12 @@ WmUpdateGeom( } } - /*ARGSUSED*/ static void WmWaitVisibilityOrMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; if (masterPtr == NULL) @@ -5762,7 +5788,7 @@ Tk_SetGrid( * of one grid unit. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Ensure widthInc and heightInc are greater than 0 @@ -5859,7 +5885,7 @@ Tk_UnsetGrid( * controlling gridding. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Find the top-level window for tkwin, plus the window manager @@ -5918,7 +5944,7 @@ TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { - register TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { Tk_ErrorHandler handler; @@ -5958,7 +5984,6 @@ TopLevelEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TopLevelReqProc( ClientData dummy, /* Not used. */ @@ -5966,6 +5991,7 @@ TopLevelReqProc( { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; + (void)dummy; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { @@ -6009,8 +6035,8 @@ UpdateGeometryInfo( int width, height; /* Size of client area. */ int min, max; RECT rect; - register TkWindow *winPtr = clientData; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + TkWindow *winPtr = (TkWindow *)clientData; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -6290,10 +6316,10 @@ ParseGeometry( TkWindow *winPtr) /* Pointer to top-level window whose geometry * is to be changed. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, flags; char *end; - register const char *p = string; + const char *p = string; /* * The leading "=" is optional. @@ -6422,7 +6448,7 @@ Tk_GetRootCoords( int *xPtr, /* Where to store x-displacement of (0,0). */ int *yPtr) /* Where to store y-displacement of (0,0). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * If the window is mapped, let Windows figure out the translation. @@ -6519,6 +6545,8 @@ Tk_GetVRootGeometry( int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { + (void)tkwin; + *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); @@ -6551,7 +6579,7 @@ Tk_MoveToplevelWindow( int x, int y) /* New location for window (within parent). */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); @@ -6602,7 +6630,7 @@ TkWmProtocolEventProc( XEvent *eventPtr) /* X event. */ { WmInfo *wmPtr; - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom protocol; int result; Tcl_Interp *interp; @@ -6680,7 +6708,7 @@ TkWmStackorderToplevelEnumProc( hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); /* * Double check that same HWND does not get passed twice. @@ -6780,7 +6808,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -6793,7 +6821,7 @@ TkWmStackorderToplevel( goto done; case 1: hPtr = Tcl_FirstHashEntry(&table, &search); - windows[0] = Tcl_GetHashValue(hPtr); + windows[0] = (TkWindow *)Tcl_GetHashValue(hPtr); windows[1] = NULL; goto done; } @@ -6956,7 +6984,7 @@ TkWmAddToColormapWindows( * Automatically add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow **)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow*)); } @@ -8252,7 +8280,7 @@ TkpGetWrapperWindow( static void GenerateActivateEvent(TkWindow * winPtr, const int *flagPtr) { - ActivateEvent *eventPtr = ckalloc(sizeof(ActivateEvent)); + ActivateEvent *eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent)); eventPtr->ev.proc = ActivateWindow; eventPtr->winPtr = winPtr; @@ -8355,7 +8383,7 @@ void TkWinSetForegroundWindow( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (wmPtr->wrapper != NULL) { SetForegroundWindow(wmPtr->wrapper); @@ -8385,7 +8413,7 @@ void TkpWinToplevelWithDraw( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags |= WM_WITHDRAWN; TkpWmSetState(winPtr, WithdrawnState); @@ -8436,7 +8464,7 @@ void TkpWinToplevelDeiconify( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_WITHDRAWN; @@ -8504,7 +8532,7 @@ long TkpWinToplevelIsControlledByWm( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!wmPtr) { return 0; @@ -8534,7 +8562,7 @@ TkpWinToplevelMove( TkWindow *winPtr, int x, int y) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (wmPtr && x >= 0 && y >= 0 && !TkpWinToplevelIsControlledByWm(winPtr)) { Tk_MoveToplevelWindow((Tk_Window) winPtr, x, y); @@ -8566,7 +8594,7 @@ TkpWinToplevelOverrideRedirect( int reqValue) { int curValue; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (reqValue < 0) { @@ -8613,7 +8641,7 @@ void TkpWinToplevelDetachWindow( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (winPtr->flags & TK_EMBEDDED) { int state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1; |