diff options
author | Mykola Orliuk <virkony@gmail.com> | 2020-10-09 22:17:17 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-11-12 12:31:32 +0100 |
commit | 2eae9ec7c8b3f972f99cd34ab641bd9bc5e55589 (patch) | |
tree | 92c7d6dc17d4a3bc6209075794969f847c427e4d | |
parent | 44531e16e0edd3dbf6f7abe4afa930bceebcbf92 (diff) |
backend/wayland: Set cursor indivdualy per output
-rw-r--r-- | backend/wayland/output.c | 6 | ||||
-rw-r--r-- | backend/wayland/seat.c | 23 | ||||
-rw-r--r-- | include/backend/wayland.h | 2 |
3 files changed, 14 insertions, 17 deletions
diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 3899f7f4..abe8e43e 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -419,8 +419,10 @@ static void output_destroy(struct wlr_output *wlr_output) { } void update_wl_output_cursor(struct wlr_wl_output *output) { - struct wlr_wl_pointer *pointer = output->backend->current_pointer; - if (pointer && pointer->output == output && output->enter_serial) { + struct wlr_wl_pointer *pointer = output->cursor.pointer; + if (pointer) { + assert(pointer->output == output); + assert(output->enter_serial); wl_pointer_set_cursor(pointer->wl_pointer, output->enter_serial, output->cursor.surface, output->cursor.hotspot_x, output->cursor.hotspot_y); diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index cf841264..4b97bd48 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -43,7 +43,6 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) { struct wlr_wl_seat *seat = data; - struct wlr_wl_backend *backend = seat->backend; if (surface == NULL) { return; } @@ -54,7 +53,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, seat->active_pointer = pointer; // Manage cursor icon/rendering on output - struct wlr_wl_pointer *current_pointer = backend->current_pointer; + struct wlr_wl_pointer *current_pointer = output->cursor.pointer; if (current_pointer && current_pointer != pointer) { wlr_log(WLR_INFO, "Ignoring seat %s pointer cursor in favor of seat %s", seat->name, current_pointer->input_device->seat->name); @@ -62,14 +61,13 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, } output->enter_serial = serial; - backend->current_pointer = pointer; + output->cursor.pointer = pointer; update_wl_output_cursor(output); } static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface) { struct wlr_wl_seat *seat = data; - struct wlr_wl_backend *backend = seat->backend; if (surface == NULL) { return; } @@ -82,14 +80,10 @@ static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, seat->active_pointer = NULL; } - output->enter_serial = 0; - - if (backend->current_pointer == NULL || - backend->current_pointer->output != output) { - return; + if (output->cursor.pointer == seat->active_pointer) { + output->enter_serial = 0; + output->cursor.pointer = NULL; } - - backend->current_pointer = NULL; } static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, @@ -489,8 +483,8 @@ struct wlr_wl_pointer *pointer_get_wl(struct wlr_pointer *wlr_pointer) { static void pointer_destroy(struct wlr_pointer *wlr_pointer) { struct wlr_wl_pointer *pointer = pointer_get_wl(wlr_pointer); - if (pointer->output->backend->current_pointer == pointer) { - pointer->output->backend->current_pointer = NULL; + if (pointer->output->cursor.pointer == pointer) { + pointer->output->cursor.pointer = NULL; } struct wlr_wl_seat *seat = pointer->input_device->seat; @@ -782,9 +776,10 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, } wlr_log(WLR_DEBUG, "dropping pointer %s", pointer->input_device->wlr_input_device.name); + struct wlr_wl_output *output = pointer->output; wlr_input_device_destroy(device); assert(seat->active_pointer != pointer); - assert(backend->current_pointer != pointer); + assert(output->cursor.pointer != pointer); } wl_pointer_release(seat->pointer); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 9f64cdb7..9596b72c 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -40,7 +40,6 @@ struct wlr_wl_backend { struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1; struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1; struct wl_list seats; // wlr_wl_seat.link - struct wlr_wl_pointer *current_pointer; struct zwp_tablet_manager_v2 *tablet_manager; struct wlr_drm_format_set linux_dmabuf_v1_formats; }; @@ -75,6 +74,7 @@ struct wlr_wl_output { uint32_t enter_serial; struct { + struct wlr_wl_pointer *pointer; struct wl_surface *surface; struct wl_egl_window *egl_window; int32_t hotspot_x, hotspot_y; |