diff options
-rw-r--r-- | XI2proto.h | 57 | ||||
-rw-r--r-- | XI2proto.txt | 79 | ||||
-rw-r--r-- | XIproto.h | 2 |
3 files changed, 136 insertions, 2 deletions
@@ -55,8 +55,10 @@ #define X_XIQueryDevice 48 #define X_XISetDeviceFocus 49 #define X_XIGetDeviceFocus 50 +#define X_XIGrabDevice 51 +#define X_XIUngrabDevice 52 -#define XI2REQUESTS (X_XIGetDeviceFocus - X_XIQueryDevicePointer + 1) +#define XI2REQUESTS (X_XIUngrabDevice - X_XIQueryDevicePointer + 1) #define XI2EVENTS (XI_LASTEVENT + 1) /************************************************************************************* @@ -488,6 +490,59 @@ typedef struct { } xXIGetDeviceFocusReply; #define sz_xXIGetDeviceFocusReply 32 + +/********************************************************** + * + * GrabDevice + * + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /* Always X_XIGrabDevice */ + uint16_t length; + Window grab_window; + Time time; + Cursor cursor; + uint16_t deviceid; + uint8_t grab_mode; + uint8_t paired_device_mode; + uint8_t owner_events; + uint8_t pad; + uint16_t mask_len; +} xXIGrabDeviceReq; +#define sz_xXIGrabDeviceReq 24 + +typedef struct { + uint8_t repType; /* input extension major opcode */ + uint8_t RepType; /* Always X_XIGrabDevice */ + uint16_t sequenceNumber; + uint32_t length; + uint8_t status; + uint8_t pad0; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; + uint32_t pad6; +} xXIGrabDeviceReply; +#define sz_xXIGrabDeviceReply 32 + +/********************************************************** + * + * UngrabDevice + * + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /* Always X_XIUngrabDevice */ + uint16_t length; + Time time; + uint16_t deviceid; + uint16_t pad; +} xXIUngrabDeviceReq; +#define sz_xXIUngrabDeviceReq 12 + /************************************************************************************* * * * EVENTS * diff --git a/XI2proto.txt b/XI2proto.txt index 8938017..4fbc716 100644 --- a/XI2proto.txt +++ b/XI2proto.txt @@ -624,6 +624,85 @@ XI2. Clients should ignore this data. Return the current focus window for the given device. + ┌─── + XIGrabDevice + deviceid: DEVICEID + grab-window: Window + owner-events: BOOL + grab-mode: { Synchronous, Asynchronous } + paired-device-mode: { Synchronous, Asynchronous } + time: TIMESTAMP or CurrentTime + mask_len: CARD16 + masks: SETofEVENTMASK + ▶ + status: Success, AlreadyGrabbed, Frozen, InvalidTime, NotViewable + └─── + + This request actively grabs control of the specified input device. Further + input evens from this device are reported only to the grabbing client. + This request overides any previous active grab by this client for this + device. + + The masks parameter specifies which events the client wishes to receive + while the device is grabbed. + + If owner-events is False, input events generated from this device are + reported with respect to grab-window, and are only reported if selected by + being included in the event-list. If owner-events is True, then if a + generated event would normally be reported to this client, it is reported + normally, otherwise the event is reported with respect to the grab-window, + and is only reported if selected by being included in the event-list. For + either value of owner-events, unreported events are discarded. + + If grab-mode is Asynchronous, device event processing continues normally. + If the device is currently frozen by this client, then processing of + device events is resumed. If grab-mode is Synchronous, the state of the + grabbed device (as seen by means of the protocol) appears to freeze, + and no further device events are generated by the server until the + grabbing client issues a releasing XIAllowEvents request or until the + device grab is released. Actual device input events are not lost while the + device is frozen; they are simply queued for later processing. + + If the device is a slave device, the paired-device-mode is ignored. + Otherwise, if this device is a master device and paired-device-mode is + Asynchronous, event processing is unaffected by activation of the grab. If + this device is a master device and paired-device-mode is Synchronous, the + state of the master device paired with this device (as seen by means of the + protocol) appears to freeze, and no further events are generated by the + server until the grabbing client issues a releasing XIAllowEvents request + or until the device grab is released. Actual events are not lost while the + devices are frozen; they are simply queued for later processing. + + This request fails and returns: + AlreadyGrabbed: If the device is actively grabbed by some other client. + NotViewable: If grab-window is not viewable. + InvalidTime: If the specified time is earlier than the last-grab-time for + the specified device or later than the current X server time. + Otherwise, the last-grab-time for the specified device is set + to the specified time and CurrentTime is replaced by the + current X server time. + Frozen: If the device is frozen by an active grab of another client. + + To release a grab of an extension device, use UngrabDevice. + + ┌─── + XIUngrabDevice + deviceid: DEVICEID + time: TIMESTAMP or CurrentTime + └─── + + Errors: Device + + This request releases the device if this client has it actively grabbed + (from either XIGrabDevice, XIGrabDeviceKey or XIGrabDeviceButton) and + releases any queued events. If any devices were frozen by the grab, + XIUngrabDevice thaws them. + + The request has no effect if the specified time is earlier + than the last-device-grab time or is later than the current server time. + This request generates DeviceFocusIn and DeviceFocusOut events. + An XIUngrabDevice is performed automatically if the event window for an + active device grab becomes not viewable. 8. Events: @@ -73,7 +73,7 @@ SOFTWARE. #define IEVENTS 17 /* does NOT include generic events */ #define IERRORS 5 -#define IREQUESTS 48 +#define IREQUESTS 39 #define CLIENT_REQ 1 |