backend/wayland: Set cursor indivdualy per output
This commit is contained in:
parent
44531e16e0
commit
2eae9ec7c8
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
if (output->cursor.pointer == seat->active_pointer) {
|
||||
output->enter_serial = 0;
|
||||
|
||||
if (backend->current_pointer == NULL ||
|
||||
backend->current_pointer->output != output) {
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue