[PATCH weston 10/12] libweston: Use struct timespec for touch up events

Alexandros Frantzis alexandros.frantzis at collabora.com
Thu Nov 16 16:20:59 UTC 2017


Change code related to touch up 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      |  3 ++-
 ivi-shell/hmi-controller.c |  3 ++-
 libweston-desktop/seat.c   |  3 ++-
 libweston/compositor.h     |  5 +++--
 libweston/data-device.c    |  2 +-
 libweston/input.c          | 11 +++++++----
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 30cffed1..5823a481 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1338,7 +1338,8 @@ touch_move_grab_down(struct weston_touch_grab *grab,
 }
 
 static void
-touch_move_grab_up(struct weston_touch_grab *grab, uint32_t time, int touch_id)
+touch_move_grab_up(struct weston_touch_grab *grab, const struct timespec *time,
+		   int touch_id)
 {
 	struct weston_touch_move_grab *move =
 		(struct weston_touch_move_grab *) container_of(
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 9b99668c..f9500ef5 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -1591,7 +1591,8 @@ touch_nope_grab_down(struct weston_touch_grab *grab,
 }
 
 static void
-touch_move_workspace_grab_up(struct weston_touch_grab *grab, uint32_t time,
+touch_move_workspace_grab_up(struct weston_touch_grab *grab,
+			     const struct timespec *time,
 			     int touch_id)
 {
 	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 3e044fe1..e160fd18 100644
--- a/libweston-desktop/seat.c
+++ b/libweston-desktop/seat.c
@@ -189,7 +189,8 @@ weston_desktop_seat_popup_grab_touch_down(struct weston_touch_grab *grab,
 
 static void
 weston_desktop_seat_popup_grab_touch_up(struct weston_touch_grab *grab,
-					uint32_t time, int touch_id)
+					const struct timespec *time,
+					int touch_id)
 {
 	weston_touch_send_up(grab->touch, time, touch_id);
 }
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 9aadd83f..40d192ee 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -310,7 +310,7 @@ struct weston_touch_grab_interface {
 			wl_fixed_t sx,
 			wl_fixed_t sy);
 	void (*up)(struct weston_touch_grab *grab,
-			uint32_t time,
+			const struct timespec *time,
 			int touch_id);
 	void (*motion)(struct weston_touch_grab *grab,
 			uint32_t time,
@@ -519,7 +519,8 @@ void
 weston_touch_send_down(struct weston_touch *touch, const struct timespec *time,
 		       int touch_id, wl_fixed_t x, wl_fixed_t y);
 void
-weston_touch_send_up(struct weston_touch *touch, uint32_t time, int touch_id);
+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);
diff --git a/libweston/data-device.c b/libweston/data-device.c
index 1c7d546c..5821386e 100644
--- a/libweston/data-device.c
+++ b/libweston/data-device.c
@@ -738,7 +738,7 @@ data_device_end_touch_drag_grab(struct weston_touch_drag *drag)
 
 static void
 drag_grab_touch_up(struct weston_touch_grab *grab,
-		uint32_t time, int touch_id)
+		   const struct timespec *time, int touch_id)
 {
 	struct weston_touch_drag *touch_drag =
 		container_of(grab, struct weston_touch_drag, grab);
diff --git a/libweston/input.c b/libweston/input.c
index 73334bf8..996c00f7 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -713,25 +713,28 @@ default_grab_touch_down(struct weston_touch_grab *grab,
  * resources of the client which currently has the surface with touch focus.
  */
 WL_EXPORT void
-weston_touch_send_up(struct weston_touch *touch, uint32_t time, int touch_id)
+weston_touch_send_up(struct weston_touch *touch, const struct timespec *time,
+		     int touch_id)
 {
 	struct wl_display *display = touch->seat->compositor->wl_display;
 	uint32_t serial;
 	struct wl_resource *resource;
 	struct wl_list *resource_list;
+	uint32_t msecs;
 
 	if (!weston_touch_has_focus_resource(touch))
 		return;
 
 	resource_list = &touch->focus_resource_list;
 	serial = wl_display_next_serial(display);
+	msecs = timespec_to_msec(time);
 	wl_resource_for_each(resource, resource_list)
-		wl_touch_send_up(resource, serial, time, touch_id);
+		wl_touch_send_up(resource, serial, msecs, touch_id);
 }
 
 static void
 default_grab_touch_up(struct weston_touch_grab *grab,
-		      uint32_t time, int touch_id)
+		      const struct timespec *time, int touch_id)
 {
 	weston_touch_send_up(grab->touch, time, touch_id);
 }
@@ -2215,7 +2218,7 @@ notify_touch(struct weston_seat *seat, const struct timespec *time,
 		weston_compositor_idle_release(ec);
 		touch->num_tp--;
 
-		grab->interface->up(grab, timespec_to_msec(time), touch_id);
+		grab->interface->up(grab, time, touch_id);
 		if (touch->num_tp == 0)
 			weston_touch_set_focus(touch, NULL);
 		break;
-- 
2.14.1



More information about the wayland-devel mailing list