summaryrefslogtreecommitdiff
path: root/dix/inpututils.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-01-24 18:16:54 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-02-05 07:50:16 +1000
commit25d10464f440b8b34594b7c988a99a830ea39a29 (patch)
treebc5704ec0e6b3a330e0a9b551720f60ffec56138 /dix/inpututils.c
parent73926622b91fde01148727f26d6aad5e6827c1d2 (diff)
dix: fix button state check before changing a button mapping
dev->button->down is a bitmask, not a normal array. Use the helper function to check, we technically allow the mapping to change after the physical button has been pressed (but not yet processed yet), so only check BUTTON_PROCESSED. From XSetPointerMapping(3): "If any of the buttons to be altered are logically in the down state, XSetPointerMapping returns MappingBusy, and the mapping is not changed." Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'dix/inpututils.c')
-rw-r--r--dix/inpututils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dix/inpututils.c b/dix/inpututils.c
index a10a7c761..e5bcc31f7 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -60,7 +60,8 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
}
for (i = 0; i < len; i++) {
- if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1])
+ if (dev->button->map[i + 1] != map[i] &&
+ button_is_down(dev, i + 1, BUTTON_PROCESSED))
return MappingBusy;
}