summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-01-12 13:40:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-01-26 12:59:17 +1000
commitdbc25fa4fd86af7ccd42af04e6360dfdd0336735 (patch)
treeb71650e818bc4ce577a5a430f01e5312ec4dfede
parent09b1aa6538cd48e20928da9a835999dfc851f62c (diff)
Allow for a threshold of -1 to reset to the built-in default (#43221)
This switches interpretation of the property from unsigned to signed. Not a big deal, since the maximum value has always been 2048 anyway and on 32-bit that doesn't actually change anything. X.Org Bug 43221 <http://bugs.freedesktop.org/show_bug.cgi?id=43221> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Ping Cheng <pinglinux@gmail.com>
-rw-r--r--src/wcmCommon.c4
-rw-r--r--src/wcmXCommand.c8
-rw-r--r--src/xf86WacomDefs.h4
3 files changed, 9 insertions, 7 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 0f041e3..11340ea 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -28,10 +28,6 @@
#include <xkbsrv.h>
#include <xf86_OSproc.h>
-/* Tested result for setting the pressure threshold to a reasonable value */
-#define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125)
-#define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75)
-
/* 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.
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 40393dc..6613a59 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -755,14 +755,16 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
common->wcmCursorProxoutDist = value;
} else if (property == prop_threshold)
{
- CARD32 value;
+ INT32 value;
if (prop->size != 1 || prop->format != 32)
return BadValue;
- value = *(CARD32*)prop->data;
+ value = *(INT32*)prop->data;
- if ((value < 1) || (value > FILTER_PRESSURE_RES))
+ if (value == -1)
+ value = DEFAULT_THRESHOLD;
+ else if ((value < 1) || (value > FILTER_PRESSURE_RES))
return BadValue;
if (!checkonly)
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 2f3f7b4..3b79189 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -183,6 +183,10 @@ struct _WacomModel
#define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
#define FILTER_PRESSURE_RES 2048 /* maximum points in pressure curve */
+/* Tested result for setting the pressure threshold to a reasonable value */
+#define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125)
+#define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75)
+
#define WCM_MAX_BUTTONS 32 /* maximum number of tablet buttons */
#define WCM_MAX_MOUSE_BUTTONS 16 /* maximum number of buttons-on-pointer
* (which are treated as mouse buttons,