summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dix/getevents.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index bf9331eae..0229c0ac6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -407,8 +407,8 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int num_valuators, int *valuators) {
int numEvents = 0;
CARD32 ms = 0;
- KeySym *map = pDev->key->curKeySyms.map;
- KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth];
+ KeySym *map;
+ KeySym sym;
deviceKeyButtonPointer *kbp = NULL;
if (!events)
@@ -419,11 +419,14 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
return 0;
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
- (pDev->coreEvents && !inputInfo.keyboard->key))
+ (pDev->coreEvents && !(inputInfo.keyboard && inputInfo.keyboard->key)))
return 0;
if (key_code < 8 || key_code > 255)
return 0;
+
+ map = pDev->key->curKeySyms.map;
+ sym = map[key_code * pDev->key->curKeySyms.mapWidth];
if (pDev->coreEvents)
numEvents = 2;
@@ -539,6 +542,9 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
return 0;
+
+ if(pDev->coreEvents && !cp)
+ return 0;
/* FIXME: I guess it should, in theory, be possible to post button events
* from devices without valuators. */