aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-10-08 14:25:53 +1030
committerPeter Hutterer <peter.hutterer@redhat.com>2008-10-11 12:24:54 +1030
commit6f6ac982951165a6ac77b3e32750c47780ea4990 (patch)
tree8a3e4c671ccf9c85da6e4016c0506d578801a1ef /src/evdev.c
parentFix up bad return code in draglock property handler. (diff)
downloadxf86-input-evdev-6f6ac982951165a6ac77b3e32750c47780ea4990.tar.gz
xf86-input-evdev-6f6ac982951165a6ac77b3e32750c47780ea4990.tar.bz2
xf86-input-evdev-6f6ac982951165a6ac77b3e32750c47780ea4990.zip
Add checkonly handling to property handlers.
If checkonly is TRUE, we can only check if applying the value would succeed. The value is actually applied if checkonly is FALSE.
Diffstat (limited to 'src/evdev.c')
-rw-r--r--src/evdev.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 1c2a559..97cc41c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -108,7 +108,7 @@ static int EvdevCacheCompare(InputInfoPtr pInfo, Bool compare);
#ifdef HAVE_PROPERTIES
static void EvdevInitProperty(DeviceIntPtr dev);
static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
- XIPropertyValuePtr val);
+ XIPropertyValuePtr val, BOOL checkonly);
static Atom prop_invert = 0;
#endif
@@ -1494,7 +1494,8 @@ EvdevInitProperty(DeviceIntPtr dev)
}
static int
-EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
+EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
+ BOOL checkonly)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
@@ -1504,9 +1505,13 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
BOOL* data;
if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
return BadMatch;
- data = (BOOL*)val->data;
- pEvdev->invert_x = data[0];
- pEvdev->invert_y = data[1];
+
+ if (!checkonly)
+ {
+ data = (BOOL*)val->data;
+ pEvdev->invert_x = data[0];
+ pEvdev->invert_y = data[1];
+ }
}
return Success;