From 8278d251af0c9b3fbf23878579bac7698bfe565d Mon Sep 17 00:00:00 2001 From: hobbs Date: Sat, 18 Sep 2004 23:59:46 +0000 Subject: (UpdateWrapper): don't adjust Z order of TOPMOST window. (WmAttributesCmd): don't call UpdateWrapper for -disabled or -toolwindow attr changes. --- ChangeLog | 3 +++ win/tkWinWm.c | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aadf35..a1211be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * win/tkWinWm.c (WmAttributesCmd): correct -alpha 0.0/1.0 setting and round the value. + (UpdateWrapper): don't adjust Z order of TOPMOST window. + (WmAttributesCmd): don't call UpdateWrapper for -disabled or + -toolwindow attr changes. 2004-09-18 Daniel Steffen 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; } -- cgit v0.12