File xf86-input-synaptics-filter-bogus-coord.diff of Package xorg-x11-driver-input
---
src/eventcomm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -363,6 +363,21 @@
struct SynapticsHwState *hw = &(comm->hwState);
SynapticsPrivate *priv = (SynapticsPrivate *)local->private;
SynapticsParameters *para = &priv->synpara;
+ int minx, miny, maxx, maxy, x;
+
+ /* range to filger out; a bit wider range is allowed since some devices
+ * are too fuzzy and give slightly shifted positions
+ */
+ minx = priv->minx;
+ maxx = priv->maxx;
+ x = (maxx - minx) / 5;
+ minx -= (minx > x) ? x : minx;
+ maxx += x;
+ miny = priv->miny;
+ maxy = priv->maxy;
+ x = (maxy - miny) / 5;
+ maxy += miny;
+ miny -= (miny > x) ? x : miny;
while (SynapticsReadEvent(local, &ev)) {
switch (ev.type) {
@@ -377,6 +392,9 @@
hw->numFingers = 3;
else
hw->numFingers = 0;
+ /* if the coord is out of range, we filter it out */
+ if (priv->is_clickpad && hw->z > 0 && (hw->x < minx || hw->x > maxx || hw->y < miny || hw->y > maxy))
+ return FALSE;
*hwRet = *hw;
return TRUE;
}