summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-11-12 13:08:38 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-11-12 13:08:38 +1030
commit23365d28651f7942fdafb889bcbbd019470a4274 (patch)
tree02efb79bd9534ffc55c2d5035d0b5a18fd9aa245 /dix
parent5a7a65a3c978a65e8ff39d0cc9878527ec42adc9 (diff)
dix: allow grab modifier device to be NULL.
This can happen if we check for a passive core grab and our device is a floating slave device. Doesn't really change anything as SDs can't send core events but it stops the server from segfaulting.
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/dix/events.c b/dix/events.c
index c3589f0c8..daebe3588 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3379,7 +3379,7 @@ CheckPassiveGrabsOnWindow(
{
#ifdef XKB
DeviceIntPtr gdev;
- XkbSrvInfoPtr xkbi;
+ XkbSrvInfoPtr xkbi = NULL;
gdev= grab->modifierDevice;
if (grab->coreGrab)
@@ -3389,7 +3389,8 @@ CheckPassiveGrabsOnWindow(
else
gdev = device;
}
- xkbi= gdev->key->xkbInfo;
+ if (gdev)
+ xkbi= gdev->key->xkbInfo;
#endif
tempGrab.modifierDevice = grab->modifierDevice;
if ((device == grab->modifierDevice) &&
@@ -3400,16 +3401,20 @@ CheckPassiveGrabsOnWindow(
))
tempGrab.modifiersDetail.exact =
#ifdef XKB
- (noXkbExtension?gdev->key->prev_state:xkbi->state.grab_mods);
+ (noXkbExtension) ?
+ ((gdev) ? gdev->key->prev_state : 0) :
+ ((xkbi) ? xkbi->state.grab_mods : 0);
#else
- grab->modifierDevice->key->prev_state;
+ (gdev) ? gdev->key->prev_state : 0;
#endif
else
tempGrab.modifiersDetail.exact =
#ifdef XKB
- (noXkbExtension ? gdev->key->state : xkbi->state.grab_mods);
+ (noXkbExtension) ?
+ ((gdev) ? gdev->key->state : 0) :
+ ((xkbi) ? xkbi->state.grab_mods : 0);
#else
- grab->modifierDevice->key->state;
+ (gdev) ? gdev->key->state : 0;
#endif
/* ignore the device for core events when comparing grabs */
if (GrabMatchesSecond(&tempGrab, grab, (xE->u.u.type < LASTEvent)) &&