diff options
-rw-r--r-- | Xi/xiproperty.c | 1 | ||||
-rw-r--r-- | dix/devices.c | 25 | ||||
-rw-r--r-- | include/xserver-properties.h | 2 |
3 files changed, 28 insertions, 0 deletions
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 396061f80..55f20c402 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -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}, diff --git a/dix/devices.c b/dix/devices.c index b7f21927f..a99d046a5 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2563,6 +2563,19 @@ AllocDevicePair (ClientPtr client, char* name, } /** + * 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 * to XTest subsystem. @@ -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; } diff --git a/include/xserver-properties.h b/include/xserver-properties.h index 9b3b7bf8d..0f18dbc45 100644 --- a/include/xserver-properties.h +++ b/include/xserver-properties.h @@ -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 */ |