summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-02 15:47:58 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-09 14:56:24 +1000
commit631516a4aa9858874ee197444cd93d91b97a1089 (patch)
tree84cecadb9564a44362fe93369461ee214f9ad131 /Xi
parenta1304d6cb69301899c3c8450d6bf3e68573599df (diff)
Xi: check button mapping value _before_ assigning it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 5e446ec4a..532f04e42 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1002,11 +1002,9 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
deactivateDeviceGrab = TRUE;
break;
case ET_ButtonPress:
- event->detail.button = b->map[key];
- if (!event->detail.button) { /* there's no button 0 */
- event->detail.button = key;
+ if (b->map[key] == 0) /* there's no button 0 */
return;
- }
+ event->detail.button = b->map[key];
if (!grab && CheckDeviceGrabs(device, event, 0))
{
/* if a passive grab was activated, the event has been sent
@@ -1015,11 +1013,9 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
}
break;
case ET_ButtonRelease:
- event->detail.button = b->map[key];
- if (!event->detail.button) { /* there's no button 0 */
- event->detail.button = key;
+ if (b->map[key] == 0) /* there's no button 0 */
return;
- }
+ event->detail.button = b->map[key];
if (grab && !b->buttonsDown &&
device->deviceGrab.fromPassiveGrab &&
(device->deviceGrab.grab->type == ButtonPress ||