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,