wayland_common: drop shape device check when spawning cursor

It's only necessary to check the existance of cursor_shape_manager.
Also drop the pointer check to handle multi-seat since a removed seat
sets the cursor_seat to NULL.
This commit is contained in:
nanahi 2024-02-13 01:51:19 -05:00 committed by Dudemanguy
parent b441a5dd1f
commit fb33bb7fc4
2 changed files with 2 additions and 12 deletions

View File

@ -242,7 +242,6 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
struct vo_wayland_seat *s = data;
struct vo_wayland_state *wl = s->wl;
wl->cursor_seat = s;
set_cursor_visibility(s, wl->cursor_visible);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
}
@ -1557,8 +1556,6 @@ static void registry_handle_remove(void *data, struct wl_registry *reg, uint32_t
wl_list_for_each_safe(seat, seat_tmp, &wl->seat_list, link) {
if (seat->id == id) {
remove_seat(seat);
if (seat == wl->cursor_seat)
wl->cursor_seat = NULL;
return;
}
}
@ -2093,12 +2090,9 @@ static void set_window_bounds(struct vo_wayland_state *wl)
static int spawn_cursor(struct vo_wayland_state *wl)
{
struct vo_wayland_seat *s = wl->cursor_seat;
/* Don't use this if we have cursor-shape. */
if (s && s->cursor_shape_device)
if (wl->cursor_shape_manager)
return 0;
/* Reuse if size is identical */
if ((s && !s->pointer) || wl->allocated_cursor_scale == wl->scaling)
if (wl->allocated_cursor_scale == wl->scaling)
return 0;
else if (wl->cursor_theme)
wl_cursor_theme_destroy(wl->cursor_theme);
@ -2739,7 +2733,6 @@ void vo_wayland_uninit(struct vo *vo)
wl_list_for_each_safe(output, output_tmp, &wl->output_list, link)
remove_output(output);
wl->cursor_seat = NULL;
struct vo_wayland_seat *seat, *seat_tmp;
wl_list_for_each_safe(seat, seat_tmp, &wl->seat_list, link)
remove_seat(seat);

View File

@ -22,8 +22,6 @@
#include "input/event.h"
#include "vo.h"
struct vo_wayland_seat;
typedef struct {
uint32_t format;
uint32_t padding;
@ -158,7 +156,6 @@ struct vo_wayland_state {
struct wl_surface *cursor_surface;
bool cursor_visible;
int allocated_cursor_scale;
struct vo_wayland_seat *cursor_seat;
};
bool vo_wayland_check_visible(struct vo *vo);