xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Wed Aug 20 10:35:32 PDT 2008


 xfixes/cursor.c |   32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

New commits:
commit e02f864fdf19a5ab1682336be343c57fdb69ef43
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 20 13:24:03 2008 -0400

    Suppress cursor display until the first XDefineCursor() request.
    
    Yes, this means the server will start without showing a cursor.  Pretty
    much any application that wants to interact with the mouse will define
    cursors, so this essentially just delays showing it until gdm (or
    whatever) loads.

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 0834d88..ca17397 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -70,7 +70,7 @@ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
 	return BadCursor; \
     } \
 }
-	
+
 /*
  * There is a global list of windows selecting for cursor events
  */
@@ -109,6 +109,7 @@ typedef struct _CursorHideCountRec {
 
 typedef struct _CursorScreen {
     DisplayCursorProcPtr	DisplayCursor;
+    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
     CloseScreenProcPtr		CloseScreen;
     CursorHideCountPtr          pCursorHideCounts;
 } CursorScreenRec, *CursorScreenPtr;
@@ -119,6 +120,9 @@ typedef struct _CursorScreen {
 #define Wrap(as,s,elt,func)	(((as)->elt = (s)->elt), (s)->elt = func)
 #define Unwrap(as,s,elt)	((s)->elt = (as)->elt)
 
+/* The cursor doesn't show up until the first XDefineCursor() */
+static Bool CursorVisible = FALSE;
+
 static Bool
 CursorDisplayCursor (DeviceIntPtr pDev,
                      ScreenPtr pScreen,
@@ -129,7 +133,7 @@ CursorDisplayCursor (DeviceIntPtr pDev,
 
     Unwrap (cs, pScreen, DisplayCursor);
 
-    if (cs->pCursorHideCounts != NULL) {
+    if (cs->pCursorHideCounts != NULL || !CursorVisible) {
 	ret = (*pScreen->DisplayCursor) (pDev, pScreen, pInvisibleCursor);
     } else {
 	ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
@@ -162,6 +166,27 @@ CursorDisplayCursor (DeviceIntPtr pDev,
 }
 
 static Bool
+CursorChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+    ScreenPtr           pScreen = pWin->drawable.pScreen;
+    CursorScreenPtr	cs = GetCursorScreen(pScreen);
+    Bool		ret;
+
+    /*
+     * Have to check ConnectionInfo to distinguish client requests from
+     * initial root window setup.  Not a great way to do it, I admit.
+     */
+    if ((mask & CWCursor) && ConnectionInfo)
+	CursorVisible = TRUE;
+
+    Unwrap(cs, pScreen, ChangeWindowAttributes);
+    ret = pScreen->ChangeWindowAttributes(pWin, mask);
+    Wrap(cs, pScreen, ChangeWindowAttributes, CursorChangeWindowAttributes);
+
+    return ret;
+}
+
+static Bool
 CursorCloseScreen (int index, ScreenPtr pScreen)
 {
     CursorScreenPtr	cs = GetCursorScreen (pScreen);
@@ -169,6 +194,7 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
 
     Unwrap (cs, pScreen, CloseScreen);
     Unwrap (cs, pScreen, DisplayCursor);
+    Unwrap (cs, pScreen, ChangeWindowAttributes);
     deleteCursorHideCountsForScreen(pScreen);
     ret = (*pScreen->CloseScreen) (index, pScreen);
     xfree (cs);
@@ -1043,6 +1069,8 @@ XFixesCursorInit (void)
 	    return FALSE;
 	Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
 	Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
+	Wrap (cs, pScreen, ChangeWindowAttributes,
+	      CursorChangeWindowAttributes);
 	cs->pCursorHideCounts = NULL;
 	SetCursorScreen (pScreen, cs);
     }


More information about the xorg-commit mailing list