[xf86-input-synaptics,v3,01/10] Add clickpad device property

Submitted by Chase Douglas on Feb. 23, 2012, 9:02 p.m.

Details

Message ID 1330030945-573-2-git-send-email-chase.douglas@canonical.com
State Accepted
Headers show

Not browsing as part of any series.

Commit Message

Chase Douglas Feb. 23, 2012, 9:02 p.m.
Add it as a writable device property. We may not know how to probe some
clickpads so allow the user to override it. It is currently not hooked
up to anything yet.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 include/synaptics-properties.h |    3 +++
 man/synaptics.man              |   10 ++++++++++
 src/properties.c               |    7 +++++++
 src/synaptics.c                |    1 +
 src/synapticsstr.h             |    1 +
 5 files changed, 22 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h
index c550cef..140f14b 100644
--- a/include/synaptics-properties.h
+++ b/include/synaptics-properties.h
@@ -49,6 +49,9 @@ 
 #define SYNAPTICS_PROP_TAP_DURATIONS "Synaptics Tap Durations"
 
 /* 8 bit (BOOL) */
+#define SYNAPTICS_PROP_CLICKPAD "Synaptics ClickPad"
+
+/* 8 bit (BOOL) */
 #define SYNAPTICS_PROP_TAP_FAST "Synaptics Tap FastTap"
 
 /* 32 bit */
diff --git a/man/synaptics.man b/man/synaptics.man
index b6b1dce..8edc2f0 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -143,6 +143,12 @@  Maximum time (in milliseconds) for detecting a double tap. Property:
 The duration of the mouse click generated by tapping. Property: "Synaptics Tap
 Durations"
 .TP 7
+.BI "Option \*qClickPad\*q \*q" boolean \*q
+Whether the device is a click pad. A click pad device has button(s) integrated
+into the touchpad surface. The user must press downward on the touchpad in order
+to generated a button press. This property may be set automatically if a click
+pad device is detected at initialization time. Property: "Synaptics ClickPad"
+.TP 7
 .BI "Option \*qFastTaps\*q \*q" boolean \*q
 Makes the driver react faster to a single tap, but also makes double
 clicks caused by double tapping slower. Property: "Synaptics Tap FastTap"
@@ -785,6 +791,10 @@  Properties supported:
 duration of a single click.
 
 .TP 7
+.BI "Synaptics ClickPad"
+8 bit (Bool).
+
+.TP 7
 .BI "Synaptics Tap FastTap"
 8 bit (BOOL).
 
diff --git a/src/properties.c b/src/properties.c
index 0a52801..38f21b2 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -58,6 +58,7 @@  Atom prop_finger                = 0;
 Atom prop_tap_time              = 0;
 Atom prop_tap_move              = 0;
 Atom prop_tap_durations         = 0;
+Atom prop_clickpad              = 0;
 Atom prop_tap_fast              = 0;
 Atom prop_middle_timeout        = 0;
 Atom prop_twofinger_pressure    = 0;
@@ -189,6 +190,8 @@  InitDeviceProperties(InputInfoPtr pInfo)
     values[2] = para->click_time;
 
     prop_tap_durations = InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_DURATIONS, 32, 3, values);
+    prop_clickpad = InitAtom(pInfo->dev, SYNAPTICS_PROP_CLICKPAD, 8, 1,
+                             &para->clickpad);
     prop_tap_fast = InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_FAST, 8, 1, &para->fast_taps);
     prop_middle_timeout = InitAtom(pInfo->dev, SYNAPTICS_PROP_MIDDLE_TIMEOUT,
                                    32, 1, &para->emulate_mid_button_time);
@@ -392,7 +395,11 @@  SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         para->single_tap_timeout = timeouts[0];
         para->tap_time_2         = timeouts[1];
         para->click_time         = timeouts[2];
+    } else if (property == prop_clickpad) {
+        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
+            return BadMatch;
 
+        para->clickpad = *(BOOL*)prop->data;
     } else if (property == prop_tap_fast)
     {
         if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
diff --git a/src/synaptics.c b/src/synaptics.c
index 4784157..4f6b65f 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -534,6 +534,7 @@  static void 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 = xf86SetIntOption(opts, "ClickPad", FALSE);
     pars->fast_taps = xf86SetBoolOption(opts, "FastTaps", FALSE);
     pars->emulate_mid_button_time = xf86SetIntOption(opts, "EmulateMidButtonTime", 75);
     pars->emulate_twofinger_z = xf86SetIntOption(opts, "EmulateTwoFingerMinZ", emulateTwoFingerMinZ);
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index ba1eb13..8f33b95 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -125,6 +125,7 @@  typedef struct _SynapticsParameters
     int single_tap_timeout;		    /* timeout to recognize a single tap */
     int tap_time_2;			    /* max. tapping time for double taps */
     int click_time;			    /* The duration of a single click */
+    Bool clickpad;                          /* Device is a has integrated buttons */
     Bool fast_taps;			    /* Faster reaction to single taps */
     int emulate_mid_button_time;	    /* Max time between left and right button presses to
 					       emulate a middle button press. */