Fix un-suppressing the initial cursor.

The intended behaviour was "show as soon as someone calls
XDefineCursor".  What you actually got was, uh, slightly less well
defined, since the screen's ChangeWindowAttributes hook would run after
DIX handled the cursor change.  Oops.

The trivial way to turn the cursor on is:
% xsetroot -cursor_name gumby

Refer to /usr/include/X11/cursorfont.h for cursor names.

Thanks to anholt for catching this.
This commit is contained in:
Adam Jackson 2008-09-24 10:11:00 -04:00
parent a39377cbcb
commit 8d9defe8c2

View File

@ -111,7 +111,6 @@ typedef struct _CursorHideCountRec {
typedef struct _CursorScreen {
DisplayCursorProcPtr DisplayCursor;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
CloseScreenProcPtr CloseScreen;
CursorHideCountPtr pCursorHideCounts;
} CursorScreenRec, *CursorScreenPtr;
@ -135,6 +134,13 @@ CursorDisplayCursor (DeviceIntPtr pDev,
Unwrap (cs, pScreen, DisplayCursor);
/*
* 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) (pDev, pScreen, pInvisibleCursor);
} else {
@ -167,27 +173,6 @@ CursorDisplayCursor (DeviceIntPtr pDev,
return ret;
}
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)
{
@ -196,7 +181,6 @@ 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);
@ -1074,8 +1058,6 @@ 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);
}