On Tue, Dec 02, 2014 at 09:44:16PM +0800, Jonas Ådahl wrote:
> For certain applications (such as FPS games) it is necessary to use
> non-accelerated motion events (the motion vector that is passed to the
> acceleration filter) to get a more natural feeling. Supply this
> information by passing both accelerated and non-accelerated motion
> vectors to the existing motion event.
>
> Note that the non-accelerated motion event is not equivalent to 'raw'
> events as read from devices.
ACK to the patch itself, needs more documentation though. Like this sentence
which should be in the doc.
> Signed-off-by: Jonas Ådahl
> ---
> src/evdev-mt-touchpad-edge-scroll.c | 2 +-
> src/evdev-mt-touchpad.c | 20 ++
> src/evdev-mt-touchpad.h | 4 ++-
> src/evdev.c | 19 ++
> src/libinput-private.h | 4 ++-
> src/libinput.c | 20 +-
> src/libinput.h | 30 +
> test/pointer.c | 52
> +
> 8 files changed, 137 insertions(+), 14 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad-edge-scroll.c
> b/src/evdev-mt-touchpad-edge-scroll.c
> index 1dca0ea..d68fc68 100644
> --- a/src/evdev-mt-touchpad-edge-scroll.c
> +++ b/src/evdev-mt-touchpad-edge-scroll.c
> @@ -338,7 +338,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp,
> uint64_t time)
> }
>
> tp_get_delta(t, &dx, &dy);
> - tp_filter_motion(tp, &dx, &dy, time);
> + tp_filter_motion(tp, &dx, &dy, NULL, NULL, time);
>
> if (fabs(*delta) < t->scroll.threshold)
> continue;
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 8f76ddb..ff76fe2 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -58,13 +58,20 @@ tp_motion_history_offset(struct tp_touch *t, int offset)
>
> void
> tp_filter_motion(struct tp_dispatch *tp,
> - double *dx, double *dy, uint64_t time)
> + double *dx, double *dy,
> + double *dx_noaccel, double *dy_noaccel,
> + uint64_t time)
> {
> struct motion_params motion;
>
> motion.dx = *dx * tp->accel.x_scale_coeff;
> motion.dy = *dy * tp->accel.y_scale_coeff;
>
> + if (dx_noaccel)
> + *dx_noaccel = motion.dx;
> + if (dy_noaccel)
> + *dy_noaccel = motion.dy;
> +
> if (motion.dx != 0.0 || motion.dy != 0.0)
> filter_dispatch(tp->device->pointer.filter, &motion, tp, time);
>
> @@ -426,7 +433,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t
> time)
> dx /= nchanged;
> dy /= nchanged;
>
> - tp_filter_motion(tp, &dx, &dy, time);
> + tp_filter_motion(tp, &dx, &dy, NULL, NULL, time);
>
> evdev_post_scroll(tp->device, time, dx, dy);
> }
> @@ -586,6 +593,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
> struct tp_touch *t = tp_current_touch(tp);
> double dx, dy;
> int filter_motion = 0;
> + double dx_noaccel, dy_noaccel;
>
> /* Only post (top) button events while suspended */
> if (tp->device->suspended) {
> @@ -617,10 +625,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
> return;
>
> tp_get_delta(t, &dx, &dy);
> - tp_filter_motion(tp, &dx, &dy, time);
> + tp_filter_motion(tp, &dx, &dy, &dx_noaccel, &dy_noaccel, time);
>
> - if (dx != 0.0 || dy != 0.0)
> - pointer_notify_motion(&tp->device->base, time, dx, dy);
> + if (dx != 0.0 || dy != 0.0 || dx_noaccel != 0.0 || dy_noaccel != 0.0) {
> + pointer_notify_motion(&tp->device->base, time,
> + dx, dy, dx_noaccel, dy_noaccel);
> + }
> }
>
> static void
> diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
> index b2603b4..ea77062 100644
> --- a/src/evdev-mt-touchpad.h
> +++ b/src/evdev-mt-touchpad.h
> @@ -276,7 +276,9 @@ tp_set_pointer(struct tp_dispatch *tp, struct tp_touch
> *t);
>
> void
> tp_filter_motion(struct tp_dispatch *tp,
> - double *dx, double *dy, uint64_t time);
> + double *dx, double *dy,
> + double *dx_noaccel, double *dy_noaccel,
> + uint64_t time);
>
> int
> tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
> diff --git a/src/evdev.c b/src/evdev.c
> index 908a8ba..f7d88c4 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -198,6 +198,7 @@ evdev_flush_pending_event(struct evdev_device *device,
> uint64_t time)
> {
> struct libinput *libinput = device->base.seat->libinput;
> struct motion_params motion;
> + double dx_noaccel, dy_noaccel;
> int32_t cx, cy;
> int32_t x, y;
> int slot;
> @@ -211,8 +212,10 @@ evdev_flush_pending_event(struct evdev_device *device,
> uint64_t time)
> case EVDEV_NONE:
>