[PATCH v2 2/6] Input: Don't freeze unrelated devices in DeliverGrabbedEvent

Daniel Stone daniel at fooishbar.org
Tue Feb 22 05:43:28 PST 2011


When delivering an event to a device grabbed with SyncBoth,
DeliverGrabbedEvent walks the device tree looking for associated devices
to freeze them.  Unfortunately, it froze all devices instead of just the
paired device, and the previous fix in 4fbadc8b17237f3c would still break
if the same client had a non-SyncBoth grab on another unrelated master
device.

Fix this by completely ignoring devices that aren't our paired device.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/events.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 2723f53..de803f6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3904,16 +3904,15 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 	switch (grabinfo->sync.state)
 	{
 	case FREEZE_BOTH_NEXT_EVENT:
-	    for (dev = inputInfo.devices; dev; dev = dev->next)
+	    dev = GetPairedDevice(thisDev);
+	    if (dev)
 	    {
-		if (dev == thisDev)
-		    continue;
 		FreezeThaw(dev, TRUE);
 		if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
 		    (CLIENT_BITS(grab->resource) ==
 		     CLIENT_BITS(dev->deviceGrab.grab->resource)))
 		    dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
-		else if (GetPairedDevice(thisDev) == dev)
+		else
                     dev->deviceGrab.sync.other = grab;
 	    }
 	    /* fall through */
-- 
1.7.2.3



More information about the xorg-devel mailing list