summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xi/exevents.c4
-rw-r--r--dix/events.c4
-rw-r--r--xkb/xkbAccessX.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index a72fb8498..2eec7f89b 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -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))
diff --git a/dix/events.c b/dix/events.c
index 8400cfa57..19a9e1d38 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -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;
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 9bf87142a..88d5d9087 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -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) ) {