diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | manpages/synaptics.5 | 36 | ||||
-rw-r--r-- | synaptics.c | 26 | ||||
-rw-r--r-- | synaptics.h | 4 | ||||
-rw-r--r-- | synclient.c | 4 |
5 files changed, 71 insertions, 0 deletions
@@ -27,6 +27,7 @@ advanced features of the touchpad becomes available, such as: - Multifinger taps: two finger for middle button and three finger for right button events. (Needs hardware support. Not all models implement this feature.) +- Pressure dependent motion speed. - Run-time configuration using shared memory. This means you can change parameter settings without restarting the X server. diff --git a/manpages/synaptics.5 b/manpages/synaptics.5 index 7e7c187..1064278 100644 --- a/manpages/synaptics.5 +++ b/manpages/synaptics.5 @@ -44,6 +44,8 @@ right button events. . Not all models implement this feature.) .IP \(bu 4 +Pressure dependent motion speed. +.IP \(bu 4 Run-time configuration using shared memory. This means you can change parameter settings without restarting the X server. .LP @@ -152,6 +154,18 @@ Maximum speed factor. \fBAccelFactor\fR (Float) Acceleration factor. .TP +\fBPressureMotionMinZ\fR (Integer) +Finger pressure at which minimum pressure motion factor is applied. +.TP +\fBPressureMotionMaxZ\fR (Integer) +Finger pressure at which maximum pressure motion factor is applied. +.TP +\fBPressureMotionMinFactor\fR (Integer) +Lowest setting for pressure motion factor. +.TP +\fBPressureMotionMaxFactor\fR (Integer) +Greatest setting for pressure motion factor. +.TP \fBUpDownScrolling\fR (Bool) If on, the up/down buttons generate button 4/5 events. . @@ -395,6 +409,28 @@ For a pressure value between EdgeMotionMinZ and EdgeMotionMaxZ, the speed is increased linearly. . .LP +When pressure motion is activated, the cursor motion speed depends +on the pressure exerted on the touchpad (the more pressure exerted on +the touchpad, the faster the pointer). +. +More precisely the speed is first calculated according to MinSpeed, +MaxSpeed and AccelFactor, and then is multiplied by a sensitivity +factor. +. +The sensitivity factor can be adjusted using the PressureMotion +parameters. +. +If the pressure is below PressureMotionMinZ, PressureMotionMinFactor +is used, and if the pressure is greater than PressureMotionMaxZ, +PressureMotionMaxFactor is used. +. +By default, PressureMotionMinZ and PressureMotionMaxZ are equal to +EdgeMotionMinZ and EdgeMotionMaxZ. +. +For a pressure value between PressureMotionMinZ and +PressureMotionMaxZ, the factor is increased linearly. +. +.LP Since most synaptics touchpad models don't have a button that corresponds to the middle button on a mouse, the driver can emulate middle mouse button events. diff --git a/synaptics.c b/synaptics.c index d6b15da..9a14961 100644 --- a/synaptics.c +++ b/synaptics.c @@ -384,6 +384,8 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) pars->palm_detect = xf86SetBoolOption(local->options, "PalmDetect", TRUE); pars->palm_min_width = xf86SetIntOption(local->options, "PalmMinWidth", 10); pars->palm_min_z = xf86SetIntOption(local->options, "PalmMinZ", 200); + pars->press_motion_min_z = xf86SetIntOption(local->options, "PressureMotionMinZ", pars->edge_motion_min_z); + pars->press_motion_max_z = xf86SetIntOption(local->options, "PressureMotionMaxZ", pars->edge_motion_max_z); str_par = xf86FindOptionValue(local->options, "MinSpeed"); if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->min_speed) != 1)) @@ -401,6 +403,14 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->coasting_speed) != 1)) pars->coasting_speed = 0.0; + str_par = xf86FindOptionValue(local->options, "PressureMotionMinFactor"); + if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->press_motion_min_factor) != 1)) + pars->press_motion_min_factor = 1; + str_par = xf86FindOptionValue(local->options, "PressureMotionMaxFactor"); + if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->press_motion_max_factor) != 1)) + pars->press_motion_max_factor = 1; + + /* Warn about (and fix) incorrectly configured CircScrollTrigger parameters */ if (pars->circular_trigger < 0 || pars->circular_trigger > 8) { xf86Msg(X_WARNING, "Unknown circular scrolling trigger, using 0 (edges)"); pars->circular_trigger = 0; @@ -1248,6 +1258,22 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, speed = para->min_speed; } + /* modify speed according to pressure */ + { + int minZ = para->press_motion_min_z; + int maxZ = para->press_motion_max_z; + double minFctr = para->press_motion_min_factor; + double maxFctr = para->press_motion_max_factor; + + if (hw->z <= minZ) { + speed *= minFctr; + } else if (hw->z >= maxZ) { + speed *= maxFctr; + } else { + speed *= minFctr + (hw->z - minZ) * (maxFctr - minFctr) / (maxZ - minZ); + } + } + /* save the fraction, report the integer part */ tmpf = dx * speed + x_edge_speed * dtime + priv->frac_x; priv->frac_x = xf86modf(tmpf, &integral); diff --git a/synaptics.h b/synaptics.h index f83dd89..22ab66f 100644 --- a/synaptics.h +++ b/synaptics.h @@ -89,6 +89,10 @@ typedef struct _SynapticsSHM int palm_min_width; /* Palm detection width */ int palm_min_z; /* Palm detection depth */ double coasting_speed; /* Coasting threshold scrolling speed */ + int press_motion_min_z; /* finger pressure at which minimum pressure motion factor is applied */ + int press_motion_max_z; /* finger pressure at which maximum pressure motion factor is applied */ + double press_motion_min_factor; /* factor applied on speed when finger pressure is at minimum */ + double press_motion_max_factor; /* factor applied on speed when finger pressure is at minimum */ } SynapticsSHM; /* diff --git a/synclient.c b/synclient.c index 10d6dae..f542cb1 100644 --- a/synclient.c +++ b/synclient.c @@ -94,6 +94,10 @@ static struct Parameter params[] = { DEFINE_PAR("PalmMinWidth", palm_min_width, PT_INT, 0, 15), DEFINE_PAR("PalmMinZ", palm_min_z, PT_INT, 0, 255), DEFINE_PAR("CoastingSpeed", coasting_speed, PT_DOUBLE, 0, 20), + DEFINE_PAR("PressureMotionMinZ", press_motion_min_z, PT_INT, 1, 255), + DEFINE_PAR("PressureMotionMaxZ", press_motion_max_z, PT_INT, 1, 255), + DEFINE_PAR("PressureMotionMinFactor", press_motion_min_factor, PT_DOUBLE, 0, 10.0), + DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 0, 10.0), { 0, 0, 0, 0, 0 } }; |