mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 18:10:28 +01:00
touchpad: Simplify tp_hysteresis
Once we get beyond the: if (abs(diff) <= margin) return center; test, then diff is either > margin or < -margin, otherwise the test would have triggered. So the "return center + diff;" at the end will never be reached, and the "else if (diff < -margin)" can be turned into a simple "else". This commit does not just simplify tp_hysteresis, but (arguably more important) also makes it clearer to the reader what it does. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
053c16c5a3
commit
14ad471ff5
1 changed files with 1 additions and 2 deletions
|
|
@ -42,9 +42,8 @@ tp_hysteresis(int in, int center, int margin)
|
|||
|
||||
if (diff > margin)
|
||||
return center + diff - margin;
|
||||
else if (diff < -margin)
|
||||
else
|
||||
return center + diff + margin;
|
||||
return center + diff;
|
||||
}
|
||||
|
||||
static double
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue