libweston: Use struct timespec for touch up events

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@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Alexandros Frantzis 2017-11-16 18:20:59 +02:00 committed by Pekka Paalanen
parent 9448deb073
commit 27a51b83e5
6 changed files with 17 additions and 10 deletions

View File

@ -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(

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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;