From 3fbb2df36c7a9d12d38fad15776cc33ba26153ff Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Sun, 4 Feb 2024 14:22:42 -0800 Subject: [PATCH] Wayland: suport GTK/CSS cursor names Adwaita, the default icon theme for many distributions, decided to stop providing legacy Xcursor icons in favor of the GTK/CSS names[1]. This requires us to probe for "default" instead of the "left_ptr", as the latter is no longer available in Adwaita. Keep the fallback to "left_ptr" for more conservative themes. [1]: https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/commit/74e9b79471236320d2af4925d6c5bb7df22380ce --- src/wayland/wl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wayland/wl.c b/src/wayland/wl.c index df09cbe64..b165fed30 100644 --- a/src/wayland/wl.c +++ b/src/wayland/wl.c @@ -732,9 +732,14 @@ bool wl_init() { LOG_W("couldn't find a cursor theme"); return true; } - struct wl_cursor *cursor = wl_cursor_theme_get_cursor(ctx.cursor_theme, "left_ptr"); + // Try cursor spec (CSS) name first + struct wl_cursor *cursor = wl_cursor_theme_get_cursor(ctx.cursor_theme, "default"); if (cursor == NULL) { - LOG_W("couldn't find cursor icon \"left_ptr\""); + // Try legacy Xcursor name + cursor = wl_cursor_theme_get_cursor(ctx.cursor_theme, "left_ptr"); + } + if (cursor == NULL) { + LOG_W("couldn't find cursor icons \"default\" or \"left_ptr\""); wl_cursor_theme_destroy(ctx.cursor_theme); // Set to NULL so it doesn't get free'd again ctx.cursor_theme = NULL;