Commit c1002110 authored by Peter Hutterer's avatar Peter Hutterer

dix: only show the cursor if a window defines one (#58398)

e02f864f "Suppress cursor display until the first XDefineCursor() request"
disabled cursor display a priori unless -retro is given.

On a plain server, caling XFixesHideCursor() and XFixesShowCursor() would
show the default root cursor, despite no client actually defining a cursor.

Change the logic, disable CursorVisible by default and only enable it from
the window's CWCursor logic. If no window ever defines a cursor, said cursor
stays invisible.

X.Org Bug 58398 <http://bugs.freedesktop.org/show_bug.cgi?id=58398>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Tested-by: Bastien Nocera's avatarBastien Nocera <hadess@hadess.net>
Reviewed-by: default avatarDaniel Martin <consume.noise@gmail.com>
parent bd58ebe4
...@@ -1431,6 +1431,8 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) ...@@ -1431,6 +1431,8 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
} }
} }
CursorVisible = TRUE;
if (pWin->realized) if (pWin->realized)
WindowHasNewCursor(pWin); WindowHasNewCursor(pWin);
...@@ -3430,6 +3432,8 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor) ...@@ -3430,6 +3432,8 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
} }
out: out:
CursorVisible = TRUE;
if (pWin->realized) if (pWin->realized)
WindowHasNewCursor(pWin); WindowHasNewCursor(pWin);
......
...@@ -638,6 +638,11 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); ...@@ -638,6 +638,11 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
xfixes/cursor.c uses it to determine if the cursor is enabled */ xfixes/cursor.c uses it to determine if the cursor is enabled */
extern Bool EnableCursor; extern Bool EnableCursor;
/* Set to FALSE by default - ChangeWindowAttributes sets it to TRUE on
* CWCursor, xfixes/cursor.c uses it to determine if the cursor is enabled
*/
extern Bool CursorVisible;
extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
......
...@@ -129,8 +129,7 @@ typedef struct _CursorScreen { ...@@ -129,8 +129,7 @@ typedef struct _CursorScreen {
#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt) #define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt)
/* The cursor doesn't show up until the first XDefineCursor() */ /* The cursor doesn't show up until the first XDefineCursor() */
static Bool CursorVisible = FALSE; Bool CursorVisible = FALSE;
Bool EnableCursor = TRUE; Bool EnableCursor = TRUE;
static Bool static Bool
...@@ -142,12 +141,7 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) ...@@ -142,12 +141,7 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
Unwrap(cs, pScreen, DisplayCursor, backupProc); Unwrap(cs, pScreen, DisplayCursor, backupProc);
/* CursorVisible = CursorVisible && EnableCursor;
* 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 = EnableCursor;
if (cs->pCursorHideCounts != NULL || !CursorVisible) { if (cs->pCursorHideCounts != NULL || !CursorVisible) {
ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor); ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment