diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2014-07-09 14:26:54 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-02-29 14:04:24 -0500 |
commit | de7f1fd6f8f10f07b366ae5428a8c65a224bda98 (patch) | |
tree | 0f626e3a9f263f2b1f16893b38f1ccf7cb81d017 /hw/xwin | |
parent | a9e73131b6453e0fa2da5360e84af7a2eae3b205 (diff) |
xwin: Check that window position is visible on non-rectangular virtual desktops
Improve the check that window position is visible to work correctly for
non-rectangular virtual desktops
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/winmultiwindowwindow.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index f4de91242..79ea108e5 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -503,15 +503,19 @@ winCreateWindowsWindow(WindowPtr pWin) iHeight = pWin->drawable.height; /* If it's an InputOutput window, and so is going to end up being made visible, - make sure the window actually ends up somewhere where it will be visible */ - if (pWin->drawable.class != InputOnly) { - if ((iX < GetSystemMetrics(SM_XVIRTUALSCREEN)) || - (iX > GetSystemMetrics(SM_CXVIRTUALSCREEN))) - iX = CW_USEDEFAULT; + make sure the window actually ends up somewhere where it will be visible - if ((iY < GetSystemMetrics(SM_YVIRTUALSCREEN)) || - (iY > GetSystemMetrics(SM_CYVIRTUALSCREEN))) - iY = CW_USEDEFAULT; + To handle arrangements of monitors which form a non-rectangular virtual + desktop, check if the window will end up with it's top-left corner on any + monitor + */ + if (pWin->drawable.class != InputOnly) { + POINT pt = { iX, iY }; + if (MonitorFromPoint(pt, MONITOR_DEFAULTTONULL) == NULL) + { + iX = CW_USEDEFAULT; + iY = CW_USEDEFAULT; + } } winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, |