diff --git a/dix/events.c b/dix/events.c index e1feb4d61..86aa24f17 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3323,13 +3323,17 @@ CheckPassiveGrabsOnWindow( /* Check for XI grabs first */ tempGrab.type = GetXIType((InternalEvent*)event); + tempGrab.grabtype = GRABTYPE_XI; if (GrabMatchesSecond(&tempGrab, grab, FALSE)) match = XI_MATCH; /* Check for a core grab (ignore the device when comparing) */ - if (!match && checkCore && - (tempGrab.type = GetCoreType((InternalEvent*)event)) && - (GrabMatchesSecond(&tempGrab, grab, TRUE))) + if (!match && checkCore) + { + tempGrab.grabtype = GRABTYPE_CORE; + if ((tempGrab.type = GetCoreType((InternalEvent*)event)) && + (GrabMatchesSecond(&tempGrab, grab, TRUE))) match = CORE_MATCH; + } if (match && (!grab->confineTo || (grab->confineTo->realized && diff --git a/dix/grabs.c b/dix/grabs.c index 06e1ebb6e..03776d2e5 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -254,6 +254,10 @@ GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) Bool GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice) { + + if (pFirstGrab->grabtype != pSecondGrab->grabtype) + return FALSE; + if (!ignoreDevice && ((pFirstGrab->device != pSecondGrab->device) || (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice))) @@ -288,6 +292,9 @@ GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice) static Bool GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab) { + if (pFirstGrab->grabtype != pSecondGrab->grabtype) + return FALSE; + if (pFirstGrab->device != pSecondGrab->device || (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) || (pFirstGrab->type != pSecondGrab->type))