wayland: Allow changing from a cursor shape to a NULL surface

Changing to a cursor shape would set the cursor surface to NULL, so
trying to disable the cursor by setting the cursor surface to NULL was
detected as no-change. This commit fixes the check by taking into
account if the cursor shape is currently set.

Also adds a ref-test for it.

Fixes: 005b969227 ("wayland: Implement the cursor_shape_v1 protocol")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3997
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4358>
This commit is contained in:
Sebastian Wick 2025-03-25 13:27:19 +01:00 committed by Bruce Leidl
parent b08cf5c135
commit c6f167b1a1
3 changed files with 5 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -128,6 +128,9 @@ main (int argc,
WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
wp_cursor_shape_device_v1_destroy (cursor_shape_device);
wait_for_view_verified (display, 1);
/* make sure disabling the cursor works */
wl_pointer_set_cursor (pointer, serial, NULL, 0, 0);
wait_for_view_verified (display, 3);
return EXIT_SUCCESS;
}

View File

@ -1199,7 +1199,8 @@ meta_wayland_pointer_set_cursor_surface (MetaWaylandPointer *pointer,
prev_cursor_surface = pointer->cursor_surface;
if (prev_cursor_surface == cursor_surface)
if (prev_cursor_surface == cursor_surface &&
pointer->cursor_shape == META_CURSOR_INVALID)
return;
pointer->cursor_surface = cursor_surface;