diff options
author | Marcel Dejean <Doodle777@gmail.com> | 2009-02-13 19:00:07 -0500 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-02-20 11:32:46 +1000 |
commit | 3ddc067c873479d886d6bc576db9dcb6318c88af (patch) | |
tree | 2ed4e945bac31d55b6e24a1b9f7f96ef06c904d4 | |
parent | b0704a9d3c7a25e0b160414983025db9d14be496 (diff) |
two-finger emulation through fingerWidth
Signed-off-by: Christoph Brill <egore911@egore911.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/synaptics-properties.h | 3 | ||||
-rw-r--r-- | include/synaptics.h | 1 | ||||
-rw-r--r-- | man/synaptics.man | 5 | ||||
-rw-r--r-- | src/properties.c | 9 | ||||
-rw-r--r-- | src/synaptics.c | 8 | ||||
-rw-r--r-- | tools/synclient.c | 1 |
6 files changed, 25 insertions, 2 deletions
diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h index be8e3bf..0b8975c 100644 --- a/include/synaptics-properties.h +++ b/include/synaptics-properties.h @@ -57,6 +57,9 @@ /* 32 bit */ #define SYNAPTICS_PROP_TWOFINGER_PRESSURE "Synaptics Two-Finger Pressure" +/* 32 bit */ +#define SYNAPTICS_PROP_TWOFINGER_WIDTH "Synaptics Two-Finger Width" + /* 32 bit, 2 values, vert, horiz */ #define SYNAPTICS_PROP_SCROLL_DISTANCE "Synaptics Scrolling Distance" diff --git a/include/synaptics.h b/include/synaptics.h index 7e55293..28031d5 100644 --- a/include/synaptics.h +++ b/include/synaptics.h @@ -88,6 +88,7 @@ typedef struct _SynapticsSHM int emulate_mid_button_time; /* Max time between left and right button presses to emulate a middle button press. */ int emulate_twofinger_z; /* pressure threshold to emulate two finger touch (for Alps) */ + int emulate_twofinger_w; /* Finger width threshold to emulate two finger touch */ int scroll_dist_vert; /* Scrolling distance in absolute coordinates */ int scroll_dist_horiz; /* Scrolling distance in absolute coordinates */ Bool scroll_edge_vert; /* Enable/disable vertical scrolling on right edge */ diff --git a/man/synaptics.man b/man/synaptics.man index 6cf98ed..a6f9e95 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -242,6 +242,11 @@ Maximum time (in milliseconds) for middle button emulation. For touchpads not capable of detecting multiple fingers (Alps), this sets the Z pressure threshold to emulate a two finger press. .TP +.BI "Option \*qEmulateTwoFingerMinW\*q \*q" integer \*q +Some touchpads report a two-finger touch as wide finger. This sets the finger +width threshold to emulate a two finger press. This feature works best with +(\fBPalmDetect\fR) off. +.TP .BI "Option \*qTouchpadOff\*q \*q" integer \*q Switch off the touchpad. . diff --git a/src/properties.c b/src/properties.c index 8b8334d..681f77f 100644 --- a/src/properties.c +++ b/src/properties.c @@ -52,6 +52,7 @@ Atom prop_tap_durations = 0; Atom prop_tap_fast = 0; Atom prop_middle_timeout = 0; Atom prop_twofinger_pressure = 0; +Atom prop_twofinger_width = 0; Atom prop_scrolldist = 0; Atom prop_scrolledge = 0; Atom prop_scrolltwofinger = 0; @@ -172,6 +173,8 @@ InitDeviceProperties(LocalDevicePtr local) 32, 1, ¶->emulate_mid_button_time); prop_twofinger_pressure = InitAtom(local->dev, SYNAPTICS_PROP_TWOFINGER_PRESSURE, 32, 1, ¶->emulate_twofinger_z); + prop_twofinger_width = InitAtom(local->dev, SYNAPTICS_PROP_TWOFINGER_WIDTH, + 32, 1, ¶->emulate_twofinger_w); values[0] = para->scroll_dist_vert; values[1] = para->scroll_dist_horiz; @@ -340,6 +343,12 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return BadMatch; para->emulate_twofinger_z = *(INT32*)prop->data; + } else if (property == prop_twofinger_width) + { + if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER) + return BadMatch; + + para->emulate_twofinger_w = *(INT32*)prop->data; } else if (property == prop_scrolldist) { INT32 *dist; diff --git a/src/synaptics.c b/src/synaptics.c index f119cf6..e7f1289 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -302,6 +302,7 @@ static void set_default_parameters(LocalDevicePtr local) double accelFactor; /* 1/pixels */ int fingerLow, fingerHigh, fingerPress; /* pressure */ int emulateTwoFingerMinZ; /* pressure */ + int emulateTwoFingerMinW; /* width */ int edgeMotionMinZ, edgeMotionMaxZ; /* pressure */ int pressureMotionMinZ, pressureMotionMaxZ; /* pressure */ int palmMinWidth, palmMinZ; /* pressure */ @@ -387,9 +388,10 @@ static void set_default_parameters(LocalDevicePtr local) /* scaling based on defaults below and a tool width of 16 */ palmMinWidth = priv->minw + range * .625; - + emulateTwoFingerMinW = priv->minw + range * .438; } else { palmMinWidth = 10; + emulateTwoFingerMinW = 7; } /* Enable tap if we don't have a phys left button */ @@ -427,6 +429,7 @@ static void set_default_parameters(LocalDevicePtr local) pars->fast_taps = xf86SetBoolOption(opts, "FastTaps", FALSE); pars->emulate_mid_button_time = xf86SetIntOption(opts, "EmulateMidButtonTime", 75); pars->emulate_twofinger_z = xf86SetIntOption(opts, "EmulateTwoFingerMinZ", emulateTwoFingerMinZ); + pars->emulate_twofinger_w = xf86SetIntOption(opts, "EmulateTwoFingerMinW", emulateTwoFingerMinW); pars->scroll_dist_vert = xf86SetIntOption(opts, "VertScrollDelta", horizScrollDelta); pars->scroll_dist_horiz = xf86SetIntOption(opts, "HorizScrollDelta", vertScrollDelta); pars->scroll_edge_vert = xf86SetBoolOption(opts, "VertEdgeScroll", vertEdgeScroll); @@ -1931,7 +1934,8 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) } /* Two finger emulation */ - if (hw->z >= para->emulate_twofinger_z && hw->numFingers == 1) { + if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z && + hw->fingerWidth >= para->emulate_twofinger_w) { hw->numFingers = 2; } diff --git a/tools/synclient.c b/tools/synclient.c index 2677d63..976a57f 100644 --- a/tools/synclient.c +++ b/tools/synclient.c @@ -75,6 +75,7 @@ static struct Parameter params[] = { DEFINE_PAR("FastTaps", fast_taps, PT_BOOL, 0, 1), DEFINE_PAR("EmulateMidButtonTime", emulate_mid_button_time, PT_INT, 0, 1000), DEFINE_PAR("EmulateTwoFingerMinZ", emulate_twofinger_z, PT_INT, 0, 1000), + DEFINE_PAR("EmulateTwoFingerMinW", emulate_twofinger_w, PT_INT, 0, 15), DEFINE_PAR("VertScrollDelta", scroll_dist_vert, PT_INT, 0, 1000), DEFINE_PAR("HorizScrollDelta", scroll_dist_horiz, PT_INT, 0, 1000), DEFINE_PAR("VertEdgeScroll", scroll_edge_vert, PT_BOOL, 0, 1), |