Xi: add support for input device properties.

Basically just copied from randr properties, with minor changes only.
Each device supports arbitrary properties that can be modified by clients.
Modifications to the properties are passed to the driver (if applicable) and
can then affect the configuration of the device.

Note that device properties are limited to a specific device. A property set
on a slave device does not migrate to the master.
This commit is contained in:
Peter Hutterer
2008-07-07 22:10:17 +09:30
parent acce270935
commit 666838fcc8
7 changed files with 868 additions and 5 deletions

View File

@@ -335,6 +335,38 @@ typedef struct {
} SpriteRec, *SpritePtr;
/* Device properties */
typedef struct _XIPropertyValue
{
Atom type; /* ignored by server */
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
pointer data; /* private to client */
} XIPropertyValueRec;
typedef struct _XIProperty
{
struct _XIProperty *next;
Atom propertyName;
Bool is_pending;
Bool range;
Bool immutable;
int num_valid;
INT32 *valid_values;
XIPropertyValueRec current,
pending;
} XIPropertyRec;
typedef XIPropertyRec *XIPropertyPtr;
typedef XIPropertyValueRec *XIPropertyValuePtr;
typedef Bool (*XISetDevicePropertyProcPtr) (DeviceIntPtr dev,
Atom property,
XIPropertyValuePtr prop);
typedef Bool (*XIGetDevicePropertyProcPtr) (DeviceIntPtr dev,
Atom property);
/* states for devices */
#define NOT_GRABBED 0
@@ -347,8 +379,9 @@ typedef struct {
#define FROZEN_WITH_EVENT 6
#define THAW_OTHERS 7
typedef struct _GrabInfoRec {
TimeStamp grabTime;
TimeStamp grabTime;
Bool fromPassiveGrab; /* true if from passive grab */
Bool implicitGrab; /* implicit from ButtonPress */
GrabRec activeGrab;
@@ -431,6 +464,12 @@ typedef struct _DeviceIntRec {
int valuators[MAX_VALUATORS];
int numValuators;
} last;
/* Input device property handling */
XIPropertyPtr properties;
Bool pendingProperties;
XISetDevicePropertyProcPtr SetProperty;
XIGetDevicePropertyProcPtr GetProperty;
} DeviceIntRec;
typedef struct {