diff options
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r-- | win/tkWinWm.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 6b7305a..d60cf26 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.54.2.9 2004/09/18 22:48:55 hobbs Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.54.2.10 2004/09/18 23:59:48 hobbs Exp $ */ #include "tkWinInt.h" @@ -2103,9 +2103,11 @@ UpdateWrapper(winPtr) TkInstallFrameMenu((Tk_Window) winPtr); - if (oldWrapper && (oldWrapper != wmPtr->wrapper)) { + if (oldWrapper && (oldWrapper != wmPtr->wrapper) + && !(wmPtr->exStyle & WS_EX_TOPMOST)) { /* * We will adjust wrapper to have the same Z order as oldWrapper + * if it isn't a TOPMOST window. */ nextHWND = GetNextWindow(oldWrapper, GW_HWNDPREV); } @@ -2942,7 +2944,8 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) } } else { if ((i < objc-1) && - (Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) != TCL_OK)) { + (Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) + != TCL_OK)) { return TCL_ERROR; } if (i == objc-1) { @@ -2956,17 +2959,30 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) } } if ((wmPtr->styleConfig != style) || (wmPtr->exStyleConfig != exStyle)) { - wmPtr->styleConfig = style; - wmPtr->exStyleConfig = exStyle; /* - * We could possibly avoid the UpdateWrapper with a SetWindowPos call - * with SWP_FRAMECHANGED, but we need to handle the current styles - * and the Config styles together. - SetWindowPos(wmPtr->wrapper, NULL, 0, 0, 0, 0, - SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOSENDCHANGING - |SWP_NOZORDER|SWP_FRAMECHANGED); + * Only the change of TOPMOST or LAYERED bits require UpdateWrapper. + * Using SetWindowPos prevents the toplevel "blink", but requires the + * current style info, as *Config only contains a few configurable + * bits which changed. */ - UpdateWrapper(winPtr); + if ((wmPtr->exStyleConfig ^ exStyle) & (WS_EX_TOPMOST|WS_EX_LAYERED)) { + wmPtr->styleConfig = style; + wmPtr->exStyleConfig = exStyle; + UpdateWrapper(winPtr); + } else { + LONG curStyle, curExStyle; + curExStyle = (LONG) GetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE); + curStyle = (LONG) GetWindowLongPtr(wmPtr->wrapper, GWL_STYLE); + curExStyle = (curExStyle & ~(wmPtr->exStyleConfig)) | exStyle; + curStyle = (curStyle & ~(wmPtr->styleConfig)) | style; + wmPtr->styleConfig = style; + wmPtr->exStyleConfig = exStyle; + SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE,(LONG_PTR)curExStyle); + SetWindowLongPtr(wmPtr->wrapper, GWL_STYLE, (LONG_PTR) curStyle); + SetWindowPos(wmPtr->wrapper, NULL, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOSENDCHANGING + |SWP_NOZORDER|SWP_FRAMECHANGED); + } } return TCL_OK; } |