From 1815defdb2f19e79f4ec0354d188ea763ff1f15e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 26 May 2009 10:08:46 +1000 Subject: [PATCH] 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. --- Xi/exevents.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 2eec7f89b..2bcc2e103 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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; }