filter: drop the ntrackers argument from init_trackers

Reduces the duplication, everyone uses the same value anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-04-11 11:24:48 +10:00
parent cae84b84ae
commit f02c9b9734
5 changed files with 8 additions and 20 deletions

View file

@ -45,7 +45,6 @@
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
#define DEFAULT_INCLINE 1.1 /* unitless factor */
#define NUM_POINTER_TRACKERS 16
/**
* Custom acceleration function for mice < 1000dpi.
* At slow motion, a single device unit causes a one-pixel movement.
@ -227,7 +226,7 @@ create_default_filter(int dpi)
filter = zalloc(sizeof *filter);
filter->last_velocity = 0.0;
init_trackers(&filter->trackers, NUM_POINTER_TRACKERS);
init_trackers(&filter->trackers);
filter->threshold = DEFAULT_THRESHOLD;
filter->accel = DEFAULT_ACCELERATION;

View file

@ -88,8 +88,7 @@ struct pointer_accelerator {
int dpi;
};
void init_trackers(struct pointer_trackers *trackers,
size_t ntrackers);
void init_trackers(struct pointer_trackers *trackers);
void free_trackers(struct pointer_trackers *trackers);
void

View file

@ -60,11 +60,6 @@
#define X230_MAGIC_SLOWDOWN 0.4 /* unitless */
#define X230_TP_MAGIC_LOW_RES_FACTOR 4.0 /* unitless */
/*
* Pointer acceleration filter constants
*/
#define NUM_POINTER_TRACKERS 16
struct pointer_accelerator_x230 {
struct motion_filter base;
@ -345,7 +340,7 @@ create_pointer_accelerator_filter_lenovo_x230(int dpi)
filter->profile = touchpad_lenovo_x230_accel_profile;
filter->last_velocity = 0.0;
init_trackers(&filter->trackers, NUM_POINTER_TRACKERS);
init_trackers(&filter->trackers);
filter->threshold = X230_THRESHOLD;
filter->accel = X230_ACCELERATION; /* unitless factor */

View file

@ -48,11 +48,6 @@
#define TOUCHPAD_ACCELERATION 9.0 /* unitless factor */
#define TOUCHPAD_INCLINE 0.011 /* unitless factor */
/*
* Pointer acceleration filter constants
*/
#define NUM_POINTER_TRACKERS 16
/**
* Calculate the acceleration factor for the given delta with the timestamp.
*
@ -292,7 +287,7 @@ create_pointer_accelerator_filter_touchpad(int dpi,
filter = zalloc(sizeof *filter);
filter->last_velocity = 0.0;
init_trackers(&filter->trackers, NUM_POINTER_TRACKERS);
init_trackers(&filter->trackers);
filter->threshold = TOUCHPAD_DEFAULT_THRESHOLD;
filter->accel = TOUCHPAD_ACCELERATION;

View file

@ -102,12 +102,12 @@ filter_get_type(struct motion_filter *filter)
*/
#define MOTION_TIMEOUT ms2us(1000)
#define NUM_POINTER_TRACKERS 16
void
init_trackers(struct pointer_trackers *trackers,
size_t ntrackers)
init_trackers(struct pointer_trackers *trackers)
{
const int ntrackers = 16;
trackers->trackers = zalloc(ntrackers *
sizeof(*trackers->trackers));
trackers->ntrackers = ntrackers;
@ -566,7 +566,7 @@ create_default_filter(int dpi)
filter = zalloc(sizeof *filter);
filter->last_velocity = 0.0;
init_trackers(&filter->trackers, NUM_POINTER_TRACKERS);
init_trackers(&filter->trackers);
filter->threshold = DEFAULT_THRESHOLD;
filter->accel = DEFAULT_ACCELERATION;