diff --git a/wayland.c b/wayland.c index 3cc86429..938056ac 100644 --- a/wayland.c +++ b/wayland.c @@ -801,11 +801,19 @@ wayl_cursor_set(struct wayland *wayl, const struct terminal *term) if (wayl->pointer.theme == NULL) return false; + if (wayl->moused == NULL) { + wayl->pointer.xcursor = NULL; + return true; + } + if (wayl->moused != term) { /* This terminal doesn't have mouse focus */ return true; } + if (wayl->pointer.xcursor == term->xcursor) + return true; + wayl->pointer.cursor = wl_cursor_theme_get_cursor(wayl->pointer.theme, term->xcursor); if (wayl->pointer.cursor == NULL) { LOG_ERR("%s: failed to load xcursor pointer '%s'", @@ -813,6 +821,8 @@ wayl_cursor_set(struct wayland *wayl, const struct terminal *term) return false; } + wayl->pointer.xcursor = term->xcursor; + const int scale = term->scale; struct wl_cursor_image *image = wayl->pointer.cursor->images[0]; diff --git a/wayland.h b/wayland.h index a5084d83..fb681dd6 100644 --- a/wayland.h +++ b/wayland.h @@ -132,6 +132,7 @@ struct wayland { struct wl_cursor *cursor; int size; char *theme_name; + const char *xcursor; } pointer; struct {