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>
dev
Alexandros Frantzis 7 years ago committed by Pekka Paalanen
parent 27a51b83e5
commit 7d2abcf6c8
  1. 5
      desktop-shell/shell.c
  2. 5
      ivi-shell/hmi-controller.c
  3. 3
      libweston-desktop/seat.c
  4. 7
      libweston/compositor.h
  5. 11
      libweston/data-device.c
  6. 17
      libweston/input.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;

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

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

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

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

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

Loading…
Cancel
Save