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.
This commit is contained in:
Peter Hutterer 2007-11-12 13:08:38 +10:30
parent 5a7a65a3c9
commit 23365d2865

View File

@ -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)) &&