xserver: Branch 'master' - 5 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Jun 29 20:20:36 PDT 2011


 glx/Makefile.am                 |    6 ++--
 glx/glxscreens.c                |    7 ++++
 hw/xwin/XWin.rc                 |    2 -
 hw/xwin/windialogs.c            |    2 -
 hw/xwin/winmultiwindowwindow.c  |   37 ++++++++++++++++++++++---
 hw/xwin/winmultiwindowwndproc.c |   58 ++++++++++++++++++++++++++++++++++++++++
 hw/xwin/winwindow.h             |    1 
 7 files changed, 103 insertions(+), 10 deletions(-)

New commits:
commit 61f87a75f2bcda939a1778d39be8cfa5c886e6d8
Merge: 0d2153a... 72d9143...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jun 29 20:14:51 2011 -0700

    Merge remote-tracking branch 'jturney/master'

commit 72d914335c9ad0e0f4a34b9f7e2901b830c499bf
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Mar 23 04:34:22 2010 -0500

    Cygwin/X: Left-justify website link in About box
    
    Left-justify website link in About box.  This is a cosmetic fix to make
    the About box display correctly when Windows is configured with a
    non-default DPI value
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc
index 539bd0e..a142f30 100644
--- a/hw/xwin/XWin.rc
+++ b/hw/xwin/XWin.rc
@@ -50,7 +50,7 @@ BEGIN
   LTEXT			BUILDERSTRING, IDC_STATIC, 36, 28, 220, 8
   LTEXT			"This software is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 48, 220, 20
   CONTROL               __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button",
-                        BS_OWNERDRAW | WS_TABSTOP, 36, 68, 68, 8
+                        BS_OWNERDRAW | WS_TABSTOP, 36, 68, 220, 8
   DEFPUSHBUTTON		"&OK", IDOK, 105, 85, 50, 15
 END
 
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index c3a1497..bb4f447 100644
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -115,7 +115,7 @@ winDrawURLWindow (LPARAM lParam)
   /* Draw it */
   SetBkMode (draw->hDC, OPAQUE);
   SelectObject (draw->hDC, font);
-  DrawText (draw->hDC, str, strlen (str),&rect,DT_CENTER | DT_VCENTER);
+  DrawText (draw->hDC, str, strlen (str),&rect,DT_LEFT | DT_VCENTER);
   /* Delete the created font, replace it with stock font */
   DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT)));
 }
commit e78628406f0428454983db1c51a8c828bf5684e5
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Aug 12 15:00:01 2010 +0100

    Cygwin/X: Preserve client area size and position on Windows window style change
    
    When the style changes, adjust the window size so the client area remains the same.
    
    Otherwise the window size may change when sizing is reflected from Windows to X, and
    some windows are drawn expecting them to be exactly the requested size (e.g. the
    gmplayer control window)
    
    Use DeferWindowPos to delay the resize to preserve client area on WM_STYLECHANGING
    until after the style change has actually happened in WM_STYLECHANGED
    
    As a consquence of this, we need to be more careful to create windows with exactly
    the requested placement and client area initially, so the client area matches what
    the X client requested
    
    Also synchronize the X windows idea of the placement of a window which Windows is
    allowed to place
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 21b818b..2d9a46e 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -493,6 +493,8 @@ winCreateWindowsWindow (WindowPtr pWin)
   winPrivScreenPtr	pScreenPriv = pWinPriv->pScreenPriv;
   WinXSizeHints         hints;
   WindowPtr		pDaddy;
+  DWORD dwStyle, dwExStyle;
+  RECT rc;
 
   winInitMultiWindowClass();
 
@@ -517,6 +519,8 @@ winCreateWindowsWindow (WindowPtr pWin)
         iY = CW_USEDEFAULT;
     }
 
+  winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
+
   if (winMultiWindowGetTransientFor (pWin, &pDaddy))
     {
       if (pDaddy)
@@ -538,16 +542,35 @@ winCreateWindowsWindow (WindowPtr pWin)
       }
     }
 
-  /* Create the window */
-  /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
+  /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */
   /* CW_USEDEFAULT, change back to popup after creation */
-  hWnd = CreateWindowExA (WS_EX_TOOLWINDOW,	/* Extended styles */
+  dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+  dwExStyle = WS_EX_TOOLWINDOW;
+
+  /*
+     Calculate the window coordinates containing the requested client area,
+     being careful to preseve CW_USEDEFAULT
+  */
+  rc.top = (iY != CW_USEDEFAULT) ? iY : 0;
+  rc.left = (iX != CW_USEDEFAULT) ? iX : 0;
+  rc.bottom = rc.top + iHeight;
+  rc.right = rc.left + iWidth;
+  AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
+  if (iY != CW_USEDEFAULT) iY = rc.top;
+  if (iX != CW_USEDEFAULT) iX = rc.left;
+  iHeight = rc.bottom - rc.top;
+  iWidth = rc.right - rc.left;
+
+  winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
+
+  /* Create the window */
+  hWnd = CreateWindowExA (dwExStyle,		/* Extended styles */
 			  WINDOW_CLASS_X,	/* Class name */
 			  WINDOW_TITLE_X,	/* Window name */
-			  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+			  dwStyle,		/* Styles */
 			  iX,			/* Horizontal position */
 			  iY,			/* Vertical position */
-			  iWidth,		/* Right edge */ 
+			  iWidth,		/* Right edge */
 			  iHeight,		/* Bottom edge */
 			  hFore,		/* Null or Parent window if transient*/
 			  (HMENU) NULL,		/* No menu */
@@ -569,6 +592,10 @@ winCreateWindowsWindow (WindowPtr pWin)
   SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
   SetWindowPos (hWnd, 0, 0, 0, 0, 0,
 		SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+  /* Adjust the X window to match the window placement we actually got... */
+  winAdjustXWindow (pWin, hWnd);
+
   /* Make sure it gets the proper system menu for a WS_POPUP, too */
   GetSystemMenu (hWnd, TRUE);
 
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index b559cd8..1a3be78 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -1008,6 +1008,64 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
       winAdjustXWindow (pWin, hwnd);
       return 0; /* end of WM_SIZE handler */
 
+    case WM_STYLECHANGING:
+      /*
+        When the style changes, adjust the Windows window size so the client area remains the same size,
+        and adjust the Windows window position so that the client area remains in the same place.
+      */
+      {
+        RECT newWinRect;
+        DWORD dwExStyle;
+        DWORD dwStyle;
+        DWORD newStyle = ((STYLESTRUCT *)lParam)->styleNew;
+        WINDOWINFO wi;
+
+        dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+        dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
+
+        winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n", dwStyle, dwExStyle);
+
+        if (wParam == GWL_EXSTYLE)
+          dwExStyle = newStyle;
+
+        if (wParam == GWL_STYLE)
+          dwStyle = newStyle;
+
+        winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n", dwStyle, dwExStyle);
+
+        /* Get client rect in screen coordinates */
+        wi.cbSize = sizeof(WINDOWINFO);
+        GetWindowInfo(hwnd, &wi);
+
+        winDebug("winTopLevelWindowProc - WM_STYLECHANGING client area {%d, %d, %d, %d}, {%d x %d}\n", wi.rcClient.left, wi.rcClient.top, wi.rcClient.right, wi.rcClient.bottom, wi.rcClient.right - wi.rcClient.left, wi.rcClient.bottom - wi.rcClient.top);
+
+        newWinRect = wi.rcClient;
+        if (!AdjustWindowRectEx(&newWinRect, dwStyle, FALSE, dwExStyle))
+          winDebug("winTopLevelWindowProc - WM_STYLECHANGING AdjustWindowRectEx failed\n");
+
+        winDebug("winTopLevelWindowProc - WM_STYLECHANGING window area should be {%d, %d, %d, %d}, {%d x %d}\n", newWinRect.left, newWinRect.top, newWinRect.right, newWinRect.bottom, newWinRect.right - newWinRect.left, newWinRect.bottom - newWinRect.top);
+
+        /*
+          Style change hasn't happened yet, so we can't adjust the window size yet, as the winAdjustXWindow()
+          which WM_SIZE does will use the current (unchanged) style.  Instead make a note to change it when
+          WM_STYLECHANGED is received...
+        */
+        pWinPriv->hDwp = BeginDeferWindowPos(1);
+        pWinPriv->hDwp = DeferWindowPos(pWinPriv->hDwp, hwnd, NULL, newWinRect.left, newWinRect.top, newWinRect.right - newWinRect.left, newWinRect.bottom - newWinRect.top, SWP_NOACTIVATE | SWP_NOZORDER);
+      }
+      return 0;
+
+    case WM_STYLECHANGED:
+      {
+        if (pWinPriv->hDwp)
+          {
+            EndDeferWindowPos(pWinPriv->hDwp);
+            pWinPriv->hDwp = NULL;
+          }
+        winDebug("winTopLevelWindowProc - WM_STYLECHANGED done\n");
+      }
+      return 0;
+
     case WM_MOUSEACTIVATE:
 
       /* Check if this window needs to be made active when clicked */
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index cf2f93f..ebe4309 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -79,6 +79,7 @@ typedef struct
   HWND			hWnd;
   winPrivScreenPtr	pScreenPriv;
   Bool			fXKilled;
+  HDWP                  hDwp;
 
   /* Privates used by primary fb DirectDraw server */
   LPDDSURFACEDESC	pddsdPrimary;
commit 1d7f3a0031b4ae7d8aa984799ffa578788061ce4
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sat Nov 7 19:34:12 2009 +0000

    glx: Move GLX extension string utility functions
    
    Move GLX extension string utility functions from the DRI1 convenience library
    into the GLX extension convenience library, so other DDX which don't have DRI
    can use them.
    
    This is probably also needed if anyone actually tries to build an Xorg DDX
    with only DRI2 support...
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

diff --git a/glx/Makefile.am b/glx/Makefile.am
index 7cc2521..34be4ae 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -48,9 +48,7 @@ glapi_sources =					\
 	glthread.c				\
 	glthread.h
 
-libglxdri_la_SOURCES = \
-        extension_string.c \
-        extension_string.h
+libglxdri_la_SOURCES =
 
 if DRI
 libglxdri_la_SOURCES += glxdri.c
@@ -65,6 +63,8 @@ libglxdri_la_LIBADD = $(DLOPEN_LIBS)
 libglx_la_SOURCES = \
 	$(indirect_sources) \
 	$(glapi_sources) \
+	extension_string.c \
+	extension_string.h \
 	indirect_util.c \
 	indirect_util.h \
 	indirect_program.c \
commit 3e8270b869ebf788778d5d56107f6d47c7c050d0
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Apr 12 15:30:25 2011 -0400

    glx: Fix fbconfigs with no corresponding visual
    
    There are, in general, more fbconfig depths than visual depths.
    fbconfigs need not support Window rendering, however any that do must
    have an associated visual ID (which we got right), and any that do not
    must not claim GLX_WINDOW_BIT in GLX_DRAWABLE_TYPE (which we got
    wrong).
    
    Fixes piglit/glx-fbconfig-sanity, assuming you have a sufficiently
    recent piglit, as that test formerly wrongly required pixmap-capable
    fbconfigs to have a visual.
    
    v2: Additional check for fbconfigs that didn't have GLX_WINDOW_BIT in
        the first place, from previous patch by Jon TURNEY; also, also clear
        ->visualID.
    
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 496cf9e..c4ad426 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -395,8 +395,15 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
 	    if (depth == pScreen->visuals[i].nplanes)
 		break;
 	}
+	/* if it can't, fix up the fbconfig to not advertise window support */
 	if (i == pScreen->numVisuals)
+	    config->drawableType &= ~(GLX_WINDOW_BIT);
+
+       /* fbconfig must support window drawables */
+	if (!(config->drawableType & GLX_WINDOW_BIT)) {
+	    config->visualID = 0;
 	    continue;
+	}
 
 	/* Create a new X visual for our FBconfig. */
 	visual = AddScreenVisuals(pScreen, 1, depth);


More information about the xorg-commit mailing list