[PATCH weston 11/12] libweston: Use struct timespec for touch motion events
Alexandros Frantzis
alexandros.frantzis at collabora.com
Thu Nov 16 16:21:00 UTC 2017
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 at collabora.com>
---
desktop-shell/shell.c | 5 +++--
ivi-shell/hmi-controller.c | 5 +++--
libweston-desktop/seat.c | 3 ++-
libweston/compositor.h | 7 ++++---
libweston/data-device.c | 11 +++++++----
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) {
--
2.14.1
More information about the wayland-devel
mailing list