summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-09 13:39:32 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-14 08:46:35 +1000
commitf0381f48a9383313e65508ec710b5c690b16286a (patch)
tree354945cf24de9dae9034b9c5f13ec57fb14f4b02
parent4eea50d513bca888d8fe13759d0cc44de67bc4c0 (diff)
Move filtering into a separate function
No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--src/synaptics.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 89bc349..e7adc5b 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2743,6 +2743,17 @@ out:
#endif
}
+static void
+filter_jitter(SynapticsPrivate *priv, int *x, int *y)
+{
+ SynapticsParameters *para = &priv->synpara;
+
+ priv->hyst_center_x = hysteresis(*x, priv->hyst_center_x, para->hyst_x);
+ priv->hyst_center_y = hysteresis(*y, priv->hyst_center_y, para->hyst_y);
+ *x = priv->hyst_center_x;
+ *y = priv->hyst_center_y;
+}
+
/*
* React on changes in the hardware state. This function is called every time
* the hardware state changes. The return value is used to specify how many
@@ -2780,10 +2791,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
/* apply hysteresis before doing anything serious. This cancels
* out a lot of noise which might surface in strange phenomena
* like flicker in scrolling or noise motion. */
- priv->hyst_center_x = hysteresis(hw->x, priv->hyst_center_x, para->hyst_x);
- priv->hyst_center_y = hysteresis(hw->y, priv->hyst_center_y, para->hyst_y);
- hw->x = priv->hyst_center_x;
- hw->y = priv->hyst_center_y;
+ filter_jitter(priv, &hw->x, &hw->y);
inside_active_area = is_inside_active_area(priv, hw->x, hw->y);