[PATCH libinput 3/5] filter: pass the DPI to the acceleration filter
Hans de Goede
hdegoede at redhat.com
Fri Jun 26 01:17:38 PDT 2015
Hi Peter,
On 26-06-15 06:08, Peter Hutterer wrote:
> Currently unused, but store the ratio of DPI:default DPI for later use.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/evdev.c | 3 ++-
> src/evdev.h | 3 ---
> src/filter.c | 7 ++++++-
> src/filter.h | 3 ++-
> src/libinput-util.h | 3 +++
> tools/ptraccel-debug.c | 3 ++-
> 6 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 9602587..62e6b83 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1410,7 +1410,8 @@ int
> evdev_device_init_pointer_acceleration(struct evdev_device *device,
> accel_profile_func_t profile)
> {
> - device->pointer.filter = create_pointer_accelerator_filter(profile);
> + device->pointer.filter = create_pointer_accelerator_filter(profile,
> + device->dpi);
> if (!device->pointer.filter)
> return -1;
>
> diff --git a/src/evdev.h b/src/evdev.h
> index 0485894..4e77344 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -36,9 +36,6 @@
> #include "timer.h"
> #include "filter.h"
>
> -/* The HW DPI rate we normalize to before calculating pointer acceleration */
> -#define DEFAULT_MOUSE_DPI 1000
> -
> /*
> * The constant (linear) acceleration factor we use to normalize trackpoint
> * deltas before calculating pointer acceleration.
> diff --git a/src/filter.c b/src/filter.c
> index b37ca76..b1fd67f 100644
> --- a/src/filter.c
> +++ b/src/filter.c
> @@ -111,6 +111,8 @@ struct pointer_accelerator {
> double threshold; /* units/ms */
> double accel; /* unitless factor */
> double incline; /* incline of the function */
> +
> + double dpi_factor;
> };
>
> static void
"dpi_factor"
> @@ -346,7 +348,8 @@ struct motion_filter_interface accelerator_interface = {
> };
>
> struct motion_filter *
> -create_pointer_accelerator_filter(accel_profile_func_t profile)
> +create_pointer_accelerator_filter(accel_profile_func_t profile,
> + int dpi)
> {
> struct pointer_accelerator *filter;
>
> @@ -369,6 +372,8 @@ create_pointer_accelerator_filter(accel_profile_func_t profile)
> filter->accel = DEFAULT_ACCELERATION;
> filter->incline = DEFAULT_INCLINE;
>
> + filter->dpi = dpi;
> +
> return &filter->base;
> }
>
vs "dpi", you correct this in patch 5/5 :
@@ -372,15 +380,51 @@ create_pointer_accelerator_filter(accel_profile_func_t profile,
filter->accel = DEFAULT_ACCELERATION;
filter->incline = DEFAULT_INCLINE;
- filter->dpi = dpi;
+ filter->dpi_factor = dpi/(double)DEFAULT_MOUSE_DPI;
return &filter->base;
}
Otherwise the entire series looks good, if you squash in this bit from 5/5
into this patch (3/5) then this series is:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> diff --git a/src/filter.h b/src/filter.h
> index de94997..64a8b50 100644
> --- a/src/filter.h
> +++ b/src/filter.h
> @@ -58,7 +58,8 @@ typedef double (*accel_profile_func_t)(struct motion_filter *filter,
> uint64_t time);
>
> struct motion_filter *
> -create_pointer_accelerator_filter(accel_profile_func_t filter);
> +create_pointer_accelerator_filter(accel_profile_func_t filter,
> + int dpi);
>
> /*
> * Pointer acceleration profiles.
> diff --git a/src/libinput-util.h b/src/libinput-util.h
> index 0c56b76..00c93fe 100644
> --- a/src/libinput-util.h
> +++ b/src/libinput-util.h
> @@ -37,6 +37,9 @@
> #define VENDOR_ID_APPLE 0x5ac
> #define VENDOR_ID_WACOM 0x56a
>
> +/* The HW DPI rate we normalize to before calculating pointer acceleration */
> +#define DEFAULT_MOUSE_DPI 1000
> +
> void
> set_logging_enabled(int enabled);
>
> diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c
> index c774e3b..0cfe2b7 100644
> --- a/tools/ptraccel-debug.c
> +++ b/tools/ptraccel-debug.c
> @@ -199,7 +199,8 @@ main(int argc, char **argv)
> OPT_SPEED,
> };
>
> - filter = create_pointer_accelerator_filter(pointer_accel_profile_linear);
> + filter = create_pointer_accelerator_filter(pointer_accel_profile_linear,
> + 1000);
> assert(filter != NULL);
>
> while (1) {
>
More information about the wayland-devel
mailing list