From f3f6ea89aa9e0ffe9e37bc059e5e6bf75be4ee9f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Oct 2008 14:12:21 +1030 Subject: 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. --- include/exevents.h | 3 ++- include/inputstr.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/exevents.h b/include/exevents.h index 4df0aee48..667004aa1 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -232,7 +232,8 @@ extern long XIRegisterPropertyHandler( DeviceIntPtr dev, int (*SetProperty) (DeviceIntPtr dev, Atom property, - XIPropertyValuePtr prop), + XIPropertyValuePtr prop, + BOOL checkonly), int (*GetProperty) (DeviceIntPtr dev, Atom property), int (*DeleteProperty) (DeviceIntPtr dev, diff --git a/include/inputstr.h b/include/inputstr.h index 65cb1b97f..c74a4b108 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -367,7 +367,8 @@ typedef struct _XIPropertyHandler long id; int (*SetProperty) (DeviceIntPtr dev, Atom property, - XIPropertyValuePtr prop); + XIPropertyValuePtr prop, + BOOL checkonly); int (*GetProperty) (DeviceIntPtr dev, Atom property); int (*DeleteProperty) (DeviceIntPtr dev, -- cgit v1.2.3