input: allow for master pointers to not have a button class.

There's devices (e.g. some barcode readers) that have axes but no buttons.
When such a device sends a motion event, the valuator and button class is
copied into the master pointer (i.e. removing the button class).
So we need a couple of extra sanity checks for the button class to exist.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-05-21 11:16:37 +10:00
commit c9df51b070
3 changed files with 5 additions and 5 deletions

View file

@ -996,8 +996,8 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
}
/* State needs to be assembled BEFORE the device is updated. */
state = (kbd) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0;
state |= (mouse) ? (mouse->button->state) : 0;
state = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0;
state |= (mouse && mouse->button) ? (mouse->button->state) : 0;
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))