Hi all, another round of ptr accel patches. I didn't send to the dev list to maybe gather more input on the rename.
First, I renamed 'constant deceleration' to 'downscaling', and adjusted the property and option names. I hope that it is a good name; I'm still open for suggestions. Many suggested 'sensitivity' but I think that isn't it. Only the option rename is backwards-compatible though, to avoid redundant input properties. Peter, is that one OK with you? Next, I added the possibility to change pointer feedback controls through options. The InputClass stuff makes it more sensible to do this. TBH, I never figured why it was limited to command line options. Third, some whitespace style fixes. Nothing functional. Last but not least, the documentation should now reflect reality wrt pointer acceleration. Affects the xorg.conf.man and --help output. It's perfectly possible the man changes are bogus, I just copied around and I seem not to have broken things. Cheers, Simon
>From 6bdb4ab5abef8a2155df23281c4ca1268dc999ae Mon Sep 17 00:00:00 2001 From: Simon Thum <simon.t...@gmx.de> Date: Tue, 5 Jan 2010 11:50:05 +0100 Subject: [PATCH 1/4] dix: rename input property for 'constant deceleration' to 'downscaling' The old name seems not to be very descriptive, let alone correct. Leaves the old define for any outsiders which may have used it, though I'm unaware of any. The xorg.conf option is renamed likewise, but the old option remains effective. --- Xi/xiproperty.c | 2 +- dix/ptrveloc.c | 6 +++--- hw/xfree86/common/xf86Xinput.c | 7 ++++--- include/xserver-properties.h | 4 +++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index ea66c54..896d804 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -54,7 +54,7 @@ static struct dev_properties {0, XI_PROP_XTEST_DEVICE}, {0, XATOM_FLOAT}, {0, ACCEL_PROP_PROFILE_NUMBER}, - {0, ACCEL_PROP_CONSTANT_DECELERATION}, + {0, ACCEL_PROP_DOWNSCALING}, {0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {0, ACCEL_PROP_VELOCITY_SCALING}, {0, AXIS_LABEL_PROP}, diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index c2f4378..b15cbf0 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -197,7 +197,7 @@ AccelSetDecelProperty(DeviceIntPtr dev, Atom atom, int rc; int nelem = 1; - if (atom != XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION)) + if (atom != XIGetKnownProperty(ACCEL_PROP_DOWNSCALING)) return Success; vel = GetDevicePredictableAccelData(dev); @@ -222,7 +222,7 @@ static long AccelInitDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel) { float fval = 1.0/vel->const_acceleration; - Atom prop_const_decel = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION); + Atom prop_const_decel = XIGetKnownProperty(ACCEL_PROP_DOWNSCALING); XIChangeDeviceProperty(dev, prop_const_decel, XIGetKnownProperty(XATOM_FLOAT), 32, PropModeReplace, 1, &fval, FALSE); @@ -358,7 +358,7 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev) XIDeleteDeviceProperty(dev, prop, FALSE); prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION); XIDeleteDeviceProperty(dev, prop, FALSE); - prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION); + prop = XIGetKnownProperty(ACCEL_PROP_DOWNSCALING); XIDeleteDeviceProperty(dev, prop, FALSE); prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER); XIDeleteDeviceProperty(dev, prop, FALSE); diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 57db056..979b265 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -121,10 +121,11 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, /* common settings (available via device properties) */ tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0); + tempf = xf86SetRealOption(list, "Downscaling", tempf); if(tempf > 1.0){ - xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n", + xf86Msg(X_CONFIG, "%s: (accel) scaling down by %.1f\n", devname, tempf); - prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION); + prop = XIGetKnownProperty(ACCEL_PROP_DOWNSCALING); XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } @@ -153,7 +154,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, devname, tempi); } - /* set scaling */ + /* set velocity scaling */ tempf = xf86SetRealOption(list, "ExpectedRate", 0); prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING); if(tempf > 0){ diff --git a/include/xserver-properties.h b/include/xserver-properties.h index 626d0ad..f90378d 100644 --- a/include/xserver-properties.h +++ b/include/xserver-properties.h @@ -39,7 +39,9 @@ /* INTEGER of any format */ #define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile" /* FLOAT, format 32 */ -#define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration" +#define ACCEL_PROP_DOWNSCALING "Device Downscaling" +/* old define from X.org server 1.7 */ +#define ACCEL_PROP_CONSTANT_DECELERATION ACCEL_PROP_DOWNSCALING /* FLOAT, format 32 */ #define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration" /* FLOAT, format 32 */ -- 1.6.4.4
>From da0b0bb6bda12eaa7f3cece3ab72056e73afa765 Mon Sep 17 00:00:00 2001 From: Simon Thum <simon.t...@gmx.de> Date: Tue, 5 Jan 2010 14:46:35 +0100 Subject: [PATCH 2/4] xfree86: set accelaration controls from options Since config backends become better integrated, we may as well cover all the acceleration-related settings. Previously, the only way to set acceleration controls (aka pointer feedback) upfront was command-line options to the Xorg binary. --- hw/xfree86/common/xf86Xinput.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 979b265..90ed1bc 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -199,12 +199,12 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, static void ApplyAccelerationSettings(DeviceIntPtr dev){ - int scheme; + int scheme, i; DeviceVelocityPtr pVel; LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; char* schemeStr; - if(dev->valuator){ + if(dev->valuator && dev->ptrfeed){ schemeStr = xf86SetStrOption(local->options, "AccelerationScheme", ""); scheme = dev->valuator->accelScheme.number; @@ -247,6 +247,35 @@ ApplyAccelerationSettings(DeviceIntPtr dev){ pVel); break; } + + /* + * process acceleration controls (or 'pointer feedback') as device + * options, to allow people to set acceleration preferences more + * flexibly than command-line trickery. + */ + i = xf86SetIntOption(local->options, "AccelerationNumerator", + dev->ptrfeed->ctrl.num); + if (i >= 0) + dev->ptrfeed->ctrl.num = i; + + i = xf86SetIntOption(local->options, "AccelerationDenominator", + dev->ptrfeed->ctrl.den); + if (i > 0) + dev->ptrfeed->ctrl.den = i; + + i = xf86SetIntOption(local->options, "AccelerationThreshold", + dev->ptrfeed->ctrl.threshold); + if (i >= 0) + dev->ptrfeed->ctrl.threshold = i; + + /* mostly a no-op anyway */ + (*dev->ptrfeed->CtrlProc)(dev, &dev->ptrfeed->ctrl); + + xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n", + local->name, ((float)dev->ptrfeed->ctrl.num)/ + ((float)dev->ptrfeed->ctrl.den)); + xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n", + local->name, dev->ptrfeed->ctrl.threshold); } } -- 1.6.4.4
>From 3ef79eb47a2011cd3f64ad48a42cba6483ea367b Mon Sep 17 00:00:00 2001 From: Simon Thum <simon.t...@gmx.de> Date: Tue, 5 Jan 2010 15:31:08 +0100 Subject: [PATCH 3/4] whitespace fixes for accel setup --- hw/xfree86/common/xf86Xinput.c | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 90ed1bc..e225294 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -122,7 +122,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, /* common settings (available via device properties) */ tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0); tempf = xf86SetRealOption(list, "Downscaling", tempf); - if(tempf > 1.0){ + if (tempf > 1.0) { xf86Msg(X_CONFIG, "%s: (accel) scaling down by %.1f\n", devname, tempf); prop = XIGetKnownProperty(ACCEL_PROP_DOWNSCALING); @@ -131,7 +131,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, } tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0); - if(tempf > 1.0){ + if (tempf > 1.0) { xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n", devname, tempf); prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION); @@ -145,8 +145,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER); if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32, - PropModeReplace, 1, &tempi, FALSE) == Success) - { + PropModeReplace, 1, &tempi, FALSE) == Success) { xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname, tempi); } else { @@ -157,20 +156,19 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, /* set velocity scaling */ tempf = xf86SetRealOption(list, "ExpectedRate", 0); prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING); - if(tempf > 0){ + if (tempf > 0) { tempf = 1000.0 / tempf; XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); - }else{ + } else { tempf = xf86SetRealOption(list, "VelocityScale", s->corr_mul); XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1); - if(tempi > 1){ + if (tempi > 1) InitTrackers(s, tempi); - } s->initial_range = xf86SetIntOption(list, "VelocityInitialRange", s->initial_range); @@ -178,7 +176,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, s->max_diff = xf86SetRealOption(list, "VelocityAbsDiff", s->max_diff); tempf = xf86SetRealOption(list, "VelocityRelDiff", -1); - if(tempf >= 0){ + if (tempf >= 0) { xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n", devname, tempf*100.0); s->max_rel_diff = tempf; @@ -204,35 +202,35 @@ ApplyAccelerationSettings(DeviceIntPtr dev){ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; char* schemeStr; - if(dev->valuator && dev->ptrfeed){ + if (dev->valuator && dev->ptrfeed) { schemeStr = xf86SetStrOption(local->options, "AccelerationScheme", ""); scheme = dev->valuator->accelScheme.number; - if(!xf86NameCmp(schemeStr, "predictable")) + if (!xf86NameCmp(schemeStr, "predictable")) scheme = PtrAccelPredictable; - if(!xf86NameCmp(schemeStr, "lightweight")) + if (!xf86NameCmp(schemeStr, "lightweight")) scheme = PtrAccelLightweight; - if(!xf86NameCmp(schemeStr, "none")) + if (!xf86NameCmp(schemeStr, "none")) scheme = PtrAccelNoOp; /* reinit scheme if needed */ - if(dev->valuator->accelScheme.number != scheme){ - if(dev->valuator->accelScheme.AccelCleanupProc){ + if (dev->valuator->accelScheme.number != scheme) { + if (dev->valuator->accelScheme.AccelCleanupProc) { dev->valuator->accelScheme.AccelCleanupProc(dev); } - if(InitPointerAccelerationScheme(dev, scheme)){ + if (InitPointerAccelerationScheme(dev, scheme)) { xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n", local->name, schemeStr, scheme); - }else{ + } else { xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n", local->name, schemeStr); scheme = dev->valuator->accelScheme.number; } - }else{ + } else { xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n", local->name, scheme); } @@ -240,7 +238,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){ xfree(schemeStr); /* process special configuration */ - switch(scheme){ + switch (scheme) { case PtrAccelPredictable: pVel = GetDevicePredictableAccelData(dev); ProcessVelocityConfiguration (dev, local->name, local->options, -- 1.6.4.4
>From 34b91933b977e73749ec934c78249cb93533966e Mon Sep 17 00:00:00 2001 From: Simon Thum <simon.t...@gmx.de> Date: Tue, 5 Jan 2010 16:23:57 +0100 Subject: [PATCH 4/4] xfree86: add pointer acceleration info to xorg.conf.man Just try to describe what's important, still looking for a place put the whole sermon. Also, be more precise about what -a and -t actually do on --help output. --- hw/xfree86/doc/man/xorg.conf.man.pre | 62 +++++++++++++++++++++++++++++++++- os/utils.c | 4 +- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 5b98bda..63526e0 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -914,7 +914,67 @@ X Input extension. This option controls the startup behavior only, a device may be reattached or set floating at runtime. .TP 7 .BI "Option \*qSendDragEvents\*q \*q" boolean \*q -??? +Send core events while dragging. Default: Enabled. +.PP +.TP 7 +.B Pointer Acceleration +For pointing devices, the following options control if and how the pointer +is accelerated with respect to physical device motion. It also provides an +option to scale down devices, which supersedes workarounds based on tweaking +the acceleration controls. Most of these can be adjusted at runtime using the +pointer feedback and input property mechanisms (see the xinput(1) man page). +Note that desktop environments typically do this for at least the first three +options (which correspond to pointer feedback settings). Only the most +important acceleration options are discussed here. +.TP 7 +.BI "Option \*qAccelerationNumerator\*q \*q" integer \*q +Set the numerator of the acceleration factor. +.TP 7 +.BI "Option \*qAccelerationDenominator\*q \*q" integer \*q +Set the denominator of the acceleration factor. +.TP 7 +.BI "Option \*qAccelerationThreshold\*q \*q" integer \*q +Set the threshold, i.e. the velocity (device units/t) required for acceleration +to kick in. +.TP 7 +.BI "Option \*qAccelerationProfile\*q \*q" integer \*q +Select the profile, which determines actual acceleration as a function of +device velocity and other acceleration settings. +.PP +.RS 6 +.nf +.B " 0 classic (mostly compatible)" +.B "-1 none (just DownScale is applied)" +.B " 1 device-dependent" +.B " 2 polynomial" +.B " 3 smooth linear" +.B " 4 simple" +.B " 5 power" +.B " 6 linear" +.B " 7 limited" +.fi +.RE +.TP 7 +.BI "Option \*qDownScale\*q \*q" real \*q +Makes the pointer go +.B DownScale +times slower than without this option. Most useful for high-resolution devices. +.TP 7 +.BI "Option \*qAdaptiveDeceleration\*q \*q" real \*q +Most profiles allow to actually decelerate the pointer when going slow. Use this +for very accurate hit-the-pixel work. +.TP 7 +.BI "Option \*qAccelerationScheme\*q \*q" string \*q +Selects the scheme, which is the underlying algorithm. Basically one can +resurrect the old (severely constrained) algorithm, choose none or the current +default. +.PP +.RS 7 +.nf +.B "predictable default algorithm (behaving intuitively predictable)" +.B "lightweight old acceleration code" +.B "none no acceleration or deceleration" + .SH "INPUTCLASS SECTION" The config file may have multiple .B InputClass diff --git a/os/utils.c b/os/utils.c index 3718b17..449460b 100644 --- a/os/utils.c +++ b/os/utils.c @@ -472,7 +472,7 @@ AdjustWaitForDelay (pointer waitTime, unsigned long newdelay) void UseMsg(void) { ErrorF("use: X [:<display>] [option]\n"); - ErrorF("-a # mouse acceleration (pixels)\n"); + ErrorF("-a # default mouse acceleration (factor)\n"); ErrorF("-ac disable access control restrictions\n"); ErrorF("-audit int set audit trail level\n"); ErrorF("-auth file select authorization file\n"); @@ -524,7 +524,7 @@ void UseMsg(void) #endif ErrorF("-retro start with classic stipple and cursor\n"); ErrorF("-s # screen-saver timeout (minutes)\n"); - ErrorF("-t # mouse threshold (pixels)\n"); + ErrorF("-t # default mouse threshold (pixels/t)\n"); ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); -- 1.6.4.4
_______________________________________________ xorg mailing list xorg@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/xorg