From 834ea071b619506e0bef5bdbf0e3c59831cf6e99 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 4 May 2009 15:58:15 +1000 Subject: [PATCH] dix: if grab types differ, two grabs cannot be the same. --- dix/events.c | 10 +++++++--- dix/grabs.c | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) 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))