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 <[email protected]>
---
 src/wcmCommon.c     |    4 ----
 src/wcmXCommand.c   |    8 +++++---
 src/xf86WacomDefs.h |    4 ++++
 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,
-- 
1.7.7.5


------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to