Skip to content

Commit

Permalink
Wayland: suport GTK/CSS cursor names
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alebastr committed Feb 4, 2024
1 parent ed5bcb4 commit 3fbb2df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/wayland/wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3fbb2df

Please sign in to comment.