From 9bc847ab7eeaf9c38483bd00c079e418c52c514a Mon Sep 17 00:00:00 2001 From: Simon Thum Date: Thu, 25 Aug 2011 19:23:17 +0200 Subject: [PATCH] remove MinSpeed and MaxSpeed synaptics settings Those were mirroring what dix already provides. We could, for more convenience, drag them on and sync them with constant/adaptive decel, but dropping is more honest. This will get people subjected to KDE calling up xset m , so it might be precieved as a step back. For rationale, see https://bugs.freedesktop.org/show_bug.cgi?id=38998 Signed-off-by: Simon Thum --- include/synaptics-properties.h | 2 +- man/synaptics.man | 17 ++++++++++----- src/properties.c | 7 ++--- src/synaptics.c | 41 +++++++++++++++++++-------------------- tools/synclient.c | 2 - 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h index 77a1806..f52b88e 100644 --- a/include/synaptics-properties.h +++ b/include/synaptics-properties.h @@ -69,7 +69,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, ignored placeholder min, ignored placeholder max, accel, trackstick */ #define SYNAPTICS_PROP_SPEED "Synaptics Move Speed" /* 32 bit, 2 values, min, max */ diff --git a/man/synaptics.man b/man/synaptics.man index cb5f4c6..abb0f41 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -194,10 +194,11 @@ If off, edge motion is used only when dragging. Property: "Synaptics Edge Motion Always" .TP .BI "Option \*qMinSpeed\*q \*q" float \*q -Minimum speed factor. Property: "Synaptics Move Speed" +Minimum speed factor. Deprecated, so no property support. See the section on +acceleration. .TP .BI "Option \*qMaxSpeed\*q \*q" float \*q -Maximum speed factor. Property: "Synaptics Move Speed" +Maximum speed factor. Deprecated like MinSpeed. .TP .BI "Option \*qAccelFactor\*q \*q" float \*q Acceleration factor for normal pointer movements. Property: "Synaptics Move @@ -599,6 +600,8 @@ speed somewhere between MinSpeed and MaxSpeed. If you don't want any acceleration, set MinSpeed and MaxSpeed to the same value. . +Actually, Minspeed and MaxSpeed are historical, see below. +. .LP The MinSpeed, MaxSpeed and AccelFactor parameters don't have any effect on scrolling speed. @@ -611,10 +614,11 @@ HorizScrollDelta to zero. . .LP Acceleration is mostly handled outside the driver, thus the driver will -translate MinSpeed into constant deceleration and adapt MaxSpeed at -startup time. This ensures you can user the other acceleration profiles, albeit -without pressure motion. However the numbers at runtime will likely be different -from any options you may have set. +translate MinSpeed into constant deceleration and adapt the device's +acceleration factor (using a denominator of 100; see the xorg.conf man page) +at device init time. This ensures you can use the other +acceleration profiles, albeit without pressure motion. Acceleration settings +can be adjusted at runtime using e.g. the xinput tool. .SS Pressure motion When pressure motion is activated, the cursor motion speed depends @@ -813,6 +817,7 @@ duration of a single click. .TP 7 .BI "Synaptics Move Speed" FLOAT, 4 values, min, max, accel, trackstick. +min and max are deprecated, see acceleration. .TP 7 .BI "Synaptics Edge Motion Pressure" diff --git a/src/properties.c b/src/properties.c index 299a444..dc22b11 100644 --- a/src/properties.c +++ b/src/properties.c @@ -203,8 +203,8 @@ InitDeviceProperties(InputInfoPtr pInfo) values[1] = para->scroll_twofinger_horiz; prop_scrolltwofinger = InitAtom(pInfo->dev, SYNAPTICS_PROP_SCROLL_TWOFINGER,8, 2, values); - fvalues[0] = para->min_speed; - fvalues[1] = para->max_speed; + fvalues[0] = -1; + fvalues[1] = -1; fvalues[2] = para->accl; fvalues[3] = para->trackstick_speed; prop_speed = InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_SPEED, 4, fvalues); @@ -449,8 +449,7 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return BadMatch; speed = (float*)prop->data; - para->min_speed = speed[0]; - para->max_speed = speed[1]; + /* the first two elements are deprecated.*/ para->accl = speed[2]; para->trackstick_speed = speed[3]; diff --git a/src/synaptics.c b/src/synaptics.c index cf91b9f..407cc9a 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -598,11 +598,9 @@ static float SynapticsAccelerationProfile(DeviceIntPtr dev, /* speed up linear with finger velocity */ accelfct = velocity * para->accl; - /* clip acceleration factor */ - if (accelfct > para->max_speed * acc) - accelfct = para->max_speed * acc; - else if (accelfct < para->min_speed) - accelfct = para->min_speed; + /* clip acceleration factor (lower bound is enforced by DIX) */ + if (accelfct > acc) + accelfct = acc; /* modify speed according to pressure */ if (priv->moving_state == MS_TOUCHPAD_RELATIVE) { @@ -942,7 +940,7 @@ DeviceInit(DeviceIntPtr dev) InputInfoPtr pInfo = dev->public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); Atom float_type, prop; - float tmpf; + float tmpf, base_speed; unsigned char map[SYN_MAX_BUTTONS + 1]; int i; int min, max; @@ -976,8 +974,9 @@ DeviceInit(DeviceIntPtr dev) /* * setup dix acceleration to match legacy synaptics settings, and - * etablish a device-specific profile to do stuff like pressure-related - * acceleration. + * establish a device-specific profile to perform pressure-related + * acceleration. This stuff is prone to be overridden + * in xf86InputDevicePostInit(). */ #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 if (NULL != (pVel = GetDevicePredictableAccelData(dev))) { @@ -988,28 +987,28 @@ DeviceInit(DeviceIntPtr dev) float_type = XIGetKnownProperty(XATOM_FLOAT); /* translate MinAcc to constant deceleration. - * May be overridden in xf86InitValuatorDefaults */ - tmpf = 1.0 / priv->synpara.min_speed; + * MinAcc corresponds to return 1 in the profile then. */ + base_speed = 1.0 / priv->synpara.min_speed; - xf86IDrvMsg(pInfo, X_CONFIG, "(accel) MinSpeed is now constant deceleration " - "%.1f\n", tmpf); + xf86IDrvMsg(pInfo, X_CONFIG, "(accel) MinSpeed translated to a " + "constant deceleration of %.2f\n", base_speed); prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION); XIChangeDeviceProperty(dev, prop, float_type, 32, - PropModeReplace, 1, &tmpf, FALSE); + PropModeReplace, 1, &base_speed, FALSE); - /* adjust accordingly */ - priv->synpara.max_speed /= priv->synpara.min_speed; - priv->synpara.min_speed = 1.0; + /* adjust the acceleration factor accordingly. In the profile, + * return acc has the same effect. */ + tmpf = priv->synpara.max_speed / base_speed; + dev->ptrfeed->ctrl.den = 100; + dev->ptrfeed->ctrl.num = tmpf * 100; + xf86IDrvMsg(pInfo, X_CONFIG, "MaxSpeed is now an acceleration of " + "%.2f\n", tmpf); /* synaptics seems to report 80 packet/s, but dix scales for * 100 packet/s by default. */ pVel->corr_mul = 12.5f; /*1000[ms]/80[/s] = 12.5 */ - xf86IDrvMsg(pInfo, X_CONFIG, "MaxSpeed is now %.2f\n", - priv->synpara.max_speed); - xf86IDrvMsg(pInfo, X_CONFIG, "AccelFactor is now %.3f\n", - priv->synpara.accl); - + /* switch to device-specific acceleration profile */ prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER); i = AccelProfileDeviceSpecific; XIChangeDeviceProperty(dev, prop, XA_INTEGER, 32, diff --git a/tools/synclient.c b/tools/synclient.c index 08bd22b..b127142 100644 --- a/tools/synclient.c +++ b/tools/synclient.c @@ -96,8 +96,6 @@ static struct Parameter params[] = { {"CornerCoasting", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 2}, {"VertTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 0}, {"HorizTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 1}, - {"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}, -- 1.7.3.4