backend/wayland: tag wl_surface

When integrating wlroots with another toolkit, wlroots may receive
wl_pointer.enter events for surfaces not backed by a wlr_output.
Ignore such surfaces by tagging the ones we're aware of with
wl_proxy_set_tag().
This commit is contained in:
Simon Ser 2023-06-14 18:16:44 +02:00
parent dd24991c9e
commit 4f88886199
4 changed files with 32 additions and 5 deletions

View file

@ -38,8 +38,10 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
return;
}
struct wlr_wl_output *output = wl_surface_get_user_data(surface);
assert(output);
struct wlr_wl_output *output = get_wl_output_from_surface(seat->backend, surface);
if (output == NULL) {
return;
}
struct wlr_wl_pointer *pointer = output_get_pointer(output, wl_pointer);
seat->active_pointer = pointer;
@ -64,8 +66,10 @@ static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
return;
}
struct wlr_wl_output *output = wl_surface_get_user_data(surface);
assert(output);
struct wlr_wl_output *output = get_wl_output_from_surface(seat->backend, surface);
if (output == NULL) {
return;
}
if (seat->active_pointer != NULL &&
seat->active_pointer->output == output) {