[PATCH] dix: auto-float SD's with SendCoreEvents "false"

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 7 17:09:43 PDT 2009


AlwaysCore and SendCoreEvents specify whether a device is to send core
events. A device that has either disabled is not supposed to send core
events.

With MPX/XI2, a device that is attached automatically sends core events when
the event is routed through the master device. Floating a slave device
disables core events by breaking the route.

This patch automatically floats devices that have coreEvents disabled in the
xorg.conf/HAL. This replicates the behaviour of a SendCoreEvents "false"
device in server 1.6 and earlier.

The devices may still be reattached to a master at runtime.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/devices.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 97bb7df..803a352 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -312,8 +312,11 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
                 PairDevices(NULL, other, dev);
         } else
         {
-            other = (IsPointerDevice(dev)) ? inputInfo.pointer :
-                inputInfo.keyboard;
+            if (dev->coreEvents)
+                other = (IsPointerDevice(dev)) ? inputInfo.pointer :
+                    inputInfo.keyboard;
+            else
+                other = NULL; /* auto-float non-core devices */
             AttachDevice(NULL, dev, other);
         }
     }
@@ -2335,7 +2338,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
         return BadDevice;
 
     /* set from floating to floating? */
-    if (!dev->u.master && !master)
+    if (!dev->u.master && !master && dev->enabled)
         return Success;
 
     /* free the existing sprite. */
@@ -2357,7 +2360,13 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
      */
     if (!master)
     {
-        WindowPtr currentRoot = dev->spriteInfo->sprite->spriteTrace[0];
+        WindowPtr currentRoot;
+
+        if (dev->spriteInfo->sprite)
+            currentRoot = dev->spriteInfo->sprite->spriteTrace[0];
+        else
+            currentRoot = WindowTable[0];
+
         /* we need to init a fake sprite */
         screen = currentRoot->drawable.pScreen;
         screen->DeviceCursorInitialize(dev, screen);
-- 
1.6.3.rc1.2.g0164.dirty


More information about the xorg-devel mailing list