summaryrefslogtreecommitdiff
path: root/dix/devices.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-11 12:47:37 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-22 14:35:44 +1000
commitdc57f89959e549403f8488eb9f23425bd7118b22 (patch)
tree905bf161dacd34e15051811955842ef9eaf65d10 /dix/devices.c
parente48bf3b6403dde33586ca0e421db61e402525453 (diff)
Switch to use IsFloating()
This is not a straightforward search/replacement due to a long-standing issue. dev->u.master is the same field as dev->u.lastSlave. Thus, if dev is a master device, a check for dev->u.master may give us false positives and false negatives. The switch to IsFloating() spells out these cases and modifies the conditions accordingly to cover both cases. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Diffstat (limited to 'dix/devices.c')
-rw-r--r--dix/devices.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 6c0dc42a4..a3367f7b8 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -987,7 +987,7 @@ CloseDownDevices(void)
*/
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (!IsMaster(dev) && dev->u.master)
+ if (!IsMaster(dev) && !IsFloating(dev))
dev->u.master = NULL;
}
@@ -2397,11 +2397,11 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
return BadDevice;
/* set from floating to floating? */
- if (!dev->u.master && !master && dev->enabled)
+ if (IsFloating(dev) && !master && dev->enabled)
return Success;
/* free the existing sprite. */
- if (!dev->u.master && dev->spriteInfo->paired == dev)
+ if (IsFloating(dev) && dev->spriteInfo->paired == dev)
{
screen = miPointerGetScreen(dev);
screen->DeviceCursorCleanup(dev, screen);
@@ -2459,7 +2459,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
DeviceIntPtr
GetPairedDevice(DeviceIntPtr dev)
{
- if (!IsMaster(dev) && dev->u.master)
+ if (!IsMaster(dev) && !IsFloating(dev))
dev = dev->u.master;
return dev->spriteInfo->paired;