summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-04-10 13:06:49 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-13 08:26:28 +1000
commitf68ddd9be4202333a1c3ccf536966a96dc0bfde7 (patch)
tree96f829211a0e4b4f1576905df5853d5bd65ac8ff
parentc745604461541c7b21779c60c9bd09ff1a390df2 (diff)
Don't count fingers twice when guessing distance (#48316)
A finger may be closer than the required distance to more than one finger. e.g. for fingers A, B, C, AB, AC and BC may trigger the check and count C twice -resulting in a 4 finger click. Avoid double-counting by marking those fingers already close enough to a previous finger to avoid overcounting. X.Org Bug 48316 <http://bugs.freedesktop.org/show_bug.cgi?id=48316> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--src/synaptics.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 918dc6f..3681b41 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2624,7 +2624,10 @@ clickpad_guess_clickfingers(SynapticsPrivate *priv, struct SynapticsHwState *hw)
{
int nfingers = 0;
#if HAVE_MULTITOUCH
+ char close_point[SYNAPTICS_MAX_TOUCHES] = {0}; /* 1 for each point close
+ to another one */
int i, j;
+
for (i = 0; i < hw->num_mt_mask - 1; i++) {
ValuatorMask *f1;
@@ -2655,14 +2658,18 @@ clickpad_guess_clickfingers(SynapticsPrivate *priv, struct SynapticsHwState *hw)
* you'll need to find a touchpad that doesn't lie about it's
* size. Good luck. */
if (abs(x1 - x2) < (priv->maxx - priv->minx) * .3 &&
- abs(y1 - y2) < (priv->maxy - priv->miny) * .3)
- nfingers++;
+ abs(y1 - y2) < (priv->maxy - priv->miny) * .3) {
+ close_point[j] = 1;
+ close_point[i] = 1;
+ }
}
}
+
+ for (i = 0; i < SYNAPTICS_MAX_TOUCHES; i++)
+ nfingers += close_point[i];
#endif
- /* 1 doesn't make sense */
- return nfingers ? nfingers + 1 : 0;
+ return nfingers;
}