summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/xwin/winmultiwindowwm.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 8560c6cc0..18d9aedc2 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1605,6 +1605,7 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
void
winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle)
{
+ int iX, iY, iWidth, iHeight;
int iDx, iDy;
RECT rcNew;
WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
@@ -1614,8 +1615,16 @@ winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle)
pDraw = &pWin->drawable;
if (!pDraw) return;
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
/* Setup a rectangle with the X window position and size */
- SetRect (&rcNew, pDraw->x, pDraw->y, pDraw->x + pDraw->width, pDraw->y + pDraw->height);
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#if 0
ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
@@ -1625,15 +1634,20 @@ winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle)
AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, WS_EX_APPWINDOW);
- /* Calculate position deltas */
- iDx = pDraw->x - rcNew.left;
- iDy = pDraw->y - rcNew.top;
+ /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
+ if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN))
+ {
+ iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ }
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN))
+ {
+ iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+ }
#if 0
ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
@@ -1644,7 +1658,7 @@ winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle)
/* Position the Windows window */
SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- SWP_NOMOVE | ((reshape) ? 0 : SWP_NOREDRAW));
+ 0);
if (reshape)
{