xserver: Branch 'master'

Jon TURNEY jturney at kemper.freedesktop.org
Tue Jul 7 07:04:15 PDT 2009


 hw/xwin/winmultiwindowwm.c |   34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 48a9d65b88f56d1f8ab3bf824a4fe48c2f68725f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Jul 5 16:06:32 2009 +0100

    Cygwin/X: Window positioning improvements for multiwindow mode
    
    A few tweaks to winUpdateWindowPosition():
    
    * Don't allow window decoration to disappear off to top or left edge of the
    display as a result of adjustments to add decoration for the window style
    
    * Honour the position requested by window geometry for the client area (so
    windows which save their position don't get moved by the decoration width
    every time they are created) (unless we need to bump it away from top or left edges)
    
    * Fix an issue with initial window placement being offscreen on multimonitor
    systems when some monitors have negative coordinates (are to the left of or
    above the primary monitor)
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 8560c6c..18d9aed 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)
   {


More information about the xorg-commit mailing list