diff options
author | Alexandros Frantzis <alexandros.frantzis@collabora.com> | 2017-11-16 18:21:00 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-11-27 11:42:07 +0200 |
commit | 7d2abcf6c8e7bf0cb137febfa43936ba9877c465 (patch) | |
tree | 8cc09f21bcb888377142e5a808a3f4f1730d2672 | |
parent | 27a51b83e56ac04ffd17b6220db3c2a46e9b09ae (diff) |
libweston: Use struct timespec for touch motion events
Change code related to touch motion events to use struct timespec to
represent time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | desktop-shell/shell.c | 5 | ||||
-rw-r--r-- | ivi-shell/hmi-controller.c | 5 | ||||
-rw-r--r-- | libweston-desktop/seat.c | 3 | ||||
-rw-r--r-- | libweston/compositor.h | 7 | ||||
-rw-r--r-- | libweston/data-device.c | 11 | ||||
-rw-r--r-- | libweston/input.c | 17 |
6 files changed, 29 insertions, 19 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 5823a481..564cbb58 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1355,8 +1355,9 @@ touch_move_grab_up(struct weston_touch_grab *grab, const struct timespec *time, } static void -touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y) +touch_move_grab_motion(struct weston_touch_grab *grab, + const struct timespec *time, int touch_id, + wl_fixed_t x, wl_fixed_t y) { struct weston_touch_move_grab *move = (struct weston_touch_move_grab *) grab; struct shell_surface *shsurf = move->base.shsurf; diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c index f9500ef5..5a2ff78c 100644 --- a/ivi-shell/hmi-controller.c +++ b/ivi-shell/hmi-controller.c @@ -1551,8 +1551,9 @@ pointer_move_grab_motion(struct weston_pointer_grab *grab, } static void -touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y) +touch_move_grab_motion(struct weston_touch_grab *grab, + const struct timespec *time, int touch_id, + wl_fixed_t x, wl_fixed_t y) { struct touch_move_grab *tch_move_grab = (struct touch_move_grab *)grab; diff --git a/libweston-desktop/seat.c b/libweston-desktop/seat.c index e160fd18..382b9e41 100644 --- a/libweston-desktop/seat.c +++ b/libweston-desktop/seat.c @@ -197,7 +197,8 @@ weston_desktop_seat_popup_grab_touch_up(struct weston_touch_grab *grab, static void weston_desktop_seat_popup_grab_touch_motion(struct weston_touch_grab *grab, - uint32_t time, int touch_id, + const struct timespec *time, + int touch_id, wl_fixed_t sx, wl_fixed_t sy) { weston_touch_send_motion(grab->touch, time, touch_id, sx, sy); diff --git a/libweston/compositor.h b/libweston/compositor.h index 40d192ee..5eff0262 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -313,7 +313,7 @@ struct weston_touch_grab_interface { const struct timespec *time, int touch_id); void (*motion)(struct weston_touch_grab *grab, - uint32_t time, + const struct timespec *time, int touch_id, wl_fixed_t sx, wl_fixed_t sy); @@ -522,8 +522,9 @@ void weston_touch_send_up(struct weston_touch *touch, const struct timespec *time, int touch_id); void -weston_touch_send_motion(struct weston_touch *touch, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y); +weston_touch_send_motion(struct weston_touch *touch, + const struct timespec *time, int touch_id, + wl_fixed_t x, wl_fixed_t y); void weston_touch_send_frame(struct weston_touch *touch); diff --git a/libweston/data-device.c b/libweston/data-device.c index 5821386e..b4bb4b37 100644 --- a/libweston/data-device.c +++ b/libweston/data-device.c @@ -770,14 +770,16 @@ drag_grab_touch_focus(struct weston_touch_drag *drag) } static void -drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y) +drag_grab_touch_motion(struct weston_touch_grab *grab, + const struct timespec *time, + int touch_id, wl_fixed_t x, wl_fixed_t y) { struct weston_touch_drag *touch_drag = container_of(grab, struct weston_touch_drag, grab); struct weston_touch *touch = grab->touch; wl_fixed_t view_x, view_y; float fx, fy; + uint32_t msecs; if (touch_id != touch->grab_touch_id) return; @@ -791,11 +793,12 @@ drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, } if (touch_drag->base.focus_resource) { + msecs = timespec_to_msec(time); weston_view_from_global_fixed(touch_drag->base.focus, touch->grab_x, touch->grab_y, &view_x, &view_y); - wl_data_device_send_motion(touch_drag->base.focus_resource, time, - view_x, view_y); + wl_data_device_send_motion(touch_drag->base.focus_resource, + msecs, view_x, view_y); } } diff --git a/libweston/input.c b/libweston/input.c index 996c00f7..0a694d13 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -752,12 +752,14 @@ default_grab_touch_up(struct weston_touch_grab *grab, * resources of the client which currently has the surface with touch focus. */ WL_EXPORT void -weston_touch_send_motion(struct weston_touch *touch, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y) +weston_touch_send_motion(struct weston_touch *touch, + const struct timespec *time, int touch_id, + wl_fixed_t x, wl_fixed_t y) { struct wl_resource *resource; struct wl_list *resource_list; wl_fixed_t sx, sy; + uint32_t msecs; if (!weston_touch_has_focus_resource(touch)) return; @@ -765,15 +767,17 @@ weston_touch_send_motion(struct weston_touch *touch, uint32_t time, weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy); resource_list = &touch->focus_resource_list; + msecs = timespec_to_msec(time); wl_resource_for_each(resource, resource_list) { - wl_touch_send_motion(resource, time, + wl_touch_send_motion(resource, msecs, touch_id, sx, sy); } } static void -default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, - int touch_id, wl_fixed_t x, wl_fixed_t y) +default_grab_touch_motion(struct weston_touch_grab *grab, + const struct timespec *time, int touch_id, + wl_fixed_t x, wl_fixed_t y) { weston_touch_send_motion(grab->touch, time, touch_id, x, y); } @@ -2203,8 +2207,7 @@ notify_touch(struct weston_seat *seat, const struct timespec *time, if (!ev) break; - grab->interface->motion(grab, timespec_to_msec(time), - touch_id, x, y); + grab->interface->motion(grab, time, touch_id, x, y); break; case WL_TOUCH_UP: if (touch->num_tp == 0) { |