summaryrefslogtreecommitdiff
path: root/xfixes
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-08-20 13:24:03 -0400
committerAdam Jackson <ajax@redhat.com>2008-08-20 13:24:03 -0400
commite02f864fdf19a5ab1682336be343c57fdb69ef43 (patch)
tree53b0b2e3e457a2ab0e59aa329cefd6d1df9ef0b4 /xfixes
parent64ef7ed072007b1d0b4de5ff1e5eababa418c794 (diff)
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.
Diffstat (limited to 'xfixes')
-rwxr-xr-xxfixes/cursor.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 0834d8820..ca1739797 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);
}