[PATCH synaptics] Provide a configuration knob for disabling motion events

Matthew Garrett matthew.garrett at nebula.com
Tue Aug 20 06:25:53 PDT 2013


Users with devices that provide both a touchpad and an alternative input
device may not want to use the touchpad for pointer motion but may still
want to use it for gesture-based inputs. Add a configuration knob that
allows them to do so.

Signed-off-by: Matthew Garrett <mjg59 at srcf.ucam.org>
---
 include/synaptics-properties.h |  3 +++
 man/synaptics.man              | 13 ++++++++++++-
 src/properties.c               | 11 +++++++++++
 src/synaptics.c                |  7 +++++--
 src/synapticsstr.h             |  1 +
 5 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h
index b717880..22a12cd 100644
--- a/include/synaptics-properties.h
+++ b/include/synaptics-properties.h
@@ -152,4 +152,7 @@
 /* 32 Bit Integer, 2 values, horizontal hysteresis, vertical hysteresis */
 #define SYNAPTICS_PROP_NOISE_CANCELLATION "Synaptics Noise Cancellation"
 
+/* 8 bit (BOOL) */
+#define SYNAPTICS_PROP_GESTURES_ONLY "Synaptics Gestures Only"
+
 #endif                          /* _SYNAPTICS_PROPERTIES_H_ */
diff --git a/man/synaptics.man b/man/synaptics.man
index 079a5f8..836bf69 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -447,6 +447,14 @@ soft button areas. Button areas may not overlap, however it is permitted for two
 buttons to share an edge value.
 Property: "Synaptics Soft Button Areas"
 .
+.TP
+.BI "Option \*qGesturesOnly\*q \*q" boolean \*q
+Disable pointer motion events.
+
+The option is disabled by default. If set, the driver will report gesture and
+button events but no pointer events.
+Property: "Synaptics Gestures Only"
+.
 
 .SH CONFIGURATION DETAILS
 .SS Area handling
@@ -822,6 +830,10 @@ disables the button area.
 32 bit, 8 values, RBL, RBR, RBT, RBB, MBL, MBR, MBT, MBB.
 
 .TP 7
+.BI "Synaptics Gestures Only"
+8 bit (BOOL).
+
+.TP 7
 .BI "Synaptics Capabilities"
 This read-only property expresses the physical capability of the touchpad,
 most notably whether the touchpad hardware supports multi-finger tapping and
@@ -833,7 +845,6 @@ right button, two-finger detection, three-finger detection, pressure detection,
 .TP 7
 .BI "Synaptics Pad Resolution"
 32 bit unsigned, 2 values (read-only), vertical, horizontal in units/millimeter.
-
 .SH "NOTES"
 Configuration through
 .I InputClass
diff --git a/src/properties.c b/src/properties.c
index dd88fc7..6e838ff 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -91,6 +91,7 @@ Atom prop_softbutton_areas = 0;
 Atom prop_noise_cancellation = 0;
 Atom prop_product_id = 0;
 Atom prop_device_node = 0;
+Atom prop_gestures_only = 0;
 
 static Atom
 InitTypedAtom(DeviceIntPtr dev, char *name, Atom type, int format, int nvalues,
@@ -341,6 +342,10 @@ InitDeviceProperties(InputInfoPtr pInfo)
                                        SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 2,
                                        values);
 
+    prop_gestures_only =
+        InitAtom(pInfo->dev, SYNAPTICS_PROP_GESTURES_ONLY, 8, 1,
+		 &para->gestures_only);
+
     /* only init product_id property if we actually know them */
     if (priv->id_vendor || priv->id_product) {
         values[0] = priv->id_vendor;
@@ -705,6 +710,12 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         para->hyst_x = hyst[0];
         para->hyst_y = hyst[1];
     }
+    else if (property == prop_gestures_only) {
+        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
+            return BadMatch;
+
+        para->gestures_only = *(BOOL *) prop->data;
+    }
     else if (property == prop_product_id || property == prop_device_node)
         return BadValue;        /* read-only */
     else { /* unknown property */
diff --git a/src/synaptics.c b/src/synaptics.c
index e391a98..8302cbb 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -646,7 +646,10 @@ set_default_parameters(InputInfoPtr pInfo)
     pars->tap_move = xf86SetIntOption(opts, "MaxTapMove", tapMove);
     pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180);
     pars->click_time = xf86SetIntOption(opts, "ClickTime", 100);
-    pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad);       /* Probed */
+    pars->gestures_only = xf86SetBoolOption(opts, "GesturesOnly",
+					    pars->gestures_only);
+    pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad);
+ /* Probed */
     /* middle mouse button emulation on a clickpad? nah, you're joking */
     middle_button_timeout = pars->clickpad ? 0 : 75;
     pars->emulate_mid_button_time =
@@ -2901,7 +2904,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     }
 
     /* Post events */
-    if (finger >= FS_TOUCHED && (dx || dy))
+    if (finger >= FS_TOUCHED && (dx || dy) && !para->gestures_only)
         xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
 
     if (priv->mid_emu_state == MBE_LEFT_CLICK) {
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index a9901a2..6678d34 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -196,6 +196,7 @@ typedef struct _SynapticsParameters {
     int area_left_edge, area_right_edge, area_top_edge, area_bottom_edge;       /* area coordinates absolute */
     int softbutton_areas[2][4]; /* soft button area coordinates, 0 => right, 1 => middle button */
     int hyst_x, hyst_y;         /* x and y width of hysteresis box */
+    Bool gestures_only;		/* do not post mouse input events */
 } SynapticsParameters;
 
 struct _SynapticsPrivateRec {
-- 
1.8.3.1



More information about the xorg-devel mailing list