From 40a6c1c0a705911ec59f9cfd27c86c9ea66737c2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 16 Feb 2024 11:18:46 +0000 Subject: [PATCH] wayland: Use CSS/freedesktop cursor name "default" as a fallback The "left_ptr" name is an X11 thing, and there's no guarantee that Wayland cursor themes contain it. In particular, GNOME's Adwaita theme as of version 46.beta only contains the CSS/freedesktop names. To test, either move one of the known cursors out of the way, or edit the switch statement above to use a wrong name for one of them. Signed-off-by: Simon McVittie --- src/video/wayland/SDL_waylandmouse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 1ae7a7139..33c577785 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -400,11 +400,15 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa } /* Fallback to the default cursor if the chosen one wasn't found */ + if (!cursor) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "default"); + } + /* Try the old X11 name as a last resort */ if (!cursor) { cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr"); - if (!cursor) { - return SDL_FALSE; - } + } + if (!cursor) { + return SDL_FALSE; } /* ... Set the cursor data, finally. */