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>
This commit is contained in:
Jon Turney 2014-07-09 14:26:54 +01:00 committed by Adam Jackson
parent a9e73131b6
commit de7f1fd6f8

View File

@ -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,