Add XI2 property requests.

Basically the same as XI 1.5, save the 16 bit deviceids.
This commit is contained in:
Peter Hutterer 2009-05-06 16:33:34 +10:00
parent 504b480c94
commit 2edc35c032
3 changed files with 296 additions and 2 deletions

8
XI2.h
View file

@ -28,6 +28,10 @@
#define XI_2_Major 2
#define XI_2_Minor 0
#define XIPropertyDeleted 0
#define XIPropertyCreated 1
#define XIPropertyModified 2
/* Passive grab types */
#define GrabtypeButton 0
#define GrabtypeKeysym 1
@ -108,7 +112,8 @@
#define XI_FocusOut 10
#define XI_HierarchyChanged 11
#define XI_RawEvent 12
#define XI_LASTEVENT XI_RawEvent
#define XI_PropertyEvent 13
#define XI_LASTEVENT XI_PropertyEvent
/* Event masks.
* Note: the protocol spec defines a mask to be of (1 << type). Clients are
@ -126,5 +131,6 @@
#define XI_FocusOutMask (1 << XI_FocusOut)
#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged)
#define XI_RawEventMask (1 << XI_RawEvent)
#define XI_PropertyEventMask (1 << XI_PropertyEvent)
#endif /* _XI2_H_ */

View file

@ -60,8 +60,12 @@
#define X_XIAllowEvents 53
#define X_XIPassiveGrabDevice 54
#define X_XIPassiveUngrabDevice 55
#define X_XIListProperties 56
#define X_XIChangeProperty 57
#define X_XIDeleteProperty 58
#define X_XIGetProperty 59
#define XI2REQUESTS (X_XIPassiveUngrabDevice - X_XIQueryDevicePointer + 1)
#define XI2REQUESTS (X_XIGetProperty - X_XIQueryDevicePointer + 1)
#define XI2EVENTS (XI_LASTEVENT + 1)
/*************************************************************************************
@ -622,6 +626,107 @@ typedef struct {
} xXIPassiveUngrabDeviceReq;
#define sz_xXIPassiveUngrabDeviceReq 20
/**********************************************************
*
* XIListProperties
*
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /* Always X_XIListProperties */
uint16_t length;
uint16_t deviceid;
uint16_t pad;
} xXIListPropertiesReq;
#define sz_xXIListPropertiesReq 8
typedef struct {
uint8_t repType; /* input extension major opcode */
uint8_t RepType; /* Always X_XIListProperties */
uint16_t sequenceNumber;
uint32_t length;
uint16_t num_properties;
uint16_t pad0;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIListPropertiesReply;
#define sz_xXIListPropertiesReply 32
/**********************************************************
*
* XIChangeDeviceProperty
*
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /* Always X_XIChangeProperty */
uint16_t length;
uint16_t deviceid;
uint8_t mode;
uint8_t format;
Atom property;
Atom type;
uint32_t num_items;
} xXIChangePropertyReq;
#define sz_xXIChangePropertyReq 20
/**********************************************************
*
* XIDeleteProperty
*
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /* Always X_XIDeleteProperty */
uint16_t length;
uint16_t deviceid;
uint16_t pad0;
Atom property;
} xXIDeletePropertyReq;
#define sz_xXIDeletePropertyReq 12
/**********************************************************
*
* XIGetProperty
*
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /* Always X_XIGetProperty */
uint16_t length;
uint16_t deviceid;
#if defined(__cplusplus) || defined(c_plusplus)
uint8_t c_delete;
#else
uint8_t delete;
#endif
uint8_t pad0;
Atom property;
Atom type;
uint32_t offset;
uint32_t len;
} xXIGetPropertyReq;
#define sz_xXIGetPropertyReq 24
typedef struct {
uint8_t repType; /* input extension major opcode */
uint8_t RepType; /* Always X_XIGetProperty */
uint16_t sequenceNumber;
uint32_t length;
Atom type;
uint32_t bytes_after;
uint32_t num_items;
uint8_t format;
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
} xXIGetPropertyReply;
#define sz_xXIGetPropertyReply 32
/*************************************************************************************
* *
* EVENTS *
@ -804,6 +909,28 @@ typedef xXIEnterEvent xXILeaveEvent;
typedef xXIEnterEvent xXIFocusInEvent;
typedef xXIEnterEvent xXIFocusOutEvent;
/***********************************************************
* PropertyEvents
*
*/
typedef struct
{
uint8_t type; /* always GenericEvent */
uint8_t extension; /* XI extension offset */
uint16_t sequenceNumber;
uint32_t length;
uint16_t evtype; /* XI_PropertyEvent */
uint16_t deviceid;
Time time;
Atom property;
uint8_t what;
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
} xXIPropertyEvent;
#undef Window
#undef Time

View file

@ -955,6 +955,151 @@ XI2. Clients should ignore this data.
This request has no effect if the matching button/keycode/keysym and
modifier combination is not grabbed b this client.
┌───
XIListProperties
deviceid: DEVICEID
num_properties: INT16
properties: LISTofATOM
└───
List the properties associated with the given device.
deviceid
The device to list the properties for.
num_atoms
Number of atoms in the reply
atoms
All properties on the device.
┌───
XIChangeProperty
deviceid: DEVICEID
property: ATOM
type: ATOM
format: { 8, 16, 32 }
mode: { Append, Prepend, Replace }
num_items: CARD32
data: LISTofINT8, or LISTofINT16, or LISTofINT32
└───
Change the given property on the given device.
deviceid
The device to change the property on.
property
The property to modify.
type
The property's type.
mode
One of Append, Prepend, or Replace
num_items
Number of items following this request.
data
Property data (nitems * format/8 bytes)
The type is uninterpreted by the server. The format specifies whether
the data should be viewed as a list of 8-bit, 16-bit, or 32-bit
quantities so that the server can correctly byte-swap as necessary.
If the mode is Replace, the previous propert y value is discarded. If
the mode is Prepend or Append, then the type and format must match the
existing property value (or a Match error results). If the property is
undefined, it is treated as defined with the correct type and format
with zero-length data. For Prepend, the data is tacked on to the
beginning of the existing data, and for Append, it is tacked on to the
end of the existing data.
The lifetime of a property is not tied to the storing client. Properties
remain until explicitly deleted, until the device is removed, or
until server reset.
A property cannot be deleted by setting nitems to zero. To delete a
property, use XIDeleteDeviceProperty.
This request generates an XIPropertyEvent.
┌───
XIDeleteProperty
deviceid: DEVICEID
property: ATOM
└───
Deletes the given property on the given device.
deviceid
The device to delete the property on.
property
The property to delete.
If the property is deleted, an XIPropertyEvent is generated on the device.
If the property does not exist, this request does nothing.
┌───
XIGetProperty
deviceid: DEVICEID
property: ATOM
type: Atom or AnyPropertyType
offset: CARD32
len: CARD32
delete: BOOL
type: Atom
bytes_after: CARD32
num_items: CARD32
format: { 8, 16, 32 }
data: LISTofINT8, or LISTofINT16, or LISTofINT32
└───
Get the data for the given property on the given device.
deviceid
The device to retrieve the property data from.
property
The property to retrieve the data from..
type
The property type to retrieve or AnyPropertyType
offset
The offset in 4-byte units.
len
Number of bytes to receive in 4-byte units.
delete
Delete the property after retrieving the data.
bytes_after
Number of unread bytes in the stored property
num_items
Number of items in data
format
8, 16, or 32
data
Property data (nitems * format/8 bytes)
If the specified property does not exist for the specified device, then
the return type is None, the format and bytes-after are zero, and the value is
empty. The delete argument is ignored in this case. If the specified property
exists but its type does not match the specified type, then the return
type is the actual type of the property, the format is the actual format of the
property (never zero), the bytes-after is the length of the property in bytes
(even if the format is 16 or 32), and the value is empty. The delete
argument is ignored in this case. If the specified property exists and
either AnyPropertyType is specified or the specified type matches the actual
type of the property, then the return type is the actual type of the property,
the format is the actual format of the property
(never zero), and the bytes-after and value are as follows, given:
N = actual length of the stored property in bytes
(even if the format is 16 or 32)
I = 4 * long-offset
T = NI
L = MINIMUM(T, 4 * long-length)
A = N (I + L)
The returned value starts at byte index I in the property (indexing
from 0), and its length in bytes is L. However, it is a Value error if
offset is given such that L is negative. The value of bytes_after is A,
giving the number of trailing unread bytes in the stored property. If
delete is True and the bytes_after is zero, the property is also
deleted from the device, and a XIPropertyNotify event is generated on
the device.
8. Events:
@ -1283,4 +1428,20 @@ EVENTHEADER { type: BYTE
buttons
Button state before the event.
┌───
XIPropertyEvent
EVENTHEADER
property: ATOM
what: { PropertyCreated, PropertyDeleted, PropertyModified }
└───
XIPropertyEvents are sent whenever a device property is created, deleted or
modified by a client.
property
The property that has been created, deleted, or modified
what
Specifies what has been changed.
❧❧❧❧❧❧❧❧❧❧❧