diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-25 11:08:21 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-07 16:50:47 +1000 |
commit | 504b480c946fe4c4a96500ef8c5da100b787ab32 (patch) | |
tree | 10d5e67605cbb52543212df5b6884680a1b12a19 | |
parent | 5d60550fdeb375a88ac9da42bcad4ee69b0df64a (diff) |
XI2: add passive grabs.
Most notably XI2 provides keysym grabs instead of keycode grabs.
-rw-r--r-- | XI2.h | 7 | ||||
-rw-r--r-- | XI2proto.h | 67 | ||||
-rw-r--r-- | XI2proto.txt | 128 |
3 files changed, 201 insertions, 1 deletions
@@ -28,6 +28,13 @@ #define XI_2_Major 2 #define XI_2_Minor 0 +/* Passive grab types */ +#define GrabtypeButton 0 +#define GrabtypeKeysym 1 + +/* Passive grab modifier */ +#define XIAnyModifier (1 << 31) + /* XIAllowEvents event-modes */ #define AsyncDevice 0 #define SyncDevice 1 @@ -58,8 +58,10 @@ #define X_XIGrabDevice 51 #define X_XIUngrabDevice 52 #define X_XIAllowEvents 53 +#define X_XIPassiveGrabDevice 54 +#define X_XIPassiveUngrabDevice 55 -#define XI2REQUESTS (X_XIAllowEvents - X_XIQueryDevicePointer + 1) +#define XI2REQUESTS (X_XIPassiveUngrabDevice - X_XIQueryDevicePointer + 1) #define XI2EVENTS (XI_LASTEVENT + 1) /************************************************************************************* @@ -171,6 +173,15 @@ typedef struct { uint16_t mask_len; /**< Length of mask in 4 byte units */ } xXIDeviceEventMask; + + +typedef struct { + uint32_t modifiers; + uint8_t status; + uint8_t pad0; + uint16_t pad1; +} xXIGrabModifierInfo; + /************************************************************************************* * * * REQUESTS * @@ -557,6 +568,60 @@ typedef struct { } xXIAllowEventsReq; #define sz_xXIAllowEventsReq 12 + +/********************************************************** + * + * PassiveGrabDevice + * + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /* Always X_XIPassiveGrabDevice */ + uint16_t length; + Time time; + Window grab_window; + Cursor cursor; + uint32_t detail; + uint16_t deviceid; + uint16_t num_modifiers; + uint16_t mask_len; + uint8_t grab_type; + uint8_t grab_mode; + uint8_t paired_device_mode; + uint8_t owner_events; + uint16_t pad1; +} xXIPassiveGrabDeviceReq; +#define sz_xXIPassiveGrabDeviceReq 32 + +typedef struct { + uint8_t repType; /* input extension major opcode */ + uint8_t RepType; /* Always X_XIPassiveGrabDevice */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t num_modifiers; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; + uint32_t pad6; +} xXIPassiveGrabDeviceReply; +#define sz_xXIPassiveGrabDeviceReply 32 + +typedef struct { + uint8_t reqType; + uint8_t ReqType; /* Always X_XIPassiveUngrabDevice */ + uint16_t length; + Window grab_window; + uint32_t detail; + uint16_t deviceid; + uint16_t num_modifiers; + uint8_t grab_type; + uint8_t pad0; + uint16_t pad1; +} xXIPassiveUngrabDeviceReq; +#define sz_xXIPassiveUngrabDeviceReq 20 + /************************************************************************************* * * * EVENTS * diff --git a/XI2proto.txt b/XI2proto.txt index 38a3a5d..903ebe7 100644 --- a/XI2proto.txt +++ b/XI2proto.txt @@ -828,6 +828,134 @@ XI2. Clients should ignore this data. paired master device frozen by the client. AsyncPair has no effect if deviceid specifies a slave device. + ┌─── + XIPassiveGrabDevice + deviceid: DEVICEID + detail: CARD32 + grab_type: { GrabtypeButton, GrabtypeKeysym } + grab_window: Window + cursor: Cursor + owner_events: Bool + grab_mode: { Synchronous, Asynchronous } + paired_device_mode: { Synchronous, Asynchronous } + num_modifiers: INT16 + mask_len: CARD16 + masks: SETofEVENTMASK + modifiers: CARD32 or GrabAnyModifier + ▶ + num_modifiers_return: INT16 + modifiers_return: GRABMODIFIERINFO + └─── + + GRABMODIFIERINFO { status: Access + modifiers: CARD32 } + + Establish an explicit passive grab for a button or keycode or keysym + on the specified input device. + + cursor + The cursor to display for the duration of the grab. If grab_type + is not GrabtypeButton, this argument is ignored. + deviceid + The device to establish the passive grab on. + detail + The button number, or key symbol to grab for. + grab_type + The type of grab to establish. + grab_window + Events are reported relative to the grab window. + grab_mode + 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. + mask_len + Length of mask in 4 byte units. + mask + Event mask. An event mask for an event type T is defined as (1 << T). + modifiers + XKB modifier state to activate this passive grab. + num_modifiers + Number of elements in modifiers. + owner_events + Specifies whether event will be reported normally or relative to the + grab window. + num_modifiers_return + Number of elements in modifiers_return + modifiers_return + XKB modifier state that could not be 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. + + In the future, the device is actively grabbed if: + - the device is not grabbed, and + - the specified modifier keys are down, and + - the grab_type is GrabtypeButton and the button specified in detail + is logically pressed or the grab_type is GrabtypeKeysym and the + keysym specified in detail is logically pressed, and + - the grab_window contains the pointer, and + - a passive grab on the same button/keycode/keysym + modifier + combination does not exist on an ancestor of grab_window. + + A modifier of GrabAnyModifier is equivalent to issuing the request for + all possible modifier combinations (including no modifiers). A client + may request a grab for GrabAnyModifier and explicit modifier + combinations in the same request. + + The grab is released when all buttons or keycodes or keysyms are + released, independent of the state of modifier keys. Note that the + logical state of a device (as seen by means of the protocol) may lag + the physical state if device event processing is frozen. + This request overrides all previous passive grabs by the same client + on the same button/key combinations on the same window. + + If some other client already has issued a XIPassiveGrabDevice request + with the same button/keycode/keysym and modifier combination, the + failed modifier combinations is returned in modifiers_return. If + num_modifiers_return is zero, all passive grabs have been successful. + + ┌─── + XIPassiveUngrabDevice + deviceid: DEVICEID + detail: CARD32 + grab_type: { ButtonGrab, KeycodeGrab, KeysymGrab } + grab_window: Window + num_modifiers: INT16 + modifiers: MODIFIERINFO + └─── + + Release an explicit passive grab for a button or keycode or keysym on + the specified input device. + + deviceid + The device to establish the passive grab on. + detail + The button number or key symbol to ungrab. + grab_type + The type of grab to establish. + grab_window + Events are reported relative to the grab window. + modifiers + XKB modifier state to activate this passive grab. + num_modifiers + Number of elements in modifiers. + + This request has no effect if the matching button/keycode/keysym and + modifier combination is not grabbed b this client. + + 8. Events: An event specifies its length in 4-byte units after the initial 32 bytes. |