diff options
author | Derek Foreman <derek.foreman@collabora.com> | 2022-09-12 11:52:19 -0500 |
---|---|---|
committer | Derek Foreman <derek.foreman@collabora.com> | 2022-09-12 11:53:41 -0500 |
commit | 11ba13d7178d2c2c74373458ab32cb6ab66897b1 (patch) | |
tree | fcbff57009c4bca5f5d2c0a5fa068efd2518faef /clients | |
parent | a6b8f0f89cf7850e69faef31e3755776f0218bde (diff) | |
download | weston-11ba13d7178d2c2c74373458ab32cb6ab66897b1.tar.gz |
clients: Fix cursors when compositor gives wl_seat before wl_compositor
We have no guarantee that we can create a surface for the pointer at the
instant we receive a seat that will (probably eventually) need one.
Hold off until we receive an enter event before creating this - at that
point we know with certainty that wl_compositor is available, since we've
used it to create the surface that was entered.
Fixes #659
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Diffstat (limited to 'clients')
-rw-r--r-- | clients/window.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clients/window.c b/clients/window.c index 020e3cf6..3036bb42 100644 --- a/clients/window.c +++ b/clients/window.c @@ -2571,6 +2571,15 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, input->display->serial = serial; input->pointer_enter_serial = serial; input->pointer_focus = window; + + /* Some compositors advertise wl_seat before wl_compositor. This + * makes it potentially impossible to create the pointer surface + * when we bind the seat, so we need to create our pointer surface + * now instead. + */ + if (!input->pointer_surface) + input->pointer_surface = wl_compositor_create_surface(input->display->compositor); + input->pointer_surface_has_role = false; input->sx = sx; @@ -5743,7 +5752,6 @@ display_add_input(struct display *d, uint32_t id, int display_seat_version) input); } - input->pointer_surface = wl_compositor_create_surface(d->compositor); input->pointer_surface_has_role = false; toytimer_init(&input->cursor_timer, CLOCK_MONOTONIC, d, @@ -5813,7 +5821,8 @@ input_destroy(struct input *input) fini_xkb(input); - wl_surface_destroy(input->pointer_surface); + if (input->pointer_surface) + wl_surface_destroy(input->pointer_surface); wl_list_remove(&input->link); wl_seat_destroy(input->seat); |