[PATCH 06/20] Fix two incorrect checks for master devices.

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 17 19:52:13 PST 2011


These two were sideeffects of lastSlave being in the same field as the
master. For devices generated by the master device directly, lastSlave was 0
and the device would (with the old checks) be interpreted as floating.

Add the required checks to safeguard against master devices.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/exevents.c |    3 +++
 mi/mieq.c     |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 327873e..b39e202 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -710,6 +710,9 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
     if (rc != Success)
         return; /* Device has disappeared */
 
+    if (IsMaster(slave))
+        return;
+
     if (!slave->u.master)
         return; /* set floating since the event */
 
diff --git a/mi/mieq.c b/mi/mieq.c
index 01da52a..c0020c3 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -325,7 +325,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
     CHECKEVENT(original);
 
     /* ET_XQuartz has sdev == NULL */
-    if (!sdev || !sdev->u.master)
+    if (!sdev || IsMaster(sdev) || !sdev->u.master)
         return NULL;
 
 #if XFreeXDGA
-- 
1.7.4



More information about the xorg-devel mailing list