mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-01 19:52:53 +00:00
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 <derek.foreman@collabora.com>
This commit is contained in:
parent
8eed64c7df
commit
5fa3ef26c9
|
@ -982,7 +982,7 @@ surface_keyboard_focus_lost(struct weston_surface *surface)
|
||||||
static void
|
static void
|
||||||
touch_move_grab_down(struct weston_touch_grab *grab,
|
touch_move_grab_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
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
|
static void
|
||||||
touch_move_grab_motion(struct weston_touch_grab *grab,
|
touch_move_grab_motion(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time, int touch_id,
|
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 weston_touch_move_grab *move = (struct weston_touch_move_grab *) grab;
|
||||||
struct shell_surface *shsurf = move->base.shsurf;
|
struct shell_surface *shsurf = move->base.shsurf;
|
||||||
|
|
|
@ -668,16 +668,14 @@ struct weston_touch_grab_interface {
|
||||||
void (*down)(struct weston_touch_grab *grab,
|
void (*down)(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id,
|
int touch_id,
|
||||||
wl_fixed_t sx,
|
struct weston_coord_global c);
|
||||||
wl_fixed_t sy);
|
|
||||||
void (*up)(struct weston_touch_grab *grab,
|
void (*up)(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id);
|
int touch_id);
|
||||||
void (*motion)(struct weston_touch_grab *grab,
|
void (*motion)(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id,
|
int touch_id,
|
||||||
wl_fixed_t sx,
|
struct weston_coord_global c);
|
||||||
wl_fixed_t sy);
|
|
||||||
void (*frame)(struct weston_touch_grab *grab);
|
void (*frame)(struct weston_touch_grab *grab);
|
||||||
void (*cancel)(struct weston_touch_grab *grab);
|
void (*cancel)(struct weston_touch_grab *grab);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ pointer_move_grab_motion(struct weston_pointer_grab *grab,
|
||||||
static void
|
static void
|
||||||
touch_move_grab_motion(struct weston_touch_grab *grab,
|
touch_move_grab_motion(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time, int touch_id,
|
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 touch_move_grab *tch_move_grab = (struct touch_move_grab *)grab;
|
||||||
struct hmi_controller *hmi_ctrl =
|
struct hmi_controller *hmi_ctrl =
|
||||||
|
@ -1748,7 +1748,7 @@ pointer_move_workspace_grab_button(struct weston_pointer_grab *grab,
|
||||||
static void
|
static void
|
||||||
touch_nope_grab_down(struct weston_touch_grab *grab,
|
touch_nope_grab_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
|
int touch_id, struct weston_coord_global c)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ static const struct weston_pointer_grab_interface pointer_move_grab_interface =
|
||||||
static void
|
static void
|
||||||
touch_move_grab_down(struct weston_touch_grab *grab,
|
touch_move_grab_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
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
|
static void
|
||||||
touch_move_grab_motion(struct weston_touch_grab *touch_grab,
|
touch_move_grab_motion(struct weston_touch_grab *touch_grab,
|
||||||
const struct timespec *time, int touch_id,
|
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 =
|
struct kiosk_shell_grab *shgrab =
|
||||||
container_of(touch_grab, struct kiosk_shell_grab, touch_grab);
|
container_of(touch_grab, struct kiosk_shell_grab, touch_grab);
|
||||||
|
|
|
@ -753,7 +753,7 @@ static const struct weston_pointer_grab_interface pointer_drag_grab_interface =
|
||||||
static void
|
static void
|
||||||
drag_grab_touch_down(struct weston_touch_grab *grab,
|
drag_grab_touch_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time, int touch_id,
|
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
|
static void
|
||||||
drag_grab_touch_motion(struct weston_touch_grab *grab,
|
drag_grab_touch_motion(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
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 =
|
struct weston_touch_drag *touch_drag =
|
||||||
container_of(grab, struct weston_touch_drag, grab);
|
container_of(grab, struct weston_touch_drag, grab);
|
||||||
|
|
|
@ -190,11 +190,8 @@ static void
|
||||||
weston_desktop_seat_popup_grab_touch_down(struct weston_touch_grab *grab,
|
weston_desktop_seat_popup_grab_touch_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id,
|
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);
|
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,
|
weston_desktop_seat_popup_grab_touch_motion(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time,
|
const struct timespec *time,
|
||||||
int touch_id,
|
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);
|
weston_touch_send_motion(grab->touch, time, touch_id, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -874,11 +874,8 @@ weston_touch_send_down(struct weston_touch *touch, const struct timespec *time,
|
||||||
static void
|
static void
|
||||||
default_grab_touch_down(struct weston_touch_grab *grab,
|
default_grab_touch_down(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time, int touch_id,
|
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);
|
weston_touch_send_down(grab->touch, time, touch_id, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,11 +963,8 @@ weston_touch_send_motion(struct weston_touch *touch,
|
||||||
static void
|
static void
|
||||||
default_grab_touch_motion(struct weston_touch_grab *grab,
|
default_grab_touch_motion(struct weston_touch_grab *grab,
|
||||||
const struct timespec *time, int touch_id,
|
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);
|
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_touch_grab *grab = device->aggregate->grab;
|
||||||
struct weston_compositor *ec = device->aggregate->seat->compositor;
|
struct weston_compositor *ec = device->aggregate->seat->compositor;
|
||||||
struct weston_view *ev;
|
struct weston_view *ev;
|
||||||
wl_fixed_t x, y;
|
|
||||||
|
|
||||||
if (pos) {
|
if (touch_type != WL_TOUCH_UP)
|
||||||
assert(touch_type != WL_TOUCH_UP);
|
assert(pos);
|
||||||
x = wl_fixed_from_double(pos->c.x);
|
|
||||||
y = wl_fixed_from_double(pos->c.y);
|
|
||||||
} else {
|
|
||||||
assert(touch_type == WL_TOUCH_UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update grab's global coordinates. */
|
/* Update grab's global coordinates. */
|
||||||
if (touch_id == touch->grab_touch_id && touch_type != WL_TOUCH_UP)
|
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,
|
weston_compositor_run_touch_binding(ec, touch,
|
||||||
time, touch_type);
|
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) {
|
if (touch->num_tp == 1) {
|
||||||
touch->grab_serial =
|
touch->grab_serial =
|
||||||
wl_display_get_serial(ec->wl_display);
|
wl_display_get_serial(ec->wl_display);
|
||||||
|
@ -2927,7 +2915,7 @@ process_touch_normal(struct weston_touch_device *device,
|
||||||
if (!ev)
|
if (!ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
grab->interface->motion(grab, time, touch_id, x, y);
|
grab->interface->motion(grab, time, touch_id, *pos);
|
||||||
break;
|
break;
|
||||||
case WL_TOUCH_UP:
|
case WL_TOUCH_UP:
|
||||||
grab->interface->up(grab, time, touch_id);
|
grab->interface->up(grab, time, touch_id);
|
||||||
|
|
Loading…
Reference in a new issue