diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-02-18 11:30:10 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-02-22 14:35:44 +1000 |
commit | df6559237a2d641b2fc38d14975beab9bae0d971 (patch) | |
tree | 59b4a7ee5e7b738aee330168f4cdf5d0ffb791e5 | |
parent | dc57f89959e549403f8488eb9f23425bd7118b22 (diff) |
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 <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
-rw-r--r-- | dix/devices.c | 7 | ||||
-rw-r--r-- | 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; |