From 59ee54d136b59cc0aa4c3c4cce9bc962085ad525 Mon Sep 17 00:00:00 2001 From: rewine Date: Tue, 14 Apr 2026 20:29:57 +0800 Subject: [PATCH] wayland: bind cursor-shape-v1 at protocol version 2 cursor-shape-v1 version 2 adds dnd_ask and all_resize, but SDL_SystemCursor does not expose matching cursor types yet. Bind the protocol at version 2 now so SDL negotiates the updated interface correctly while keeping the current cursor mapping unchanged. --- src/video/wayland/SDL_waylandvideo.c | 2 +- wayland-protocols/cursor-shape-v1.xml | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 3e0ca45679..2a29d632c9 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1402,7 +1402,7 @@ static void handle_registry_global(void *data, struct wl_registry *registry, uin d->input_timestamps_manager = wl_registry_bind(d->registry, id, &zwp_input_timestamps_manager_v1_interface, 1); Wayland_DisplayInitInputTimestampManager(d); } else if (SDL_strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) { - d->cursor_shape_manager = wl_registry_bind(d->registry, id, &wp_cursor_shape_manager_v1_interface, 1); + d->cursor_shape_manager = wl_registry_bind(d->registry, id, &wp_cursor_shape_manager_v1_interface, SDL_min(version, 2)); Wayland_DisplayInitCursorShapeManager(d); } else if (SDL_strcmp(interface, zxdg_exporter_v2_interface.name) == 0) { d->zxdg_exporter_v2 = wl_registry_bind(d->registry, id, &zxdg_exporter_v2_interface, 1); diff --git a/wayland-protocols/cursor-shape-v1.xml b/wayland-protocols/cursor-shape-v1.xml index 56f6a1a65b..64b2f9b2c8 100644 --- a/wayland-protocols/cursor-shape-v1.xml +++ b/wayland-protocols/cursor-shape-v1.xml @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. - + This global offers an alternative, optional way to set cursor images. This new way uses enumerated cursors instead of a wl_surface like @@ -43,6 +43,9 @@ Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. + + When the pointer capability is removed from the wl_seat, the + wp_cursor_shape_device_v1 object becomes inert. @@ -51,16 +54,18 @@ Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. + + When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 + object becomes inert. - + - This interface advertises the list of supported cursor shapes for a - device, and allows clients to set the cursor shape. + This interface allows clients to set the cursor shape. @@ -69,6 +74,14 @@ The names are taken from the CSS W3C specification: https://w3c.github.io/csswg-drafts/css-ui/#cursor + with a few additions. + + Note that there are some groups of cursor shapes that are related: + The first group is drag-and-drop cursors which are used to indicate + the selected action during dnd operations. The second group is resize + cursors which are used to indicate resizing and moving possibilities + on window borders. It is recommended that the shapes in these groups + should use visually compatible images and metaphors. @@ -104,6 +117,8 @@ + +