From 97e3f4316b1c917f93d324f05d3a4551c1d051a3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 8 Sep 2009 09:55:22 +1000 Subject: [PATCH] dix: auto-float SD's with SendCoreEvents "false" 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 --- dix/devices.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 97bb7dfe4..dbd1b4ef5 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 /* new device auto-set to floating */ + currentRoot = WindowTable[0]; + /* we need to init a fake sprite */ screen = currentRoot->drawable.pScreen; screen->DeviceCursorInitialize(dev, screen);