Be my feelings, default sensitivity of touchpad in relative mode is a bit much. This new parameter allows user to fine tune sensitivity. The value is percentage to default sensitivity.
Signed-off-by: Alexey Osipov <si...@lerlan.ru> --- include/wacom-properties.h | 4 ++++ src/wcmCommon.c | 7 +++++++ src/wcmXCommand.c | 17 +++++++++++++++++ src/xf86WacomDefs.h | 1 + tools/xsetwacom.c | 10 +++++++++- 5 files changed, 38 insertions(+), 1 deletions(-) diff --git a/include/wacom-properties.h b/include/wacom-properties.h index 29d5056..396a250 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -101,6 +101,10 @@ */ #define WACOM_PROP_DEBUGLEVELS "Wacom Debug Levels" +/* 8 bit, 1 value, a multiplier (devided by 100) for relative cursor + * movements. + */ +#define WACOM_PROP_SENSITIVITY "Wacom Sensitivity" /* The following are tool types used by the driver in WACOM_PROP_TOOL_TYPE * or in the 'type' field for XI1 clients. Clients may check for one of diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 0cab803..f90611d 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -32,6 +32,9 @@ #define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125) #define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75) +/* Sensitivity by default is 100 percent */ +#define DEFAULT_SENSITIVITY 100 + /* X servers pre 1.9 didn't copy data passed into xf86Post*Event. * Data passed in would be modified, requiring the driver to copy the * data beforehand. @@ -571,6 +574,9 @@ wcmSendNonPadEvents(InputInfoPtr pInfo, const WacomDeviceState *ds, valuators[0] -= priv->oldX; valuators[1] -= priv->oldY; valuators[2] -= priv->oldZ; + valuators[0] *= 0.01 * priv->common->wcmSensitivity; + valuators[1] *= 0.01 * priv->common->wcmSensitivity; + valuators[2] *= 0.01 * priv->common->wcmSensitivity; if (IsCursor(priv)) { valuators[3] -= priv->oldRot; @@ -1415,6 +1421,7 @@ WacomCommonPtr wcmNewCommon(void) /* transmit position if increment is superior */ common->wcmRawSample = DEFAULT_SAMPLES; /* number of raw data to be used to for filtering */ + common->wcmSensitivity = DEFAULT_SENSITIVITY; return common; } diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 82f9b80..e3678fd 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -98,6 +98,7 @@ Atom prop_hover; Atom prop_tooltype; Atom prop_btnactions; Atom prop_product_id; +Atom prop_sensitivity; #ifdef DEBUG Atom prop_debuglevels; #endif @@ -244,6 +245,9 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) values[1] = common->tablet_id; prop_product_id = InitWcmAtom(pInfo->dev, XI_PROP_PRODUCT_ID, XA_INTEGER, 32, 2, values); + values[0] = 100; + prop_sensitivity = InitWcmAtom(pInfo->dev, WACOM_PROP_SENSITIVITY, XA_INTEGER, 8, 1, values); + #ifdef DEBUG values[0] = priv->debugLevel; values[1] = common->debugLevel; @@ -813,6 +817,19 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, if (!checkonly) common->wcmTPCButton = !values[0]; + } else if (property == prop_sensitivity) + { + CARD8 *values; + + if (prop->size != 1 || prop->format != 8) + return BadMatch; + + values = (CARD8*)prop->data; + + if (!checkonly) + { + common->wcmSensitivity = values[0]; + } #ifdef DEBUG } else if (property == prop_debuglevels) { diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 1cdfa1a..7798ca5 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -464,6 +464,7 @@ struct _WacomCommonRec int wcmCursorProxoutDistDefault; /* Default max mouse distance for proxy-out */ int wcmSuppress; /* transmit position on delta > supress */ int wcmRawSample; /* Number of raw data used to filter an event */ + int wcmSensitivity; /* Sensitivity multiplier (devided by 100) for relative mode */ int bufpos; /* position with buffer */ unsigned char buffer[BUFFER_SIZE]; /* data read from device */ diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 99ca974..c7c60d5 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -416,6 +416,14 @@ static param_t parameters[] = .get_func = get_all, .prop_flags = PROP_FLAG_READONLY, }, + { + .name = "Sensitivity", + .desc = "Sensitivity of cursor in relative mode (percents).", + .prop_name = WACOM_PROP_SENSITIVITY, + .prop_format = 8, + .prop_offset = 0, + .arg_count = 1, + }, { NULL } }; @@ -2669,7 +2677,7 @@ static void test_parameter_number(void) * deprecated them. * Numbers include trailing NULL entry. */ - assert(ARRAY_SIZE(parameters) == 34); + assert(ARRAY_SIZE(parameters) == 35); assert(ARRAY_SIZE(deprecated_parameters) == 17); } -- 1.7.0.4 ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel