diff options
author | Giulio Camuffo <giuliocamuffo@gmail.com> | 2015-07-08 11:55:28 +0300 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2015-08-06 16:21:01 +0100 |
commit | 61ed7b6bf06895b6e0ac8e3c5fff12e491449fd9 (patch) | |
tree | d8f6e0861a0ca847edd51452d6f493821eddc729 /src/input.c | |
parent | 7239d74bb3d43c46c958079e7c8f759371599455 (diff) | |
download | weston-61ed7b6bf06895b6e0ac8e3c5fff12e491449fd9.tar.gz |
input: pass the global touch coordinates to the touch grab
This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'src/input.c')
-rw-r--r-- | src/input.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/input.c b/src/input.c index 8f24ccd5..3227db46 100644 --- a/src/input.c +++ b/src/input.c @@ -236,13 +236,16 @@ static const struct weston_pointer_grab_interface static void default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t sx, wl_fixed_t sy) + int touch_id, wl_fixed_t x, wl_fixed_t y) { struct weston_touch *touch = grab->touch; struct wl_display *display = touch->seat->compositor->wl_display; uint32_t serial; struct wl_resource *resource; struct wl_list *resource_list; + wl_fixed_t sx, sy; + + weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy); resource_list = &touch->focus_resource_list; @@ -276,11 +279,14 @@ default_grab_touch_up(struct weston_touch_grab *grab, static void default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t sx, wl_fixed_t sy) + int touch_id, wl_fixed_t x, wl_fixed_t y) { struct weston_touch *touch = grab->touch; struct wl_resource *resource; struct wl_list *resource_list; + wl_fixed_t sx, sy; + + weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy); resource_list = &touch->focus_resource_list; @@ -1535,10 +1541,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, if (touch->num_tp == 1) { ev = weston_compositor_pick_view(ec, x, y, &sx, &sy); weston_touch_set_focus(touch, ev); - } else if (touch->focus) { - ev = touch->focus; - weston_view_from_global_fixed(ev, x, y, &sx, &sy); - } else { + } else if (!touch->focus) { /* Unexpected condition: We have non-initial touch but * there is no focused surface. */ @@ -1550,7 +1553,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, weston_compositor_run_touch_binding(ec, touch, time, touch_type); - grab->interface->down(grab, time, touch_id, sx, sy); + grab->interface->down(grab, time, touch_id, x, y); if (touch->num_tp == 1) { touch->grab_serial = wl_display_get_serial(ec->wl_display); @@ -1566,8 +1569,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, if (!ev) break; - weston_view_from_global_fixed(ev, x, y, &sx, &sy); - grab->interface->motion(grab, time, touch_id, sx, sy); + grab->interface->motion(grab, time, touch_id, x, y); break; case WL_TOUCH_UP: if (touch->num_tp == 0) { |