Blame SOURCES/0013-If-the-touchpad-is-in-TOUCHPAD_OFF-mode-allow-physic.patch

e94010
From ba4964d28a428525331baf99bf91b3a4ede26bce Mon Sep 17 00:00:00 2001
e94010
From: Peter Hutterer <peter.hutterer@who-t.net>
e94010
Date: Mon, 17 Mar 2014 14:55:37 +1000
e94010
Subject: [PATCH synaptics 13/14] If the touchpad is in TOUCHPAD_OFF mode,
e94010
 allow physical clicks
e94010
e94010
Enabling clicks in off mode also allows for the new Lenovo *40 series to use
e94010
the top software buttons while the touchpad is disabled. This benefits those
e94010
that usually disable touchpads altogether but still need the buttons for the
e94010
trackstick.
e94010
e94010
This changes existing behaviour, but TouchpadOff was always intended to stop
e94010
erroneous events while typing. Physical button presses are hard to trigger
e94010
accidentally. On the touchpads that TouchpadOff concept was originally
e94010
designed for the buttons are nowhere near the keyboard and are physically
e94010
separated from the touchpad anyway. On Clickpads, triggering a physical
e94010
click requires more force than accidentally touching the surface.
e94010
e94010
https://bugs.freedesktop.org/show_bug.cgi?id=76156
e94010
e94010
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
e94010
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
e94010
(cherry picked from commit dc5474964d4ec73b5c324961026e1037bb344946)
e94010
(cherry picked from commit 11b2814c17c17cc43cf1b22f56998b100e59cf04)
e94010
---
e94010
 man/synaptics.man |  7 ++++++-
e94010
 src/synaptics.c   | 17 +++++++----------
e94010
 2 files changed, 13 insertions(+), 11 deletions(-)
e94010
e94010
diff --git a/man/synaptics.man b/man/synaptics.man
e94010
index 88009f6..86eb663 100644
e94010
--- a/man/synaptics.man
e94010
+++ b/man/synaptics.man
e94010
@@ -226,9 +226,14 @@ Valid values are:
e94010
 .TS
e94010
 l l.
e94010
 0	Touchpad is enabled
e94010
-1	Touchpad is switched off
e94010
+1	Touchpad is switched off (physical clicks still work)
e94010
 2	Only tapping and scrolling is switched off
e94010
 .TE
e94010
+When the touchpad is switched off, button events caused by a physical
e94010
+button press are still interpreted. On a ClickPad, this includes
e94010
+software-emulated middle and right buttons as defined by
e94010
+the SoftButtonAreas setting.
e94010
+.TP
e94010
 Property: "Synaptics Off"
e94010
 .TP
e94010
 .BI "Option \*qLockedDrags\*q \*q" boolean \*q
e94010
diff --git a/src/synaptics.c b/src/synaptics.c
e94010
index 512ca8d..78adfaf 100644
e94010
--- a/src/synaptics.c
e94010
+++ b/src/synaptics.c
e94010
@@ -1856,7 +1856,8 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
e94010
     enum EdgeType edge;
e94010
     int delay = 1000000000;
e94010
 
e94010
-    if (priv->finger_state == FS_BLOCKED)
e94010
+    if (para->touchpad_off == TOUCHPAD_OFF ||
e94010
+        priv->finger_state == FS_BLOCKED)
e94010
         return delay;
e94010
 
e94010
     touch = finger >= FS_TOUCHED && priv->finger_state == FS_UNTOUCHED;
e94010
@@ -2274,7 +2275,9 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
e94010
     SynapticsParameters *para = &priv->synpara;
e94010
     int delay = 1000000000;
e94010
 
e94010
-    if ((priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) || (priv->finger_state == FS_BLOCKED)) {
e94010
+    if (priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF ||
e94010
+        priv->synpara.touchpad_off == TOUCHPAD_OFF ||
e94010
+        priv->finger_state == FS_BLOCKED) {
e94010
         stop_coasting(priv);
e94010
         priv->circ_scroll_on = FALSE;
e94010
         priv->vert_scroll_edge_on = FALSE;
e94010
@@ -2883,12 +2886,6 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
e94010
     Bool using_cumulative_coords = FALSE;
e94010
     Bool ignore_motion;
e94010
 
e94010
-    /* If touchpad is switched off, we skip the whole thing and return delay */
e94010
-    if (para->touchpad_off == TOUCHPAD_OFF) {
e94010
-        UpdateTouchState(pInfo, hw);
e94010
-        return delay;
e94010
-    }
e94010
-
e94010
     /* We need both and x/y, the driver can't handle just one of the two
e94010
      * yet. But since it's possible to hit a phys button on non-clickpads
e94010
      * without ever getting motion data first, we must continue with 0/0 for
e94010
@@ -2927,8 +2924,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
e94010
              current_button_area(para, hw->x, hw->y) == NO_BUTTON_AREA)
e94010
         priv->last_button_area = NO_BUTTON_AREA;
e94010
 
e94010
-    ignore_motion =
e94010
-        !using_cumulative_coords && priv->last_button_area != NO_BUTTON_AREA;
e94010
+    ignore_motion = para->touchpad_off == TOUCHPAD_OFF ||
e94010
+        (!using_cumulative_coords && priv->last_button_area != NO_BUTTON_AREA);
e94010
 
e94010
     /* these two just update hw->left, right, etc. */
e94010
     update_hw_button_state(pInfo, hw, now, &delay);
e94010
-- 
e94010
1.9.3
e94010