touchpad: Simplify tp_hysteresis
authorHans de Goede <hdegoede@redhat.com>
Mon, 30 Jun 2014 12:27:18 +0000 (14:27 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 1 Jul 2014 00:54:18 +0000 (10:54 +1000)
commit14ad471ff5797ca5a77a377aeaad07833af63144
treefc9b1a3905273ea5cd677db88a6ddc8536bce1d5
parent053c16c5a3b4733746ae19a7b10a9678899ed470
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>
src/evdev-mt-touchpad.c