input: abstract Xtst device lookup

The callers should need to use the dev privates key to look up xtest
devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
This commit is contained in:
Peter Hutterer
2009-06-22 16:55:12 +10:00
parent 34424fab9a
commit 1bcc0d3c24
3 changed files with 19 additions and 23 deletions

View File

@@ -2589,3 +2589,16 @@ int AllocXtstDevice (ClientPtr client, char* name,
return retval;
}
/**
* If master is NULL, return TRUE if the given device is an xtest device or
* FALSE otherwise.
* If master is not NULL, return TRUE if the given device is this master's
* xtest device.
*/
BOOL
IsXtstDevice(DeviceIntPtr dev, DeviceIntPtr master)
{
return (!IsMaster(dev) && (!master || dev->u.master == master) &&
( dixLookupPrivate(&dev->devPrivates, XTstDevicePrivateKey) != NULL));
}