diff options
author | Derek Foreman <derek.foreman@collabora.com> | 2022-08-10 11:43:37 -0500 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2022-08-12 10:55:42 +0300 |
commit | 2f6a824f0479f47ab0f6d8261cfa71e6d8188761 (patch) | |
tree | a55c97952ad9e5046c0eebfd71dfed07bdf71ad5 | |
parent | a569bc2a300416344c51fa5f69e405cae41ce1fb (diff) | |
download | weston-2f6a824f0479f47ab0f6d8261cfa71e6d8188761.tar.gz |
Revert "clients/window: Fix animated cursors"
This reverts commit f079f43658d9cbffa402a84101b31072775d3619.
This only partially fixed a problem introduced in
992ee045f1b59c037165ecdd752c2f2d78f16ee4
I'm reverting that commit in favor of a different fix, so this
broken fix needs to go first.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 8b0125d601296e59c87a3c7b4392852635adacb4)
-rw-r--r-- | clients/window.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/clients/window.c b/clients/window.c index a0d988f4..d37fc9f6 100644 --- a/clients/window.c +++ b/clients/window.c @@ -354,6 +354,7 @@ struct input { struct wl_surface *pointer_surface; uint32_t modifiers; uint32_t pointer_enter_serial; + uint32_t cursor_serial; float sx, sy; struct wl_list link; @@ -2748,12 +2749,6 @@ input_remove_pointer_focus(struct input *input) input->pointer_focus = NULL; input->current_cursor = CURSOR_UNSET; cancel_pointer_image_update(input); - wl_surface_destroy(input->pointer_surface); - input->pointer_surface = NULL; - if (input->cursor_frame_cb) { - wl_callback_destroy(input->cursor_frame_cb); - input->cursor_frame_cb = NULL; - } } static void @@ -3883,7 +3878,6 @@ schedule_pointer_image_update(struct input *input, wl_callback_add_listener(input->cursor_frame_cb, &pointer_surface_listener, input); - wl_surface_commit(input->pointer_surface); } static void @@ -3967,15 +3961,30 @@ static const struct wl_callback_listener pointer_surface_listener = { void input_set_pointer_image(struct input *input, int pointer) { + int force = 0; + if (!input->pointer) return; - if (pointer == input->current_cursor) + if (input->pointer_enter_serial > input->cursor_serial) + force = 1; + + if (!force && pointer == input->current_cursor) return; input->current_cursor = pointer; + input->cursor_serial = input->pointer_enter_serial; if (!input->cursor_frame_cb) pointer_surface_frame_callback(input, NULL, 0); + else if (force && !input_set_pointer_special(input)) { + /* The current frame callback may be stuck if, for instance, + * the set cursor request was processed by the server after + * this client lost the focus. In this case the cursor surface + * might not be mapped and the frame callback wouldn't ever + * complete. Send a set_cursor and attach to try to map the + * cursor surface again so that the callback will finish */ + input_set_pointer_image_index(input, 0); + } } struct wl_data_device * |