input: Use weston_coord for weston_pointer_motion_to_rel

Use weston_coord for some internal stuff.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-02-02 08:21:40 -06:00 committed by Pekka Paalanen
parent d5132c6516
commit 905d16d23b

View File

@ -330,27 +330,21 @@ weston_pointer_motion_to_abs(struct weston_pointer *pointer,
static bool static bool
weston_pointer_motion_to_rel(struct weston_pointer *pointer, weston_pointer_motion_to_rel(struct weston_pointer *pointer,
struct weston_pointer_motion_event *event, struct weston_pointer_motion_event *event,
double *dx, double *dy, struct weston_coord *rel,
double *dx_unaccel, double *dy_unaccel) struct weston_coord *rel_unaccel)
{ {
if (event->mask & WESTON_POINTER_MOTION_REL && if (event->mask & WESTON_POINTER_MOTION_REL &&
event->mask & WESTON_POINTER_MOTION_REL_UNACCEL) { event->mask & WESTON_POINTER_MOTION_REL_UNACCEL) {
*dx = event->rel.x; *rel = event->rel;
*dy = event->rel.y; *rel_unaccel = event->rel_unaccel;
*dx_unaccel = event->rel_unaccel.x;
*dy_unaccel = event->rel_unaccel.y;
return true; return true;
} else if (event->mask & WESTON_POINTER_MOTION_REL) { } else if (event->mask & WESTON_POINTER_MOTION_REL) {
*dx = event->rel.x; *rel = event->rel;
*dy = event->rel.y; *rel_unaccel = event->rel;
*dx_unaccel = event->rel.x;
*dy_unaccel = event->rel.y;
return true; return true;
} else if (event->mask & WESTON_POINTER_MOTION_REL_UNACCEL) { } else if (event->mask & WESTON_POINTER_MOTION_REL_UNACCEL) {
*dx = event->rel_unaccel.x; *rel = event->rel_unaccel;
*dy = event->rel_unaccel.y; *rel_unaccel = event->rel_unaccel;
*dx_unaccel = event->rel_unaccel.x;
*dy_unaccel = event->rel_unaccel.y;
return true; return true;
} else { } else {
return false; return false;
@ -488,8 +482,7 @@ pointer_send_relative_motion(struct weston_pointer *pointer,
struct weston_pointer_motion_event *event) struct weston_pointer_motion_event *event)
{ {
uint64_t time_usec; uint64_t time_usec;
double dx, dy, dx_unaccel, dy_unaccel; struct weston_coord rel, rel_unaccel;
wl_fixed_t dxf, dyf, dxf_unaccel, dyf_unaccel;
struct wl_list *resource_list; struct wl_list *resource_list;
struct wl_resource *resource; struct wl_resource *resource;
@ -497,8 +490,8 @@ pointer_send_relative_motion(struct weston_pointer *pointer,
return; return;
if (!weston_pointer_motion_to_rel(pointer, event, if (!weston_pointer_motion_to_rel(pointer, event,
&dx, &dy, &rel,
&dx_unaccel, &dy_unaccel)) &rel_unaccel))
return; return;
resource_list = &pointer->focus_client->relative_pointer_resources; resource_list = &pointer->focus_client->relative_pointer_resources;
@ -506,18 +499,15 @@ pointer_send_relative_motion(struct weston_pointer *pointer,
if (time_usec == 0) if (time_usec == 0)
time_usec = timespec_to_usec(time); time_usec = timespec_to_usec(time);
dxf = wl_fixed_from_double(dx);
dyf = wl_fixed_from_double(dy);
dxf_unaccel = wl_fixed_from_double(dx_unaccel);
dyf_unaccel = wl_fixed_from_double(dy_unaccel);
wl_resource_for_each(resource, resource_list) { wl_resource_for_each(resource, resource_list) {
zwp_relative_pointer_v1_send_relative_motion( zwp_relative_pointer_v1_send_relative_motion(
resource, resource,
(uint32_t) (time_usec >> 32), (uint32_t) (time_usec >> 32),
(uint32_t) time_usec, (uint32_t) time_usec,
dxf, dyf, wl_fixed_from_double(rel.x),
dxf_unaccel, dyf_unaccel); wl_fixed_from_double(rel.y),
wl_fixed_from_double(rel_unaccel.x),
wl_fixed_from_double(rel_unaccel.y));
} }
} }