diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-08 14:25:53 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-11 12:24:54 +1030 |
commit | 6f6ac982951165a6ac77b3e32750c47780ea4990 (patch) | |
tree | 8a3e4c671ccf9c85da6e4016c0506d578801a1ef /src/draglock.c | |
parent | a2633c807812e6e8ad9c82e2a5940dfbf370aff5 (diff) |
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/draglock.c')
-rw-r--r-- | src/draglock.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/draglock.c b/src/draglock.c index 90809c9..86142b6 100644 --- a/src/draglock.c +++ b/src/draglock.c @@ -257,7 +257,8 @@ EvdevDragLockInitProperty(DeviceIntPtr dev) * i.e. to set bt 3 to draglock button 1, supply 0,0,1 */ int -EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val) +EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, + BOOL checkonly) { InputInfoPtr pInfo = dev->public.devicePrivate; EvdevPtr pEvdev = pInfo->private; @@ -287,8 +288,11 @@ EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val) if (meta > EVDEV_MAXBUTTONS) return BadValue; - pEvdev->dragLock.meta = meta; - memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair)); + if (!checkonly) + { + pEvdev->dragLock.meta = meta; + memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair)); + } } else { CARD8* vals = (CARD8*)val->data; @@ -297,11 +301,14 @@ EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val) if (vals[i] > EVDEV_MAXBUTTONS) return BadValue; - pEvdev->dragLock.meta = 0; - memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair)); + if (!checkonly) + { + pEvdev->dragLock.meta = 0; + memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair)); - for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++) - pEvdev->dragLock.lock_pair[i] = vals[i]; + for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++) + pEvdev->dragLock.lock_pair[i] = vals[i]; + } } } |