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.
dev
Neil Roberts 11 years ago committed by Kristian Høgsberg
parent aba0f25cb0
commit 306fe0838b
  1. 1
      src/compositor.h
  2. 7
      src/input.c

@ -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;

@ -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;

Loading…
Cancel
Save