From 306fe0838b2a20d8cd0a86d2059d68b520690c88 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 3 Oct 2013 16:43:06 +0100 Subject: [PATCH] Only update the touch grab position for the first finger Previously if you add a second finger while moving a window with a touch grab then the position will keep jumping between the position of each finger as you move them around. This patch changes it so that it keeps track of the first touch id that starts the grab and only updates the grab position when that finger moves. --- src/compositor.h | 1 + src/input.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compositor.h b/src/compositor.h index 6199b01f0..4a2d65403 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -342,6 +342,7 @@ struct weston_touch { struct weston_touch_grab *grab; struct weston_touch_grab default_grab; + int grab_touch_id; wl_fixed_t grab_x, grab_y; uint32_t grab_serial; uint32_t grab_time; diff --git a/src/input.c b/src/input.c index 436b36c98..cd2d3bc70 100644 --- a/src/input.c +++ b/src/input.c @@ -1090,8 +1090,10 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, wl_fixed_t sx, sy; /* Update grab's global coordinates. */ - touch->grab_x = x; - touch->grab_y = y; + if (touch_id == touch->grab_touch_id && touch_type != WL_TOUCH_UP) { + touch->grab_x = x; + touch->grab_y = y; + } switch (touch_type) { case WL_TOUCH_DOWN: @@ -1121,6 +1123,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, if (seat->num_tp == 1) { touch->grab_serial = wl_display_get_serial(ec->wl_display); + touch->grab_touch_id = touch_id; touch->grab_time = time; touch->grab_x = x; touch->grab_y = y;