Commit 0b7cbc8b authored by Ingmar Ellenberger's avatar Ingmar Ellenberger Committed by Peter Osterlund
Browse files

Implement 2-finger emulation for ALPS touchpads.

A new parameter, EmulateTwoFingerMinZ, makes the driver emulate
2-finger scrolling (and tapping) when the finger pressure is big
enough. This is no real multi-finger detection (the ALPS hardware
can't do that), but seems to work quite well in practice.

From Ingmar Ellenberger.
parent e72e1c10
...@@ -208,6 +208,10 @@ up/down/left/right scroll buttons. ...@@ -208,6 +208,10 @@ up/down/left/right scroll buttons.
\fBEmulateMidButtonTime\fR (Integer) \fBEmulateMidButtonTime\fR (Integer)
Maximum time (in milliseconds) for middle button emulation. Maximum time (in milliseconds) for middle button emulation.
.TP .TP
\fBEmulateTwoFingerMinZ\fR (Integer)
For touchpads not capable of detecting multiple fingers (Alps), this sets the
Z pressure threshold to emulate a two finger press.
.TP
\fBTouchpadOff\fR (Integer) \fBTouchpadOff\fR (Integer)
Switch off the touchpad. Switch off the touchpad.
. .
......
...@@ -374,6 +374,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) ...@@ -374,6 +374,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pars->fast_taps = xf86SetIntOption(opts, "FastTaps", FALSE); pars->fast_taps = xf86SetIntOption(opts, "FastTaps", FALSE);
pars->emulate_mid_button_time = xf86SetIntOption(opts, pars->emulate_mid_button_time = xf86SetIntOption(opts,
"EmulateMidButtonTime", 75); "EmulateMidButtonTime", 75);
pars->emulate_twofinger_z = xf86SetIntOption(opts, "EmulateTwoFingerMinZ", 257);
pars->scroll_dist_vert = xf86SetIntOption(opts, "VertScrollDelta", 100); pars->scroll_dist_vert = xf86SetIntOption(opts, "VertScrollDelta", 100);
pars->scroll_dist_horiz = xf86SetIntOption(opts, "HorizScrollDelta", 100); pars->scroll_dist_horiz = xf86SetIntOption(opts, "HorizScrollDelta", 100);
pars->scroll_edge_vert = xf86SetBoolOption(opts, "VertEdgeScroll", TRUE); pars->scroll_edge_vert = xf86SetBoolOption(opts, "VertEdgeScroll", TRUE);
...@@ -1624,6 +1625,11 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) ...@@ -1624,6 +1625,11 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
/* 3rd button emulation */ /* 3rd button emulation */
hw->middle |= HandleMidButtonEmulation(priv, hw, &delay); hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
/* Two finger emulation */
if (hw->z >= para->emulate_twofinger_z && hw->numFingers == 1) {
hw->numFingers = 2;
}
/* Up/Down button scrolling or middle/double click */ /* Up/Down button scrolling or middle/double click */
double_click = FALSE; double_click = FALSE;
if (!para->updown_button_scrolling) { if (!para->updown_button_scrolling) {
......
...@@ -59,6 +59,7 @@ typedef struct _SynapticsSHM ...@@ -59,6 +59,7 @@ typedef struct _SynapticsSHM
Bool fast_taps; /* Faster reaction to single taps */ Bool fast_taps; /* Faster reaction to single taps */
int emulate_mid_button_time; /* Max time between left and right button presses to int emulate_mid_button_time; /* Max time between left and right button presses to
emulate a middle button press. */ emulate a middle button press. */
int emulate_twofinger_z; /* pressure threshold to emulate two finger touch (for Alps) */
int scroll_dist_vert; /* Scrolling distance in absolute coordinates */ int scroll_dist_vert; /* Scrolling distance in absolute coordinates */
int scroll_dist_horiz; /* 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 */ Bool scroll_edge_vert; /* Enable/disable vertical scrolling on right edge */
......
...@@ -62,6 +62,7 @@ static struct Parameter params[] = { ...@@ -62,6 +62,7 @@ static struct Parameter params[] = {
DEFINE_PAR("ClickTime", click_time, PT_INT, 0, 1000), DEFINE_PAR("ClickTime", click_time, PT_INT, 0, 1000),
DEFINE_PAR("FastTaps", fast_taps, PT_BOOL, 0, 1), DEFINE_PAR("FastTaps", fast_taps, PT_BOOL, 0, 1),
DEFINE_PAR("EmulateMidButtonTime", emulate_mid_button_time, PT_INT, 0, 1000), DEFINE_PAR("EmulateMidButtonTime", emulate_mid_button_time, PT_INT, 0, 1000),
DEFINE_PAR("EmulateTwoFingerMinZ", emulate_twofinger_z, PT_INT, 0, 1000),
DEFINE_PAR("VertScrollDelta", scroll_dist_vert, PT_INT, 0, 1000), DEFINE_PAR("VertScrollDelta", scroll_dist_vert, PT_INT, 0, 1000),
DEFINE_PAR("HorizScrollDelta", scroll_dist_horiz, PT_INT, 0, 1000), DEFINE_PAR("HorizScrollDelta", scroll_dist_horiz, PT_INT, 0, 1000),
DEFINE_PAR("VertEdgeScroll", scroll_edge_vert, PT_BOOL, 0, 1), DEFINE_PAR("VertEdgeScroll", scroll_edge_vert, PT_BOOL, 0, 1),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment