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>
This commit is contained in:
Peter Hutterer 2011-02-18 11:30:10 +10:00
parent dc57f89959
commit df6559237a
2 changed files with 6 additions and 2 deletions

View File

@ -2473,7 +2473,10 @@ GetPairedDevice(DeviceIntPtr dev)
* returned master is either the device itself or the paired master device. * returned master is either the device itself or the paired master device.
* If dev is a floating slave device, NULL is returned. * 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 DeviceIntPtr
GetMaster(DeviceIntPtr dev, int which) GetMaster(DeviceIntPtr dev, int which)
@ -2485,7 +2488,7 @@ GetMaster(DeviceIntPtr dev, int which)
else else
master = dev->u.master; master = dev->u.master;
if (master) if (master && which != MASTER_ATTACHED)
{ {
if (which == MASTER_KEYBOARD) if (which == MASTER_KEYBOARD)
{ {

View File

@ -493,6 +493,7 @@ typedef struct _SpriteInfoRec {
#define MASTER_POINTER 1 #define MASTER_POINTER 1
#define MASTER_KEYBOARD 2 #define MASTER_KEYBOARD 2
#define SLAVE 3 #define SLAVE 3
#define MASTER_ATTACHED 4 /* special type for GetMaster */
typedef struct _DeviceIntRec { typedef struct _DeviceIntRec {
DeviceRec public; DeviceRec public;