diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-10-22 18:45:41 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-02-01 17:12:54 +0000 |
commit | e9c1fea5eecc069196ed4a0bbb22b444f9b56642 (patch) | |
tree | 7c39422d6a95816bbaec88764c299dee2d77bd8b | |
parent | e31a39ed66bb398fd24f62f54b470bd3d3b2f685 (diff) |
Fix a regression with window placement in multiwindow mode
X windows with no geometry specified end up being created at the same place,
the top-left, rather than being placed by Windows in it's default arrangement
(this is particularly noticable with a dual-monitor setup with the primary monitor
on the right as the Windows default placement puts new windows on the primary monitor,
but new X windows end up at the top-left which is on the secondary monitor.)
The SetWindowPos(SWP_FRAMECHANGED) we do after applying the WS_POPUP style after creation
causes a WM_STYLECHANGED to be emitted
cygwin-hint-handling-fixes patch adds handling or WM_STYLECHANGED and uses it to adjust
the window size to preserve the client area (and has a side effect of synchronizing
the native Window postion with the X window position)
Previously, however, this inital WM_STYLECHANGE was ineffective, as the hWnd stored in
the window privates was not set until after SetWindowPos() was called
Commit 17e67c40 moved the setting of this hWnd private up to immediately
after CreateWindowEx (not unreasonably, as having a window where it is not set but things
are operating on the window is not good), unfortunately, as shown above, the current code
depends on this window for things to work correctly :-(
Yuck!
To perhaps clean this up a bit, we need to stop being lazy in WM_STYLECHANGED and
write a proper analogue to winPositionWindowMultiWindow() which only sets the window
size (or allow that function, suitably renamed, to accept flags that it should adjust
the X window size and/or position)
-rw-r--r-- | hw/xwin/winmultiwindowwindow.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 753dc2c19..44847c758 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -574,7 +574,6 @@ winCreateWindowsWindow (WindowPtr pWin) ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n", (int) GetLastError ()); } - pWinPriv->hWnd = hWnd; /* Set application or .XWinrc defined Icons */ winSelectIcons(pWin, &hIcon, &hIconSmall); @@ -588,6 +587,8 @@ winCreateWindowsWindow (WindowPtr pWin) /* Make sure it gets the proper system menu for a WS_POPUP, too */ GetSystemMenu (hWnd, TRUE); + pWinPriv->hWnd = hWnd; + /* Cause any .XWinrc menus to be added in main WNDPROC */ PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0); |