From 82b1de694b9c26099c8c0065f455e7cb217c8561 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 20 Aug 2008 10:11:07 -0400
Subject: [PATCH] Hide the cursor until the first XDefineCursor() call.
---
xfixes/cursor.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index d51251f..26a5d61 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -70,7 +70,7 @@
return BadCursor; \
} \
}
-
+
/*
* There is a global list of windows selecting for cursor events
*/
@@ -119,6 +119,10 @@
#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() */
+extern void *ConnectionInfo;
+static Bool CursorVisible = FALSE;
+
static Bool
CursorDisplayCursor (ScreenPtr pScreen,
CursorPtr pCursor)
@@ -128,7 +132,14 @@
Unwrap (cs, pScreen, DisplayCursor);
- if (cs->pCursorHideCounts != NULL) {
+ /*
+ * Have to check ConnectionInfo to distinguish client requests from
+ * initial root window setup. Not a great way to do it, I admit.
+ */
+ if (ConnectionInfo)
+ CursorVisible = TRUE;
+
+ if (cs->pCursorHideCounts != NULL || !CursorVisible) {
ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor);
} else {
ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
--
1.6.0.6