two-finger emulation through fingerWidth

Signed-off-by: Christoph Brill <egore911@egore911.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Marcel Dejean
2009-02-13 19:00:07 -05:00
committed by Peter Hutterer
parent b0704a9d3c
commit 3ddc067c87
6 changed files with 25 additions and 2 deletions

View File

@@ -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"

View File

@@ -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 */

View File

@@ -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.
.

View File

@@ -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, &para->emulate_mid_button_time);
prop_twofinger_pressure = InitAtom(local->dev, SYNAPTICS_PROP_TWOFINGER_PRESSURE,
32, 1, &para->emulate_twofinger_z);
prop_twofinger_width = InitAtom(local->dev, SYNAPTICS_PROP_TWOFINGER_WIDTH,
32, 1, &para->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;

View File

@@ -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;
}

View File

@@ -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),