diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-06-28 11:25:08 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-07-03 12:36:32 +0000 |
| commit | c2baaff3c1311335b46e75db27bfd79d4f7b623b (patch) | |
| tree | 0cd3cc27773b4dc06239f89a839058707fc32fbe /terminal.c | |
| parent | meson: cursor-shape: use .xml from wayland-protocols (diff) | |
cursor-shape: use server-side cursors for custom (OSC-22), if possible
Using a lookup table, try to map the user-provided xcursor string to a
cursor-shape-v1 known shape.
If we succeed, set the user’s custom cursor using server side
cursors (i.e. using cursor-shape-v1).
If not, fallback to trying to load the image ourselves (using
wl_cursor_theme_get_cursor()), and set it using the legacy
wl_pointer_set_cursor().
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -3130,8 +3130,15 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) if (seat->pointer.hidden) shape = CURSOR_SHAPE_HIDDEN; - else if (render_xcursor_is_valid(seat, term->mouse_user_cursor)) +#if defined(HAVE_CURSOR_SHAPE) + else if (cursor_string_to_server_shape(term->mouse_user_cursor) != 0 +#elif + else if (true +#endif + || render_xcursor_is_valid(seat, term->mouse_user_cursor)) + { shape = CURSOR_SHAPE_CUSTOM; + } else if (seat->mouse.col >= 0 && seat->mouse.row >= 0 && @@ -3716,6 +3723,8 @@ void term_set_user_mouse_cursor(struct terminal *term, const char *cursor) { free(term->mouse_user_cursor); - term->mouse_user_cursor = cursor != NULL ? xstrdup(cursor) : NULL; + term->mouse_user_cursor = cursor != NULL && strlen(cursor) > 0 + ? xstrdup(cursor) + : NULL; term_xcursor_update(term); } |
