From dc4f9deaee8f220ef7cb70ced4f18b39bb22bb10 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 8 Feb 2017 15:05:54 -0600 Subject: [PATCH] weston-resizor: Don't add new frame callbacks every click The frame callback added on button click re-adds itself when done, so adding a new one every click resulted in an ever increasing number of callbacks. Signed-off-by: Derek Foreman Acked-by: Daniel Stone --- clients/resizor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clients/resizor.c b/clients/resizor.c index 5d342e1f..600452ad 100644 --- a/clients/resizor.c +++ b/clients/resizor.c @@ -53,6 +53,7 @@ struct resizor { struct spring height; struct wl_callback *frame_callback; bool pointer_locked; + bool locked_frame_callback_registered; struct input *locked_input; float pointer_x; float pointer_y; @@ -330,11 +331,15 @@ button_handler(struct widget *widget, handle_pointer_unlocked); resizor->locked_input = input; + if (resizor->locked_frame_callback_registered) + return; + surface = window_get_wl_surface(resizor->window); callback = wl_surface_frame(surface); wl_callback_add_listener(callback, &locked_pointer_frame_listener, resizor); + resizor->locked_frame_callback_registered = true; } else if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_RELEASED) { input_set_pointer_image(input, CURSOR_LEFT_PTR);