summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-10-08 14:12:21 +1030
committerPeter Hutterer <peter.hutterer@redhat.com>2008-10-13 13:50:40 +1030
commitf3f6ea89aa9e0ffe9e37bc059e5e6bf75be4ee9f (patch)
tree6d466cd9fe3b932d709b15886dea119f79ead410 /dix
parentad67e3f063aa79247270f29e989bbfe5f62c9ed7 (diff)
Xi: check all handlers before applying property changes.
The current code exposes to inconsistent updates, i.e. if handler N succeeds but handler N+1 fails in setting the property, an error is returned to the client although parts of the server now behave as if the property change succeeded. This patch adds a "checkonly" parameter to the SetProperty handler. The handlers are then called twice, once with checkonly set to TRUE. On the checkonly run, handlers _MUST_ return error codes if the property cannot be applied. Handlers are not permitted to actually apply the changes. On the second run, handlers are permitted to apply property changes. Errors codes returned on the second run are ignored.
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dix/devices.c b/dix/devices.c
index d19910fb7..d386f4113 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -103,17 +103,21 @@ DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
* DIX property handler.
*/
static int
-DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop)
+DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
+ BOOL checkonly)
{
if (property == XIGetKnownProperty(XI_PROP_ENABLED))
{
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
return BadValue;
- if ((*((CARD8*)prop->data)) && !dev->enabled)
- EnableDevice(dev);
- else if (!(*((CARD8*)prop->data)) && dev->enabled)
- DisableDevice(dev);
+ if (!checkonly)
+ {
+ if ((*((CARD8*)prop->data)) && !dev->enabled)
+ EnableDevice(dev);
+ else if (!(*((CARD8*)prop->data)) && dev->enabled)
+ DisableDevice(dev);
+ }
}
return Success;