From 1a3f351c50cba66f71a73239318174b09fd9b63b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 22 May 2008 23:25:20 +0930 Subject: dix: when floating a device, create a new cursor sprite. This is essentially necessary to allow calls to miPointerGetSprite etc. to work for floating slave devices. --- dix/devices.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dix/devices.c b/dix/devices.c index 5606543f7..1b71a42be 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2415,6 +2415,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd) int AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) { + ScreenPtr screen; DeviceIntPtr oldmaster; if (!dev || dev->isMaster) return BadDevice; @@ -2428,7 +2429,11 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) /* free the existing sprite. */ if (!dev->u.master && dev->spriteInfo->paired == dev) + { + screen = miPointerGetScreen(dev); + screen->DeviceCursorCleanup(dev, screen); xfree(dev->spriteInfo->sprite); + } oldmaster = dev->u.master; dev->u.master = master; @@ -2442,10 +2447,14 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) if (!master) { WindowPtr currentRoot = dev->spriteInfo->sprite->spriteTrace[0]; + /* we need to init a fake sprite */ + screen = currentRoot->drawable.pScreen; + screen->DeviceCursorInitialize(dev, screen); dev->spriteInfo->sprite = NULL; InitializeSprite(dev, currentRoot); dev->spriteInfo->spriteOwner = FALSE; dev->spriteInfo->paired = dev; + } else { dev->spriteInfo->sprite = master->spriteInfo->sprite; -- cgit v1.2.3