Peter Hutterer 66aaa5d
From 2cf6be8c910e8f4b4d516a470c6e43ed4e713f34 Mon Sep 17 00:00:00 2001
Peter Hutterer 66aaa5d
From: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer 66aaa5d
Date: Wed, 19 Feb 2014 18:30:35 +0100
Peter Hutterer 66aaa5d
Subject: [PATCH synaptics 01/11] Allow using the entire touchpad for motions
Peter Hutterer 66aaa5d
 started inside the active area
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
synaptics offers an option to make parts of the touchpad insensitive. This
Peter Hutterer 66aaa5d
is ie useful to do palm avoidance rather then palm detection (which may be
Peter Hutterer 66aaa5d
unreliable) by disabling an area of 15% on the right and left side of the
Peter Hutterer 66aaa5d
touchpad.
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
Currently a motion which has started inside the active area, stops as soon
Peter Hutterer 66aaa5d
as it moves outside of the active area.
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
If a motion started inside the active area and thus has already generated some
Peter Hutterer 66aaa5d
move events, this makes no sense. If the user moves outside of the active
Peter Hutterer 66aaa5d
area in this case, this is very likely because the user wants to continue
Peter Hutterer 66aaa5d
the motion.
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
This commit allows such motions to continue normally.
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
I would like to thank Juerd Waalboer for the basic idea, some coding and lots
Peter Hutterer 66aaa5d
of testing for this fix.
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
Cc: Juerd Waalboer <juerd@tnx.nl>
Peter Hutterer 66aaa5d
Reported-by: Juerd Waalboer <juerd@tnx.nl>
Peter Hutterer 66aaa5d
Tested-by: Juerd Waalboer <juerd@tnx.nl>
Peter Hutterer 66aaa5d
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer 66aaa5d
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 66aaa5d
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 66aaa5d
(cherry picked from commit 945acfc261707be78cbc5438c22b061e20076004)
Peter Hutterer 66aaa5d
---
Peter Hutterer 66aaa5d
 man/synaptics.man | 15 ++++++++-------
Peter Hutterer 66aaa5d
 src/synaptics.c   | 11 ++++++-----
Peter Hutterer 66aaa5d
 2 files changed, 14 insertions(+), 12 deletions(-)
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
diff --git a/man/synaptics.man b/man/synaptics.man
Peter Hutterer 66aaa5d
index 7da7527..a7889c7 100644
Peter Hutterer 66aaa5d
--- a/man/synaptics.man
Peter Hutterer 66aaa5d
+++ b/man/synaptics.man
Peter Hutterer 66aaa5d
@@ -441,7 +441,7 @@ Property: "Synaptics Pad Resolution"
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 .TP
Peter Hutterer 66aaa5d
 .BI "Option \*qAreaLeftEdge\*q \*q" integer \*q
Peter Hutterer 66aaa5d
-Ignore movements, scrolling and tapping which take place left of this edge.
Peter Hutterer 66aaa5d
+Ignore movements, scrolling and tapping which start left of this edge.
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 The option is disabled by default and can be enabled by setting the
Peter Hutterer 66aaa5d
 AreaLeftEdge option to any integer value other than zero. If supported by the
Peter Hutterer 66aaa5d
@@ -450,7 +450,7 @@ the total width of the touchpad. Property: "Synaptics Area"
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 .TP
Peter Hutterer 66aaa5d
 .BI "Option \*qAreaRightEdge\*q \*q" integer \*q
Peter Hutterer 66aaa5d
-Ignore movements, scrolling and tapping which take place right of this edge.
Peter Hutterer 66aaa5d
+Ignore movements, scrolling and tapping which start right of this edge.
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 The option is disabled by default and can be enabled by setting the
Peter Hutterer 66aaa5d
 AreaRightEdge option to any integer value other than zero. If supported by the
Peter Hutterer 66aaa5d
@@ -459,7 +459,7 @@ the total width of the touchpad. Property: "Synaptics Area"
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 .TP
Peter Hutterer 66aaa5d
 .BI "Option \*qAreaTopEdge\*q \*q" integer \*q
Peter Hutterer 66aaa5d
-Ignore movements, scrolling and tapping which take place above this edge.
Peter Hutterer 66aaa5d
+Ignore movements, scrolling and tapping which start above this edge.
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 The option is disabled by default and can be enabled by setting the
Peter Hutterer 66aaa5d
 AreaTopEdge option to any integer value other than zero. If supported by the
Peter Hutterer 66aaa5d
@@ -468,7 +468,7 @@ the total height of the touchpad. Property: "Synaptics Area"
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 .TP
Peter Hutterer 66aaa5d
 .BI "Option \*qAreaBottomEdge\*q \*q" integer \*q
Peter Hutterer 66aaa5d
-Ignore movements, scrolling and tapping which take place below this edge.
Peter Hutterer 66aaa5d
+Ignore movements, scrolling and tapping which start below this edge.
Peter Hutterer 66aaa5d
 .
Peter Hutterer 66aaa5d
 The option is disabled by default and can be enabled by setting the
Peter Hutterer 66aaa5d
 AreaBottomEdge option to any integer value other than zero. If supported by the
Peter Hutterer 66aaa5d
@@ -532,9 +532,10 @@ the touchpad.
Peter Hutterer 66aaa5d
 .PP
Peter Hutterer 66aaa5d
 The perceived physical edges may be adjusted with the AreaLeftEdge,
Peter Hutterer 66aaa5d
 AreaRightEdge, AreaTopEdge, and AreaBottomEdge options. If these values are
Peter Hutterer 66aaa5d
-set to something other than the physical edges, input in the space between
Peter Hutterer 66aaa5d
-the area edge and the respective physical edge is ignored. Note that this
Peter Hutterer 66aaa5d
-reduces the available space on the touchpad.
Peter Hutterer 66aaa5d
+set to something other than the physical edges, input that starts in the
Peter Hutterer 66aaa5d
+space between the area edge and the respective physical edge is ignored.
Peter Hutterer 66aaa5d
+Note that this reduces the available space on the touchpad to start motions
Peter Hutterer 66aaa5d
+in.
Peter Hutterer 66aaa5d
 .SS Tapping
Peter Hutterer 66aaa5d
 A tap event happens when the finger is touched and released in a time
Peter Hutterer 66aaa5d
 interval shorter than MaxTapTime, and the touch and release
Peter Hutterer 66aaa5d
diff --git a/src/synaptics.c b/src/synaptics.c
Peter Hutterer 66aaa5d
index 0986e20..6f4b8a3 100644
Peter Hutterer 66aaa5d
--- a/src/synaptics.c
Peter Hutterer 66aaa5d
+++ b/src/synaptics.c
Peter Hutterer 66aaa5d
@@ -1436,6 +1436,11 @@ is_inside_active_area(SynapticsPrivate * priv, int x, int y)
Peter Hutterer 66aaa5d
 {
Peter Hutterer 66aaa5d
     Bool inside_area = TRUE;
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
+    /* If a finger is down, then it must have started inside the active_area,
Peter Hutterer 66aaa5d
+       allow the motion to complete using the entire area */
Peter Hutterer 66aaa5d
+    if (priv->finger_state >= FS_TOUCHED)
Peter Hutterer 66aaa5d
+        return TRUE;
Peter Hutterer 66aaa5d
+
Peter Hutterer 66aaa5d
     if ((priv->synpara.area_left_edge != 0) &&
Peter Hutterer 66aaa5d
         (x < priv->synpara.area_left_edge))
Peter Hutterer 66aaa5d
         inside_area = FALSE;
Peter Hutterer 66aaa5d
@@ -3011,13 +3016,9 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
Peter Hutterer 66aaa5d
        invalid are: x, y, z, numFingers, fingerWidth
Peter Hutterer 66aaa5d
        valid are: millis, left/right/middle/up/down/etc.
Peter Hutterer 66aaa5d
      */
Peter Hutterer 66aaa5d
-    if (!inside_active_area) {
Peter Hutterer 66aaa5d
+    if (!inside_active_area)
Peter Hutterer 66aaa5d
         reset_hw_state(hw);
Peter Hutterer 66aaa5d
Peter Hutterer 66aaa5d
-        /* FIXME: if finger accidentally moves into the area and doesn't
Peter Hutterer 66aaa5d
-         * really release, the finger should remain down. */
Peter Hutterer 66aaa5d
-    }
Peter Hutterer 66aaa5d
-
Peter Hutterer 66aaa5d
     /* no edge or finger detection outside of area */
Peter Hutterer 66aaa5d
     if (inside_active_area) {
Peter Hutterer 66aaa5d
         edge = edge_detection(priv, hw->x, hw->y);
Peter Hutterer 66aaa5d
--
Peter Hutterer 66aaa5d
1.8.5.3