From c6f167b1a14c594c24deb9a5dc5e05a68f8093ca Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 25 Mar 2025 13:27:19 +0100 Subject: [PATCH] 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: --- .../ref-tests/wayland_cursor_shape_3.ref.png | Bin 0 -> 1964 bytes src/tests/wayland-test-clients/cursor-shape.c | 3 +++ src/wayland/meta-wayland-pointer.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/tests/ref-tests/wayland_cursor_shape_3.ref.png diff --git a/src/tests/ref-tests/wayland_cursor_shape_3.ref.png b/src/tests/ref-tests/wayland_cursor_shape_3.ref.png new file mode 100644 index 0000000000000000000000000000000000000000..605a73ec3616ca834d3815ea9be680e447c3fec1 GIT binary patch literal 1964 zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sV0^&A1Qgk|*?TjPVoUONcVYMsf(!O8pUl9( zp6Kb~7*a9k?NviY1_ho21_$;(f7m3a!u6~4{23;Odsd|k41Z2EFe)S*U=T1!VBnB2 zU|`{qU|?e7VPIrtYiM9(b~rF9JsK>d$ze1bjFt|grQ&F9fLcj5a{pbyws$e3*eYQ4 O%i!ti=d#Wzp$PzdGEK(- literal 0 HcmV?d00001 diff --git a/src/tests/wayland-test-clients/cursor-shape.c b/src/tests/wayland-test-clients/cursor-shape.c index c17d91e5e..827f20183 100644 --- a/src/tests/wayland-test-clients/cursor-shape.c +++ b/src/tests/wayland-test-clients/cursor-shape.c @@ -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; } diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index 0baa53006..b7819fdf1 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -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;