From 8e80a31ba4f09dd27793cca42c5e412e9a167af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 17 Jan 2014 15:18:10 -0800 Subject: [PATCH] shell: Stop moving surfae after touch point 0 goes up The grab stays alive as long as at least one touch point is down. If touch point 0 is lifted while other touch points are down, the surface will jump around when touch point 0 is put down again. This change marks the grab as inactive once touch point 0 is lifted and then ignores touch events until all touch points eventually are lifted and the grab terminates. https://bugs.freedesktop.org/show_bug.cgi?id=73750 --- desktop-shell/shell.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 137ec7ab0..e3ef66ff3 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -198,6 +198,7 @@ struct weston_move_grab { struct weston_touch_move_grab { struct shell_touch_grab base; + int active; wl_fixed_t dx, dy; }; @@ -1313,6 +1314,9 @@ touch_move_grab_up(struct weston_touch_grab *grab, uint32_t time, int touch_id) (struct weston_touch_move_grab *) container_of( grab, struct shell_touch_grab, grab); + if (touch_id == 0) + move->active = 0; + if (grab->touch->num_tp == 0) { shell_touch_grab_end(&move->base); free(move); @@ -1329,7 +1333,7 @@ touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time, int dx = wl_fixed_to_int(grab->touch->grab_x + move->dx); int dy = wl_fixed_to_int(grab->touch->grab_y + move->dy); - if (!shsurf) + if (!shsurf || !move->active) return; es = shsurf->surface; @@ -1374,6 +1378,7 @@ surface_touch_move(struct shell_surface *shsurf, struct weston_seat *seat) if (!move) return -1; + move->active = 1; move->dx = wl_fixed_from_double(shsurf->view->geometry.x) - seat->touch->grab_x; move->dy = wl_fixed_from_double(shsurf->view->geometry.y) -