From b3e4810a283d369e1a2c6c3288177fe79fd1e9d6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 1 Jun 2009 16:22:51 +1000 Subject: [PATCH] dix: move grab device assignment into GRABTYPE_CORE block. grab->type is the device type and XI2 types overlap with core events (being less than GenericEvent). Thus, for passive grabs the grab device would be overwritten with whatever device was activating it. Signed-off-by: Peter Hutterer --- dix/events.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dix/events.c b/dix/events.c index 3fd1dab06..8a340b673 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3461,19 +3461,6 @@ CheckPassiveGrabsOnWindow( event->corestate &= 0x1f00; event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00); grabinfo = &device->deviceGrab; - /* A passive grab may have been created for a different device - than it is assigned to at this point in time. - Update the grab's device and modifier device to reflect the - current state. - Since XGrabDeviceButton requires to specify the - modifierDevice explicitly, we don't override this choice. - */ - if (tempGrab.type < GenericEvent) - { - grab->device = device; - grab->modifierDevice = GetPairedDevice(device); - } - /* In some cases a passive core grab may exist, but the client * already has a core grab on some other device. In this case we * must not get the grab, otherwise we may never ungrab the @@ -3484,6 +3471,20 @@ CheckPassiveGrabsOnWindow( { DeviceIntPtr other; BOOL interfering = FALSE; + + /* A passive grab may have been created for a different device + than it is assigned to at this point in time. + Update the grab's device and modifier device to reflect the + current state. + Since XGrabDeviceButton requires to specify the + modifierDevice explicitly, we don't override this choice. + */ + if (tempGrab.type < GenericEvent) + { + grab->device = device; + grab->modifierDevice = GetPairedDevice(device); + } + for (other = inputInfo.devices; other; other = other->next) { GrabPtr othergrab = other->deviceGrab.grab;