From 5fa3ef26c9707b2624b872b1477868e807d2249c Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 8 Feb 2022 09:50:25 -0600 Subject: [PATCH] libweston: Use weston_coord for touch interfaces Most of these don't use the parameter that changes at all, but some get a nice simplification. Signed-off-by: Derek Foreman --- desktop-shell/shell.c | 4 ++-- include/libweston/libweston.h | 6 ++---- ivi-shell/hmi-controller.c | 4 ++-- kiosk-shell/kiosk-shell-grab.c | 4 ++-- libweston/data-device.c | 4 ++-- libweston/desktop/seat.c | 10 ++-------- libweston/input.c | 24 ++++++------------------ 7 files changed, 18 insertions(+), 38 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 3445dace..49a0557f 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -982,7 +982,7 @@ surface_keyboard_focus_lost(struct weston_surface *surface) static void touch_move_grab_down(struct weston_touch_grab *grab, const struct timespec *time, - int touch_id, wl_fixed_t x, wl_fixed_t y) + int touch_id, struct weston_coord_global c) { } @@ -1006,7 +1006,7 @@ touch_move_grab_up(struct weston_touch_grab *grab, const struct timespec *time, static void 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_coord_global unused) { struct weston_touch_move_grab *move = (struct weston_touch_move_grab *) grab; struct shell_surface *shsurf = move->base.shsurf; diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 6fef2902..bbe26b45 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -668,16 +668,14 @@ struct weston_touch_grab_interface { void (*down)(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t sx, - wl_fixed_t sy); + struct weston_coord_global c); void (*up)(struct weston_touch_grab *grab, const struct timespec *time, int touch_id); void (*motion)(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t sx, - wl_fixed_t sy); + struct weston_coord_global c); void (*frame)(struct weston_touch_grab *grab); void (*cancel)(struct weston_touch_grab *grab); }; diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c index 279e2471..ce5f1013 100644 --- a/ivi-shell/hmi-controller.c +++ b/ivi-shell/hmi-controller.c @@ -1712,7 +1712,7 @@ pointer_move_grab_motion(struct weston_pointer_grab *grab, static void 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_coord_global c) { struct touch_move_grab *tch_move_grab = (struct touch_move_grab *)grab; struct hmi_controller *hmi_ctrl = @@ -1748,7 +1748,7 @@ pointer_move_workspace_grab_button(struct weston_pointer_grab *grab, static void touch_nope_grab_down(struct weston_touch_grab *grab, const struct timespec *time, - int touch_id, wl_fixed_t sx, wl_fixed_t sy) + int touch_id, struct weston_coord_global c) { } diff --git a/kiosk-shell/kiosk-shell-grab.c b/kiosk-shell/kiosk-shell-grab.c index fb68f6b8..bff706fb 100644 --- a/kiosk-shell/kiosk-shell-grab.c +++ b/kiosk-shell/kiosk-shell-grab.c @@ -133,7 +133,7 @@ static const struct weston_pointer_grab_interface pointer_move_grab_interface = static void touch_move_grab_down(struct weston_touch_grab *grab, const struct timespec *time, - int touch_id, wl_fixed_t x, wl_fixed_t y) + int touch_id, struct weston_coord_global c) { } @@ -154,7 +154,7 @@ touch_move_grab_up(struct weston_touch_grab *touch_grab, static void touch_move_grab_motion(struct weston_touch_grab *touch_grab, const struct timespec *time, int touch_id, - wl_fixed_t x, wl_fixed_t y) + struct weston_coord_global unused) { struct kiosk_shell_grab *shgrab = container_of(touch_grab, struct kiosk_shell_grab, touch_grab); diff --git a/libweston/data-device.c b/libweston/data-device.c index 3abfa922..1c669875 100644 --- a/libweston/data-device.c +++ b/libweston/data-device.c @@ -753,7 +753,7 @@ static const struct weston_pointer_grab_interface pointer_drag_grab_interface = static void drag_grab_touch_down(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t sx, wl_fixed_t sy) + struct weston_coord_global c) { } @@ -801,7 +801,7 @@ drag_grab_touch_focus(struct weston_touch_drag *drag) static void drag_grab_touch_motion(struct weston_touch_grab *grab, const struct timespec *time, - int touch_id, wl_fixed_t x, wl_fixed_t y) + int touch_id, struct weston_coord_global unused) { struct weston_touch_drag *touch_drag = container_of(grab, struct weston_touch_drag, grab); diff --git a/libweston/desktop/seat.c b/libweston/desktop/seat.c index bc6b310a..ecdeaf17 100644 --- a/libweston/desktop/seat.c +++ b/libweston/desktop/seat.c @@ -190,11 +190,8 @@ static void weston_desktop_seat_popup_grab_touch_down(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t sx, wl_fixed_t sy) + struct weston_coord_global pos) { - struct weston_coord_global pos; - - pos.c = weston_coord_from_fixed(sx, sy); weston_touch_send_down(grab->touch, time, touch_id, pos); } @@ -210,11 +207,8 @@ static void weston_desktop_seat_popup_grab_touch_motion(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t sx, wl_fixed_t sy) + struct weston_coord_global pos) { - struct weston_coord_global pos; - - pos.c = weston_coord_from_fixed(sx, sy); weston_touch_send_motion(grab->touch, time, touch_id, pos); } diff --git a/libweston/input.c b/libweston/input.c index eb05fde2..21080f99 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -874,11 +874,8 @@ weston_touch_send_down(struct weston_touch *touch, const struct timespec *time, static void default_grab_touch_down(struct weston_touch_grab *grab, const struct timespec *time, int touch_id, - wl_fixed_t x, wl_fixed_t y) + struct weston_coord_global pos) { - struct weston_coord_global pos; - - pos.c = weston_coord_from_fixed(x, y); weston_touch_send_down(grab->touch, time, touch_id, pos); } @@ -966,11 +963,8 @@ weston_touch_send_motion(struct weston_touch *touch, static void default_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_coord_global pos) { - struct weston_coord_global pos; - - pos.c = weston_coord_from_fixed(x, y); weston_touch_send_motion(grab->touch, time, touch_id, pos); } @@ -2878,15 +2872,9 @@ process_touch_normal(struct weston_touch_device *device, struct weston_touch_grab *grab = device->aggregate->grab; struct weston_compositor *ec = device->aggregate->seat->compositor; struct weston_view *ev; - wl_fixed_t x, y; - if (pos) { - assert(touch_type != WL_TOUCH_UP); - x = wl_fixed_from_double(pos->c.x); - y = wl_fixed_from_double(pos->c.y); - } else { - assert(touch_type == WL_TOUCH_UP); - } + if (touch_type != WL_TOUCH_UP) + assert(pos); /* Update grab's global coordinates. */ if (touch_id == touch->grab_touch_id && touch_type != WL_TOUCH_UP) @@ -2912,7 +2900,7 @@ process_touch_normal(struct weston_touch_device *device, weston_compositor_run_touch_binding(ec, touch, time, touch_type); - grab->interface->down(grab, time, touch_id, x, y); + grab->interface->down(grab, time, touch_id, *pos); if (touch->num_tp == 1) { touch->grab_serial = wl_display_get_serial(ec->wl_display); @@ -2927,7 +2915,7 @@ process_touch_normal(struct weston_touch_device *device, if (!ev) break; - grab->interface->motion(grab, time, touch_id, x, y); + grab->interface->motion(grab, time, touch_id, *pos); break; case WL_TOUCH_UP: grab->interface->up(grab, time, touch_id);