From 840bde3d32f3627dfc3d7d8b6564a61a8014933b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Oct 2007 13:09:35 +0930 Subject: [PATCH] dix: GetPairedDevice: return dev paired with master for slave devices. --- dix/devices.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dix/devices.c b/dix/devices.c index a4360e583..0f43d1287 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2268,11 +2268,17 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) return Success; } -/* Return the device paired with the given device or NULL. +/** + * Return the device paired with the given device or NULL. + * Returns the device paired with the parent master if the given device is a + * slave device. */ _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr dev) { + if (!dev->isMaster && dev->master) + dev = dev->master; + if (!dev->spriteInfo->paired) { ErrorF("[dix] No device paired with %d (%s).\n",