mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 13:38:40 +02:00
filter: apply the same factor for constant motion as for normal motion
Users that want a flat pointer acceleration want the input speed to match 1:1 to the output speed, barring a fixed constant multiplier. This will apply to things like button scrolling as well, so let's map the constant accel function to the non-constant accel functions to the speed setting applies to every movement. This is applied to both the flat and the touchpad flat filter. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
49707691c8
commit
7ba0af575b
2 changed files with 24 additions and 14 deletions
|
|
@ -65,11 +65,18 @@ accelerator_filter_noop_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data, uint64_t time)
|
void *data, uint64_t time)
|
||||||
{
|
{
|
||||||
const struct normalized_coords normalized = {
|
/* We map the unaccelerated flat filter to have the same behavior as
|
||||||
.x = unaccelerated->x,
|
* the "accelerated" flat filter.
|
||||||
.y = unaccelerated->y,
|
* The filter by definition is flat, i.e. it does not actually
|
||||||
};
|
* apply any acceleration (merely a constant factor) and we can assume
|
||||||
return normalized;
|
* that a user wants all mouse movement to have the same speed, mapped
|
||||||
|
* 1:1 to the input speed.
|
||||||
|
*
|
||||||
|
* Thus we apply the same factor to our non-accelerated motion - this way
|
||||||
|
* things like button scrolling end up having the same movement as
|
||||||
|
* pointer motion.
|
||||||
|
*/
|
||||||
|
return accelerator_filter_flat(filter, unaccelerated, data, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
|
|
@ -69,15 +69,18 @@ accelerator_filter_noop_touchpad_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data, uint64_t time)
|
void *data, uint64_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator_flat *accel =
|
/* We map the unaccelerated flat filter to have the same behavior as
|
||||||
(struct touchpad_accelerator_flat *) filter;
|
* the "accelerated" flat filter.
|
||||||
struct normalized_coords normalized;
|
* The filter by definition is flat, i.e. it does not actually
|
||||||
|
* apply any acceleration (merely a constant factor) and we can assume
|
||||||
normalized = normalize_for_dpi(unaccelerated, accel->dpi);
|
* that a user wants all mouse movement to have the same speed, mapped
|
||||||
normalized.x = TP_MAGIC_SLOWDOWN_FLAT * normalized.x;
|
* 1:1 to the input speed.
|
||||||
normalized.y = TP_MAGIC_SLOWDOWN_FLAT * normalized.y;
|
*
|
||||||
|
* Thus we apply the same factor to our non-accelerated motion - this way
|
||||||
return normalized;
|
* things like gestures end up having the same movement as
|
||||||
|
* pointer motion.
|
||||||
|
*/
|
||||||
|
return accelerator_filter_touchpad_flat(filter, unaccelerated, data, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue