diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-01-10 14:35:56 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-01-16 16:50:20 +0000 |
commit | c94d1cb0a49106f44714f4511720a197cc549164 (patch) | |
tree | f824ef26967474319ecf6fd7ad75dd62cf68342f /hw | |
parent | ef61f8cacc84080c9156675f9ce26a27e8a90ac1 (diff) |
hw/xwin: Ensure full styling is applied when the window is mapped
Move styling update code from WM_WM_HINTS_EVENT to a function UpdateStyle(),
which is also invoked from WM_WM_MAP3, so everything which needs to be done
to style the window happens when it is mapped
(Otherwise, the appearance of the window is sensitive to the timing of the
notification of the windows appearance hint properties being set relative to
window creation. e.g. see [1])
[1] http://sourceware.org/ml/cygwin-xfree/2012-06/msg00004.html
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 1dc31fd0a..0c6b09abb 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -590,6 +590,32 @@ UpdateIcon(WMInfoPtr pWMInfo, Window iWindow) winUpdateIcon(hWnd, pWMInfo->pDisplay, iWindow, hIconNew); } +/* + * Updates the style of a HWND according to its X style properties + */ + +static void +UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) +{ + HWND hWnd; + HWND zstyle = HWND_NOTOPMOST; + UINT flags; + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) + return; + + /* Determine the Window style, which determines borders and clipping region... */ + winApplyHints(pWMInfo->pDisplay, iWindow, hWnd, &zstyle); + winUpdateWindowPosition(hWnd, &zstyle); + + /* Apply the updated window style, without changing it's show or activation state */ + flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; + if (zstyle == HWND_NOTOPMOST) + flags |= SWP_NOZORDER | SWP_NOOWNERZORDER; + SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags); +} + #if 0 /* * Fix up any differences between the X11 and Win32 window stacks @@ -737,13 +763,8 @@ winMultiWindowWMProc(void *pArg) (unsigned char *) &(pNode->msg.hwndWindow), 1); UpdateName(pWMInfo, pNode->msg.iWindow); UpdateIcon(pWMInfo, pNode->msg.iWindow); - { - HWND zstyle = HWND_NOTOPMOST; + UpdateStyle(pWMInfo, pNode->msg.iWindow); - winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow, - pNode->msg.hwndWindow, &zstyle); - winUpdateWindowPosition(pNode->msg.hwndWindow, &zstyle); - } /* Reshape */ { @@ -815,8 +836,6 @@ winMultiWindowWMProc(void *pArg) case WM_WM_HINTS_EVENT: { - HWND zstyle = HWND_NOTOPMOST; - UINT flags; XWindowAttributes attr; /* Don't do anything if this is an override-redirect window */ @@ -824,18 +843,7 @@ winMultiWindowWMProc(void *pArg) if (attr.override_redirect) break; - pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow); - - /* Determine the Window style, which determines borders and clipping region... */ - winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow, - pNode->msg.hwndWindow, &zstyle); - winUpdateWindowPosition(pNode->msg.hwndWindow, &zstyle); - - /* Apply the updated window style, without changing it's show or activation state */ - flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; - if (zstyle == HWND_NOTOPMOST) - flags |= SWP_NOZORDER | SWP_NOOWNERZORDER; - SetWindowPos(pNode->msg.hwndWindow, NULL, 0, 0, 0, 0, flags); + UpdateStyle(pWMInfo, pNode->msg.iWindow); } break; |