dix: introduce "Xtst Device" label property.

Xtst devices get this property assigned automatically so they can be
detected easily by a client.
The property is read-only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-06-23 14:09:22 +10:00
parent 0814f511d5
commit e13605ea40
3 changed files with 28 additions and 0 deletions

View File

@ -51,6 +51,7 @@ static struct dev_properties
char *name;
} dev_properties[] = {
{0, XI_PROP_ENABLED},
{0, XI_PROP_XTST_DEVICE},
{0, XATOM_FLOAT},
{0, ACCEL_PROP_PROFILE_NUMBER},
{0, ACCEL_PROP_CONSTANT_DECELERATION},

View File

@ -2562,6 +2562,19 @@ AllocDevicePair (ClientPtr client, char* name,
return Success;
}
/**
* Don't allow changing the Xtst property.
*/
static int
DeviceSetXtstProperty(DeviceIntPtr dev, Atom property,
XIPropertyValuePtr prop, BOOL checkonly)
{
if (property == XIGetKnownProperty(XI_PROP_XTST_DEVICE))
return BadAccess;
return Success;
}
/**
* Allocate a device pair that is initialised as a slave
* device with properties that identify the devices as belonging
@ -2576,6 +2589,7 @@ int AllocXtstDevice (ClientPtr client, char* name,
int retval;
int len = strlen(name);
char *xtstname = xcalloc(len + 6, 1 );
char dummy = 1;
strncpy( xtstname, name, len);
strncat( xtstname, " Xtst", 5 );
@ -2588,6 +2602,17 @@ int AllocXtstDevice (ClientPtr client, char* name,
xfree( xtstname );
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTST_DEVICE), FALSE);
XIRegisterPropertyHandler(*ptr, DeviceSetXtstProperty, NULL, NULL);
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTST_DEVICE), FALSE);
XIRegisterPropertyHandler(*keybd, DeviceSetXtstProperty, NULL, NULL);
return retval;
}

View File

@ -32,6 +32,8 @@
/* BOOL. 0 - device disabled, 1 - device enabled */
#define XI_PROP_ENABLED "Device Enabled"
/* BOOL. If present, device is a virtual Xtst device */
#define XI_PROP_XTST_DEVICE "Xtst Device"
/* Pointer acceleration properties */
/* INTEGER of any format */