[PATCH] xf86-input-synaptics: add an option to disable just the buttons

Alexander Polakov polachok at gmail.com
Mon Aug 1 15:21:44 PDT 2011


The options is TouchpadOff=3
This is an update version of a patch by Marius Gedminas
<marius at gedmin.as>, which can be found here:
http://mg.pov.lt/xserver-xorg-input-synaptics-0.14.6-touchpad-buttons-off.patch
---
 man/synaptics.man  |    1 +
 src/properties.c   |    2 +-
 src/synaptics.c    |    8 ++++++++
 src/synapticsstr.h |    1 +
 tools/synclient.c  |    2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/man/synaptics.man b/man/synaptics.man
index cb5f4c6..9e3eaab 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -298,6 +298,7 @@ l l.
 0	Touchpad is enabled
 1	Touchpad is switched off
 2	Only tapping and scrolling is switched off
+3	Only buttons switched off
 .TE
 Property: "Synaptics Off"
 .TP
diff --git a/src/properties.c b/src/properties.c
index 299a444..41585ec 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -534,7 +534,7 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
 
         off = *(CARD8*)prop->data;
 
-        if (off > 2)
+        if (off > 3)
             return BadValue;
 
         para->touchpad_off = off;
diff --git a/src/synaptics.c b/src/synaptics.c
index cf91b9f..0053397 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2452,6 +2452,14 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
     if (para->touchpad_off == 1)
 	return delay;
 
+    /*
+     * If only touchpad buttons are switched off, reset them before we process
+     * guest mouse status.
+     */
+    if (para->touchpad_off == 3) {
+	hw->left = hw->right = FALSE;
+    }
+
     /* 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. */
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index b2fecbe..3f808d1 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -141,6 +141,7 @@ typedef struct _SynapticsParameters
 					     * 0 : Not off
 					     * 1 : Off
 					     * 2 : Only tapping and scrolling off
+					     * 3 : Only buttons off
 					     */
     Bool locked_drags;			    /* Enable locked drags */
     int locked_drag_time;		    /* timeout for locked drags */
diff --git a/tools/synclient.c b/tools/synclient.c
index 08bd22b..0a7e586 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -110,7 +110,7 @@ static struct Parameter params[] = {
     {"UpDownScrollRepeat",    PT_BOOL,   0, 1,     SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT,   8,	0},
     {"LeftRightScrollRepeat", PT_BOOL,   0, 1,     SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT,   8,	1},
     {"ScrollButtonRepeat",    PT_INT,    SBR_MIN , SBR_MAX, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32,	0},
-    {"TouchpadOff",           PT_INT,    0, 2,     SYNAPTICS_PROP_OFF,		8,	0},
+    {"TouchpadOff",           PT_INT,    0, 3,     SYNAPTICS_PROP_OFF,		8,	0},
     {"LockedDrags",           PT_BOOL,   0, 1,     SYNAPTICS_PROP_LOCKED_DRAGS,	8,	0},
     {"LockedDragTimeout",     PT_INT,    0, 30000, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT,	32,	0},
     {"RTCornerButton",        PT_INT,    0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION,	8,	0},
-- 
1.7.6

-- 
Alexander Polakov | plhk.ru


More information about the xorg-devel mailing list