Use typesafe coords in motion events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-03-11 10:43:18 +10:00
parent 47d7989682
commit 2d54b550b7
4 changed files with 18 additions and 28 deletions

View file

@ -89,8 +89,7 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time)
static void
tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
{
double dx_unaccel, dy_unaccel;
struct normalized_coords delta;
struct normalized_coords delta, unaccel;
/* When a clickpad is clicked, combine motion of all active touches */
if (tp->buttons.is_clickpad && tp->buttons.state)
@ -98,13 +97,12 @@ tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
else
delta = tp_get_average_touches_delta(tp);
tp_filter_motion(tp, &delta.x, &delta.y, &dx_unaccel, &dy_unaccel, time);
tp_filter_motion(tp, &delta.x, &delta.y, &unaccel.x, &unaccel.y, time);
if (delta.x != 0.0 || delta.y != 0.0 ||
dx_unaccel != 0.0 || dy_unaccel != 0.0) {
unaccel.x != 0.0 || unaccel.y != 0.0) {
pointer_notify_motion(&tp->device->base, time,
delta.x, delta.y,
dx_unaccel, dy_unaccel);
&delta, &unaccel);
}
}

View file

@ -279,9 +279,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
break;
}
pointer_notify_motion(base, time,
accel.x, accel.y,
unaccel.x, unaccel.x);
pointer_notify_motion(base, time, &accel, &unaccel);
break;
case EVDEV_ABSOLUTE_MT_DOWN:
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
@ -376,7 +374,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
touch_notify_touch_motion(base, time, -1, seat_slot, x, y);
} else if (device->seat_caps & EVDEV_DEVICE_POINTER) {
pointer_notify_motion_absolute(base, time, x, y);
pointer_notify_motion_absolute(base, time, &point);
}
break;
case EVDEV_ABSOLUTE_TOUCH_UP:

View file

@ -290,16 +290,13 @@ keyboard_notify_key(struct libinput_device *device,
void
pointer_notify_motion(struct libinput_device *device,
uint64_t time,
double dx,
double dy,
double dx_unaccel,
double dy_unaccel);
const struct normalized_coords *delta,
const struct normalized_coords *unaccel);
void
pointer_notify_motion_absolute(struct libinput_device *device,
uint64_t time,
double x,
double y);
const struct device_coords *point);
void
pointer_notify_button(struct libinput_device *device,

View file

@ -1098,10 +1098,8 @@ keyboard_notify_key(struct libinput_device *device,
void
pointer_notify_motion(struct libinput_device *device,
uint64_t time,
double dx,
double dy,
double dx_unaccel,
double dy_unaccel)
const struct normalized_coords *delta,
const struct normalized_coords *unaccel)
{
struct libinput_event_pointer *motion_event;
@ -1111,10 +1109,10 @@ pointer_notify_motion(struct libinput_device *device,
*motion_event = (struct libinput_event_pointer) {
.time = time,
.x = dx,
.y = dy,
.dx_unaccel = dx_unaccel,
.dy_unaccel = dy_unaccel,
.x = delta->x,
.y = delta->y,
.dx_unaccel = unaccel->x,
.dy_unaccel = unaccel->y,
};
post_device_event(device, time,
@ -1125,8 +1123,7 @@ pointer_notify_motion(struct libinput_device *device,
void
pointer_notify_motion_absolute(struct libinput_device *device,
uint64_t time,
double x,
double y)
const struct device_coords *point)
{
struct libinput_event_pointer *motion_absolute_event;
@ -1136,8 +1133,8 @@ pointer_notify_motion_absolute(struct libinput_device *device,
*motion_absolute_event = (struct libinput_event_pointer) {
.time = time,
.x = x,
.y = y,
.x = point->x,
.y = point->y,
};
post_device_event(device, time,