From df6559237a2d641b2fc38d14975beab9bae0d971 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 18 Feb 2011 11:30:10 +1000 Subject: [PATCH] dix: add MASTER_ATTACHED as allowed type for GetMaster(). In some cases, we don't know/care whether we want the master pointer or keyboard for a device. Add a new type MASTER_ATTACHED to return the master this device is attached to. Signed-off-by: Peter Hutterer Reviewed-by: Benjamin Tissoires --- dix/devices.c | 7 +++++-- include/inputstr.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index a3367f7b8..8be1903eb 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2473,7 +2473,10 @@ GetPairedDevice(DeviceIntPtr dev) * returned master is either the device itself or the paired master device. * If dev is a floating slave device, NULL is returned. * - * @type ::MASTER_KEYBOARD or ::MASTER_POINTER + * @type ::MASTER_KEYBOARD or ::MASTER_POINTER or ::MASTER_ATTACHED + * @return The requested master device. In the case of MASTER_ATTACHED, this + * is the directly attached master to this device, regardless of the type. + * Otherwise, it is either the master keyboard or pointer for this device. */ DeviceIntPtr GetMaster(DeviceIntPtr dev, int which) @@ -2485,7 +2488,7 @@ GetMaster(DeviceIntPtr dev, int which) else master = dev->u.master; - if (master) + if (master && which != MASTER_ATTACHED) { if (which == MASTER_KEYBOARD) { diff --git a/include/inputstr.h b/include/inputstr.h index b74ee0454..58d318fd6 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -493,6 +493,7 @@ typedef struct _SpriteInfoRec { #define MASTER_POINTER 1 #define MASTER_KEYBOARD 2 #define SLAVE 3 +#define MASTER_ATTACHED 4 /* special type for GetMaster */ typedef struct _DeviceIntRec { DeviceRec public;