Xi: only deactivate passive grabs if the event type matches.

This didn't use to be a problem when devices could only be pointers or
keyboards, not both. Nowadays, slave devices may have both buttons and
keyboards, and in this case we don't want to deactivate a passive keyboard
grab when a button release is detected.
This commit is contained in:
Peter Hutterer 2009-05-26 10:08:46 +10:00
parent 9dc3810a03
commit 1815defdb2

View File

@ -1070,8 +1070,11 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
}
break;
case ET_KeyRelease:
if (device->deviceGrab.fromPassiveGrab &&
(key == device->deviceGrab.activatingKey))
if (grab && device->deviceGrab.fromPassiveGrab &&
(key == device->deviceGrab.activatingKey) &&
(device->deviceGrab.grab->type == KeyPress ||
device->deviceGrab.grab->type == DeviceKeyPress ||
device->deviceGrab.grab->type == XI_KeyPress))
deactivateDeviceGrab = TRUE;
break;
case ET_ButtonPress:
@ -1092,7 +1095,11 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
event->detail.button = key;
return;
}
if (!b->buttonsDown && device->deviceGrab.fromPassiveGrab)
if (grab && !b->buttonsDown &&
device->deviceGrab.fromPassiveGrab &&
(device->deviceGrab.grab->type == ButtonPress ||
device->deviceGrab.grab->type == DeviceButtonPress ||
device->deviceGrab.grab->type == XI_ButtonPress))
deactivateDeviceGrab = TRUE;
}