diff options
author | Derek Foreman <derek.foreman@collabora.com> | 2022-08-10 11:44:17 -0500 |
---|---|---|
committer | Derek Foreman <derek.foreman@collabora.com> | 2022-08-10 13:05:07 -0500 |
commit | ebbe30df3c51c843af6a76b6bb10e85b703462df (patch) | |
tree | 700d2bb2951c8edd7ce2f29cfb61508e0f4bbe7e | |
parent | 8b0125d601296e59c87a3c7b4392852635adacb4 (diff) | |
download | weston-ebbe30df3c51c843af6a76b6bb10e85b703462df.tar.gz |
Revert "clients/window: atomically update pointer cursor"
This reverts commit 992ee045f1b59c037165ecdd752c2f2d78f16ee4.
Recreating the surface for every cursor change causes flickering
cursors on some compositors, and is not the best way to achieve
atomic cursor updates
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-rw-r--r-- | clients/window.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/clients/window.c b/clients/window.c index df343ea1..873ec090 100644 --- a/clients/window.c +++ b/clients/window.c @@ -3581,8 +3581,6 @@ input_set_pointer_image_index(struct input *input, int index) struct wl_buffer *buffer; struct wl_cursor *cursor; struct wl_cursor_image *image; - struct wl_surface *prev_surface; - struct display *d = input->display; if (!input->pointer) return; @@ -3601,11 +3599,6 @@ input_set_pointer_image_index(struct input *input, int index) if (!buffer) return; - /* Don't re-use the previous surface, otherwise the new buffer and the - * new hotspot aren't applied atomically. */ - prev_surface = input->pointer_surface; - input->pointer_surface = wl_compositor_create_surface(d->compositor); - wl_surface_attach(input->pointer_surface, buffer, 0, 0); wl_surface_damage(input->pointer_surface, 0, 0, image->width, image->height); @@ -3613,9 +3606,6 @@ input_set_pointer_image_index(struct input *input, int index) wl_pointer_set_cursor(input->pointer, input->pointer_enter_serial, input->pointer_surface, image->hotspot_x, image->hotspot_y); - - if (prev_surface) - wl_surface_destroy(prev_surface); } static const struct wl_callback_listener pointer_surface_listener; @@ -3720,11 +3710,11 @@ pointer_surface_frame_callback(void *data, struct wl_callback *callback, time - input->cursor_anim_start, &duration); - input_set_pointer_image_index(input, i); - if (cursor->image_count > 1) schedule_pointer_image_update(input, cursor, duration, force_frame); + + input_set_pointer_image_index(input, i); } static void @@ -5735,6 +5725,8 @@ display_add_input(struct display *d, uint32_t id, int display_seat_version) input); } + input->pointer_surface = wl_compositor_create_surface(d->compositor); + toytimer_init(&input->cursor_timer, CLOCK_MONOTONIC, d, cursor_timer_func); @@ -5802,8 +5794,7 @@ input_destroy(struct input *input) fini_xkb(input); - if (input->pointer_surface) - wl_surface_destroy(input->pointer_surface); + wl_surface_destroy(input->pointer_surface); wl_list_remove(&input->link); wl_seat_destroy(input->seat); |