Drop trackstick emulation mode

"Trackstick emulation mode? That exists?" I hear you say? Yes, indeed. Well,
no, not anymore. This driver is already unmaintainable without features like
this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Peter Hutterer
2012-02-04 23:32:56 +10:00
parent 83d88b2531
commit 2c7eab5a6d
6 changed files with 15 additions and 87 deletions

View File

@@ -35,7 +35,7 @@
/* 32 bit, 4 values, left, right, top, bottom */
#define SYNAPTICS_PROP_EDGES "Synaptics Edges"
/* 32 bit, 3 values, low, high, press */
/* 32 bit, 3 values, low, high, <deprecated> */
#define SYNAPTICS_PROP_FINGER "Synaptics Finger"
/* 32 bit */
@@ -72,7 +72,7 @@
/* 8 bit (BOOL), 2 values, vertical, horizontal */
#define SYNAPTICS_PROP_SCROLL_TWOFINGER "Synaptics Two-Finger Scrolling"
/* FLOAT, 4 values, min, max, accel, trackstick */
/* FLOAT, 4 values, min, max, accel, <deprecated> */
#define SYNAPTICS_PROP_SPEED "Synaptics Move Speed"
/* 32 bit, 2 values, min, max */

View File

@@ -112,13 +112,6 @@ release. Property: "Synaptics Finger"
When finger pressure goes above this value, the driver counts it as a
touch. Property: "Synaptics Finger"
.TP 7
.BI "Option \*qFingerPress\*q \*q" integer \*q
When finger pressure goes above this value, the driver counts it as a
press.
.
Currently a press is equivalent to putting the touchpad in trackstick
emulation mode. Property: "Synaptics Finger"
.TP 7
.BI "Option \*qMaxTapTime\*q \*q" integer \*q
Maximum time (in milliseconds) for detecting a tap. Property: "Synaptics Tap
Durations"
@@ -202,9 +195,6 @@ Maximum speed factor. Property: "Synaptics Move Speed"
Acceleration factor for normal pointer movements. Property: "Synaptics Move
Speed"
.TP
.BI "Option \*qTrackstickSpeed\*q \*q" float \*q
Speed scale when in trackstick emulation mode. Property: "Synaptics Move Speed"
.TP
.BI "Option \*qPressureMotionMinZ\*q \*q" integer \*q
Finger pressure at which minimum pressure motion factor is applied. Property:
"Synaptics Pressure Motion"
@@ -748,26 +738,6 @@ that it covers the incoming coordinate, and only the boxes own center is used
as input. Obviously, the smaller the box the better, but the likelyhood of
noise motion coming through also increases.
.SS Trackstick mode
Trackstick emulation mode is entered when pressing the finger hard on
the touchpad.
.
The FingerPress parameter controls the minimum required finger
pressure.
.
If the finger hasn't moved more than MaxTapMove after MaxTapTime has
elapsed, trackstick mode is entered.
.
In this mode, moving the finger slightly in any direction gives a
speed vector that moves the pointer.
.
The TrackstickSpeed parameter controls the ratio between pointer speed
and finger movement distance.
.
Trackstick mode is exited when the finger pressure drops below
FingerLow or when the finger is moved further than MaxTapMove away
from the initial position.
.SS ClickPad support
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
@@ -849,7 +819,7 @@ duration of a single click.
.TP 7
.BI "Synaptics Move Speed"
FLOAT, 4 values, min, max, accel, trackstick.
FLOAT, 4 values, min, max, accel, <deprecated>
.TP 7
.BI "Synaptics Edge Motion Pressure"
@@ -1016,6 +986,10 @@ The following options are no longer part of the driver configuration:
.BI "Option \*qGuestMouseOff\*q \*q" boolean \*q
.TP
.BI "Option \*qSHMConfig\*q \*q" boolean \*q
.TP
.BI "Option \*qFingerPress\*q \*q" integer \*q
.TP
.BI "Option \*qTrackstickSpeed\*q \*q" float \*q
.SH "AUTHORS"
.LP

View File

@@ -205,7 +205,7 @@ InitDeviceProperties(InputInfoPtr pInfo)
values[0] = para->finger_low;
values[1] = para->finger_high;
values[2] = para->finger_press;
values[2] = 0;
prop_finger = InitAtom(pInfo->dev, SYNAPTICS_PROP_FINGER, 32, 3, values);
prop_tap_time =
@@ -251,7 +251,7 @@ InitDeviceProperties(InputInfoPtr pInfo)
fvalues[0] = para->min_speed;
fvalues[1] = para->max_speed;
fvalues[2] = para->accl;
fvalues[3] = para->trackstick_speed;
fvalues[3] = 0;
prop_speed = InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_SPEED, 4, fvalues);
values[0] = para->edge_motion_min_z;
@@ -443,8 +443,6 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
para->finger_low = finger[0];
para->finger_high = finger[1];
para->finger_press = finger[2];
}
else if (property == prop_tap_time) {
if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
@@ -566,7 +564,6 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
para->min_speed = speed[0];
para->max_speed = speed[1];
para->accl = speed[2];
para->trackstick_speed = speed[3];
}
else if (property == prop_edgemotion_pressure) {

View File

@@ -330,7 +330,7 @@ calculate_edge_widths(SynapticsPrivate * priv, int *l, int *r, int *t, int *b)
static void
calculate_tap_hysteresis(SynapticsPrivate * priv, int range,
int *fingerLow, int *fingerHigh, int *fingerPress)
int *fingerLow, int *fingerHigh)
{
if (priv->model == MODEL_ELANTECH) {
/* All Elantech touchpads don't need the Z filtering to get the
@@ -344,8 +344,6 @@ calculate_tap_hysteresis(SynapticsPrivate * priv, int range,
*fingerLow = priv->minp + range * (25.0 / 256);
*fingerHigh = priv->minp + range * (30.0 / 256);
}
*fingerPress = priv->minp + range * 1.000;
}
/* Area options support both percent values and absolute values. This is
@@ -533,7 +531,7 @@ set_default_parameters(InputInfoPtr pInfo)
int l, r, t, b; /* left, right, top, bottom */
int edgeMotionMinSpeed, edgeMotionMaxSpeed; /* pixels/second */
double accelFactor; /* 1/pixels */
int fingerLow, fingerHigh, fingerPress; /* pressure */
int fingerLow, fingerHigh; /* pressure */
int emulateTwoFingerMinZ; /* pressure */
int emulateTwoFingerMinW; /* width */
int edgeMotionMinZ, edgeMotionMaxZ; /* pressure */
@@ -580,8 +578,7 @@ set_default_parameters(InputInfoPtr pInfo)
range = priv->maxp - priv->minp + 1;
calculate_tap_hysteresis(priv, range, &fingerLow, &fingerHigh,
&fingerPress);
calculate_tap_hysteresis(priv, range, &fingerLow, &fingerHigh);
/* scaling based on defaults and a pressure of 256 */
emulateTwoFingerMinZ = priv->minp + range * (282.0 / 256);
@@ -644,7 +641,6 @@ set_default_parameters(InputInfoPtr pInfo)
pars->finger_low = xf86SetIntOption(opts, "FingerLow", fingerLow);
pars->finger_high = xf86SetIntOption(opts, "FingerHigh", fingerHigh);
pars->finger_press = xf86SetIntOption(opts, "FingerPress", fingerPress);
pars->tap_time = xf86SetIntOption(opts, "MaxTapTime", 180);
pars->tap_move = xf86SetIntOption(opts, "MaxTapMove", tapMove);
pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180);
@@ -726,7 +722,6 @@ set_default_parameters(InputInfoPtr pInfo)
pars->min_speed = xf86SetRealOption(opts, "MinSpeed", 0.4);
pars->max_speed = xf86SetRealOption(opts, "MaxSpeed", 0.7);
pars->accl = xf86SetRealOption(opts, "AccelFactor", accelFactor);
pars->trackstick_speed = xf86SetRealOption(opts, "TrackstickSpeed", 40);
pars->scroll_dist_circ = xf86SetRealOption(opts, "CircScrollDelta", 0.1);
pars->coasting_speed = xf86SetRealOption(opts, "CoastingSpeed", 20.0);
pars->coasting_friction = xf86SetRealOption(opts, "CoastingFriction", 50);
@@ -1764,9 +1759,7 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw)
if (priv->finger_state == FS_BLOCKED)
return FS_BLOCKED;
if (hw->z > para->finger_press && priv->finger_state < FS_PRESSED)
finger = FS_PRESSED;
else if (hw->z > para->finger_high && priv->finger_state == FS_UNTOUCHED)
if (hw->z > para->finger_high && priv->finger_state == FS_UNTOUCHED)
finger = FS_TOUCHED;
else
finger = priv->finger_state;
@@ -1904,10 +1897,6 @@ SetMovingState(SynapticsPrivate * priv, enum MovingState moving_state,
priv->moving_state, moving_state, priv->hwState->x, priv->hwState->y,
millis);
if (moving_state == MS_TRACKSTICK) {
priv->trackstick_neutral_x = priv->hwState->x;
priv->trackstick_neutral_y = priv->hwState->y;
}
priv->moving_state = moving_state;
}
@@ -1993,9 +1982,6 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
if (finger == FS_TOUCHED) {
SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now);
}
else if (finger == FS_PRESSED) {
SetMovingState(priv, MS_TRACKSTICK, now);
}
SetTapState(priv, TS_MOVE, now);
goto restart;
}
@@ -2014,9 +2000,6 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
SetTapState(priv, TS_CLICKPAD_MOVE, now);
goto restart;
}
if (move && priv->moving_state == MS_TRACKSTICK) {
SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now);
}
if (release) {
SetMovingState(priv, MS_FALSE, now);
SetTapState(priv, TS_START, now);
@@ -2059,9 +2042,6 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
if (finger == FS_TOUCHED) {
SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now);
}
else if (finger == FS_PRESSED) {
SetMovingState(priv, MS_TRACKSTICK, now);
}
SetTapState(priv, TS_DRAG, now);
}
else {
@@ -2187,21 +2167,6 @@ hysteresis(int in, int center, int margin)
return center + diff;
}
static void
get_delta_for_trackstick(SynapticsPrivate * priv,
const struct SynapticsHwState *hw, double *dx,
double *dy)
{
SynapticsParameters *para = &priv->synpara;
double dtime = (hw->millis - HIST(0).millis) / 1000.0;
*dx = (hw->x - priv->trackstick_neutral_x);
*dy = (hw->y - priv->trackstick_neutral_y);
*dx = *dx * dtime * para->trackstick_speed;
*dy = *dy * dtime * para->trackstick_speed;
}
static void
get_edge_speed(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
edge_type edge, int *x_edge_speed, int *y_edge_speed)
@@ -2285,7 +2250,7 @@ get_delta(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
}
/**
* Compute relative motion ('deltas') including edge motion xor trackstick.
* Compute relative motion ('deltas') including edge motion.
*/
static int
ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
@@ -2332,9 +2297,7 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
if (priv->count_packet_finger <= 1)
goto out; /* skip the lot */
if (priv->moving_state == MS_TRACKSTICK)
get_delta_for_trackstick(priv, hw, &dx, &dy);
else if (moving_state == MS_TOUCHPAD_RELATIVE)
if (moving_state == MS_TOUCHPAD_RELATIVE)
get_delta(priv, hw, edge, &dx, &dy);
out:

View File

@@ -73,7 +73,6 @@ enum FingerState { /* Note! The order matters. Compared with < oper
enum MovingState {
MS_FALSE,
MS_TOUCHPAD_RELATIVE,
MS_TRACKSTICK /* trackstick is always relative */
};
enum MidButtonEmulation {
@@ -139,7 +138,6 @@ typedef struct _SynapticsParameters {
Bool scroll_twofinger_vert; /* Enable/disable vertical two-finger scrolling */
Bool scroll_twofinger_horiz; /* Enable/disable horizontal two-finger scrolling */
double min_speed, max_speed, accl; /* movement parameters */
double trackstick_speed; /* trackstick mode speed */
int edge_motion_min_z; /* finger pressure at which minimum edge motion speed is set */
int edge_motion_max_z; /* finger pressure at which maximum edge motion speed is set */
int edge_motion_min_speed; /* slowest setting for edge motion speed */
@@ -238,8 +236,6 @@ struct _SynapticsPrivateRec {
Bool circ_scroll_on; /* Keeps track of currently active scroll modes */
Bool circ_scroll_vert; /* True: Generate vertical scroll events
False: Generate horizontal events */
int trackstick_neutral_x; /* neutral x position for trackstick mode */
int trackstick_neutral_y; /* neutral y position for trackstick mode */
double frac_x, frac_y; /* absolute -> relative fraction */
enum MidButtonEmulation mid_emu_state; /* emulated 3rd button */
int repeatButtons; /* buttons for repeat */

View File

@@ -78,7 +78,6 @@ static struct Parameter params[] = {
{"BottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 3},
{"FingerLow", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 0},
{"FingerHigh", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 1},
{"FingerPress", PT_INT, 0, 256, SYNAPTICS_PROP_FINGER, 32, 2},
{"MaxTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_TIME, 32, 0},
{"MaxTapMove", PT_INT, 0, 2000, SYNAPTICS_PROP_TAP_MOVE, 32, 0},
{"MaxDoubleTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 1},
@@ -98,7 +97,6 @@ static struct Parameter params[] = {
{"MinSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 0},
{"MaxSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 1},
{"AccelFactor", PT_DOUBLE, 0, 1.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 2},
{"TrackstickSpeed", PT_DOUBLE, 0, 200.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 3},
{"EdgeMotionMinZ", PT_INT, 1, 255, SYNAPTICS_PROP_EDGEMOTION_PRESSURE, 32, 0},
{"EdgeMotionMaxZ", PT_INT, 1, 255, SYNAPTICS_PROP_EDGEMOTION_PRESSURE, 32, 1},
{"EdgeMotionMinSpeed", PT_INT, 0, 1000, SYNAPTICS_PROP_EDGEMOTION_SPEED, 32, 0},