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:
parent
ebe45e1a72
commit
c9df51b070
|
@ -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))
|
||||
|
|
|
@ -4128,7 +4128,7 @@ CoreEnterLeaveEvent(
|
|||
event.u.enterLeave.child = child;
|
||||
event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
|
||||
ELFlagSameScreen : 0;
|
||||
event.u.enterLeave.state = mouse->button->state & 0x1f00;
|
||||
event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0;
|
||||
if (keybd)
|
||||
event.u.enterLeave.state |=
|
||||
XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
|
||||
|
@ -4793,7 +4793,7 @@ ProcQueryPointer(ClientPtr client)
|
|||
memset(&rep, 0, sizeof(xQueryPointerReply));
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.mask = mouse->button->state;
|
||||
rep.mask = mouse->button ? (mouse->button->state) : 0;
|
||||
rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state);
|
||||
rep.length = 0;
|
||||
rep.root = (RootWindow(mouse))->drawable.id;
|
||||
|
|
|
@ -726,7 +726,7 @@ DeviceEvent *event = (DeviceEvent*)ev;
|
|||
COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
|
||||
backupproc, xkbUnwrapProc);
|
||||
|
||||
xkbi->state.ptr_buttons = mouse->button->state;
|
||||
xkbi->state.ptr_buttons = (mouse->button) ? mouse->button->state : 0;
|
||||
|
||||
/* clear any latched modifiers */
|
||||
if ( xkbi->state.latched_mods && (event->type == ET_ButtonRelease) ) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user