diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-23 19:10:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-23 19:10:41 (GMT) |
commit | d598dd109c654e821ea36ae227a5d981076539e4 (patch) | |
tree | 102b4591d67f7a5d907be97efb83050fffb43b33 /win/tkWinWm.c | |
parent | 473cbe0b52be91536966ff3eb575c2b2a36b7e7b (diff) | |
parent | 797299a238c72e1add2fd56d9706346a46861e0a (diff) | |
download | tk-d598dd109c654e821ea36ae227a5d981076539e4.zip tk-d598dd109c654e821ea36ae227a5d981076539e4.tar.gz tk-d598dd109c654e821ea36ae227a5d981076539e4.tar.bz2 |
Merge 8.6.
Don't use TCL_Z_MODIFIER on Windows, because it only works when Tk 8.7 is compiled with Tcl 8.7, not with Tcl 8.6
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r-- | win/tkWinWm.c | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 4102124..cf354c7 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1013,15 +1013,15 @@ WinSetIcon( /* * Don't check return result of SetClassLong() or - * SetClassLongPtr() since they return the previously set value + * SetClassLongPtrW() since they return the previously set value * which is zero on the initial call or in an error case. The MSDN * documentation does not indicate that the result needs to be * checked. */ - SetClassLongPtr(hwnd, GCLP_HICONSM, + SetClassLongPtrW(hwnd, GCLP_HICONSM, (LPARAM) GetIcon(titlebaricon, ICON_SMALL)); - SetClassLongPtr(hwnd, GCLP_HICON, + SetClassLongPtrW(hwnd, GCLP_HICON, (LPARAM) GetIcon(titlebaricon, ICON_BIG)); tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1066,9 +1066,9 @@ WinSetIcon( return TCL_ERROR; } } - SendMessage(hwnd, WM_SETICON, ICON_SMALL, + SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) GetIcon(titlebaricon, ICON_SMALL)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, + SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) GetIcon(titlebaricon, ICON_BIG)); /* @@ -1157,10 +1157,10 @@ TkWinGetIcon( * the window class. */ - icon = (HICON) SendMessage(wmPtr->wrapper, WM_GETICON, iconsize, + icon = (HICON) SendMessageW(wmPtr->wrapper, WM_GETICON, iconsize, (LPARAM) NULL); if (icon == (HICON) NULL) { - icon = (HICON) GetClassLongPtr(wmPtr->wrapper, + icon = (HICON) GetClassLongPtrW(wmPtr->wrapper, (iconsize == ICON_BIG) ? GCLP_HICON : GCLP_HICONSM); } return icon; @@ -1745,7 +1745,7 @@ GetTopLevel( if (tsdPtr->createWindow) { return tsdPtr->createWindow; } - return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + return (TkWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); } /* @@ -2132,7 +2132,7 @@ UpdateWrapper( wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); - SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); + SetWindowLongPtrW(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); tsdPtr->createWindow = NULL; if (wmPtr->exStyleConfig & WS_EX_LAYERED) { @@ -2183,24 +2183,24 @@ UpdateWrapper( * doesn't try to set the focus to the child window. */ - SetWindowLongPtr(child, GWL_STYLE, + SetWindowLongPtrW(child, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); if (winPtr->flags & TK_EMBEDDED) { - SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); + SetWindowLongPtrW(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); } SetParent(child, wmPtr->wrapper); if (oldWrapper) { hSmallIcon = (HICON) - SendMessage(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL); + SendMessageW(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL); hBigIcon = (HICON) - SendMessage(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL); + SendMessageW(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL); } if (oldWrapper && (oldWrapper != wmPtr->wrapper) && (oldWrapper != GetDesktopWindow())) { - SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0); + SetWindowLongPtrW(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0); if (wmPtr->numTransients > 0) { /* @@ -2233,11 +2233,11 @@ UpdateWrapper( wmPtr->flags &= ~WM_NEVER_MAPPED; if (winPtr->flags & TK_EMBEDDED && - SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) { - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, + SendMessageW(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) { + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth((Tk_Window) winPtr), Tk_ReqHeight((Tk_Window) winPtr)); - SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu, + SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu, (LPARAM) Tk_GetMenuHWND((Tk_Window) winPtr)); } @@ -2257,11 +2257,11 @@ UpdateWrapper( wmPtr->hints.initial_state = state; if (hSmallIcon != NULL) { - SendMessage(wmPtr->wrapper, WM_SETICON, ICON_SMALL, + SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_SMALL, (LPARAM) hSmallIcon); } if (hBigIcon != NULL) { - SendMessage(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon); + SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon); } /* @@ -2273,7 +2273,7 @@ UpdateWrapper( */ if (winPtr->flags & TK_EMBEDDED) { - if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) { + if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) { TkpWmSetState(winPtr, NormalState); wmPtr->hints.initial_state = NormalState; } @@ -2703,7 +2703,7 @@ TkWmDeadWindow( } } else { if (wmPtr->wrapper != NULL) { - SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); + SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); } } if (wmPtr->iconPtr != NULL) { @@ -3187,7 +3187,7 @@ WmAttributesCmd( */ if (!(wmPtr->exStyleConfig & WS_EX_LAYERED)) { - SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE, + SetWindowLongPtrW(wmPtr->wrapper, GWL_EXSTYLE, *stylePtr); } SetLayeredWindowAttributes((HWND) wmPtr->wrapper, @@ -3565,7 +3565,7 @@ WmDeiconifyCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - if (!SendMessage(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) { + if (!SendMessageW(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't deiconify %s: the container does not support the request", winPtr->pathName)); @@ -3709,6 +3709,7 @@ WmFrameCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; + char buf[TCL_INTEGER_SPACE]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3721,7 +3722,8 @@ WmFrameCmd( if (hwnd == NULL) { hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr)); } - Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%" TCL_Z_MODIFIER "x", (size_t)PTR2INT(hwnd))); + sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)PTR2INT(hwnd)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); return TCL_OK; } @@ -3773,7 +3775,7 @@ WmGeometryCmd( height = winPtr->changes.height; } if (winPtr->flags & TK_EMBEDDED) { - int result = SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1); + int result = SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1); wmPtr->x = result >> 16; wmPtr->y = result & 0x0000ffff; @@ -4121,7 +4123,7 @@ WmIconifyCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - if (!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { + if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify %s: the container does not support the request", winPtr->pathName)); @@ -4813,7 +4815,7 @@ WmOverrideredirectCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - curValue = SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1; + curValue = SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1; if (curValue < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Container does not support overrideredirect", -1)); @@ -4832,7 +4834,7 @@ WmOverrideredirectCmd( } if (curValue != boolean) { if (winPtr->flags & TK_EMBEDDED) { - SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); + SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); } else { /* * Only do this if we are really changing value, because it causes @@ -5345,7 +5347,7 @@ WmStateCmd( Tcl_Panic("unexpected index"); } - if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) { + if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't change state of %s: the container does not support the request", winPtr->pathName)); @@ -5398,7 +5400,7 @@ WmStateCmd( int state; if (winPtr->flags & TK_EMBEDDED) { - state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1; + state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1; } else { state = wmPtr->hints.initial_state; } @@ -5450,7 +5452,7 @@ WmTitleCmd( } if (winPtr->flags & TK_EMBEDDED) { - wrapper = (HWND) SendMessage(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0); + wrapper = (HWND) SendMessageW(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0); } else { wrapper = wmPtr->wrapper; } @@ -5659,7 +5661,7 @@ WmWithdrawCmd( } if (winPtr->flags & TK_EMBEDDED) { - if (SendMessage(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) { + if (SendMessageW(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: the container does not support the request", Tcl_GetString(objv[2]))); @@ -5964,7 +5966,7 @@ TopLevelReqProc( wmPtr = winPtr->wmInfoPtr; if (wmPtr) { if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) { - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin), + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin), Tk_ReqHeight(tkwin)); } if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { @@ -6176,8 +6178,8 @@ UpdateGeometryInfo( * be ignored. */ - SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, x, y); - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, width, height); + SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, x, y); + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, width, height); } else { int reqHeight, reqWidth; RECT windowRect; @@ -6872,7 +6874,7 @@ TkWmRestackToplevel( } if (winPtr->flags & TK_EMBEDDED) { - SendMessage(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW, + SendMessageW(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW, (WPARAM) insertAfter, aboveBelow); } else { TkWinSetWindowPos(hwnd, insertAfter, aboveBelow); @@ -7098,7 +7100,7 @@ TkWinSetMenu( wmPtr->flags |= WM_UPDATE_PENDING|WM_MOVE_PENDING; } } else { - SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu, + SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu, (LPARAM) Tk_GetMenuHWND(tkwin)); } } @@ -7412,7 +7414,7 @@ InstallColormaps( SelectPalette(dc, oldPalette, TRUE); RealizePalette(dc); ReleaseDC(hwnd, dc); - SendMessage(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL); + SendMessageW(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL); return TRUE; } } else { @@ -7808,7 +7810,7 @@ TopLevelProc( winPtr->changes.height = pos->cy; } if (!(pos->flags & SWP_NOMOVE)) { - long result = SendMessage(winPtr->wmInfoPtr->wrapper, + long result = SendMessageW(winPtr->wmInfoPtr->wrapper, TK_MOVEWINDOW, -1, -1); winPtr->wmInfoPtr->x = winPtr->changes.x = result >> 16; winPtr->wmInfoPtr->y = winPtr->changes.y = result & 0xffff; @@ -7999,7 +8001,7 @@ WmProc( * 2272] */ - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); goto done; } @@ -8076,7 +8078,7 @@ WmProc( HWND hMenuHWnd = Tk_GetEmbeddedMenuHWND((Tk_Window) winPtr); if (hMenuHWnd) { - if (SendMessage(hMenuHWnd, message, wParam, lParam)) { + if (SendMessageW(hMenuHWnd, message, wParam, lParam)) { goto done; } } else if (TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, @@ -8095,10 +8097,10 @@ WmProc( result = 0; } else if (!Tk_TranslateWinEvent(child, message, wParam, lParam, &result)) { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } } else { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } done: @@ -8612,10 +8614,10 @@ TkpWinToplevelDetachWindow( WmInfo *wmPtr = winPtr->wmInfoPtr; if (winPtr->flags & TK_EMBEDDED) { - int state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1; + int state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1; - SendMessage(wmPtr->wrapper, TK_SETMENU, 0, 0); - SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); + SendMessageW(wmPtr->wrapper, TK_SETMENU, 0, 0); + SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); winPtr->flags &= ~TK_EMBEDDED; winPtr->privatePtr = NULL; wmPtr->wrapper = NULL; |