diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2023-07-07 19:38:02 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2023-07-07 19:38:02 -0400 |
| commit | 6bd6491af69119095d698e4bd9592c2870aed23b (patch) | |
| tree | 7a82397a2cb757da5d6a9aa19f5b58f34f2e0559 /swaybar | |
| parent | afd3694301ca1730c51625823f52c8dee279c294 (diff) | |
swaybar: handle wayland-cursor failures
Updating the cursor is not essential, so this change prints
a warning when wl_cursor_theme_load or wl_cursor_theme_get_cursor
fail instead of crashing or exiting.
Diffstat (limited to 'swaybar')
| -rw-r--r-- | swaybar/input.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/swaybar/input.c b/swaybar/input.c index 358c69cb..1e6ace00 100644 --- a/swaybar/input.c +++ b/swaybar/input.c @@ -81,8 +81,16 @@ void update_cursor(struct swaybar_seat *seat) { int scale = pointer->current ? pointer->current->scale : 1; pointer->cursor_theme = wl_cursor_theme_load( cursor_theme, cursor_size * scale, seat->bar->shm); + if (!pointer->cursor_theme) { + sway_log(SWAY_ERROR, "Failed to load cursor theme"); + return; + } struct wl_cursor *cursor; cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "default"); + if (!cursor) { + sway_log(SWAY_ERROR, "Failed to get default cursor from theme"); + return; + } pointer->cursor_image = cursor->images[0]; wl_surface_set_buffer_scale(pointer->cursor_surface, scale); wl_surface_attach(pointer->cursor_surface, |
