メインコンテンツまでスキップ

Requests: Pointer and Keyboard Grabs

GrabPointer​

grab-window: WINDOW
owner-events: BOOL
event-mask: SETofPOINTEREVENT
pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
confine-to: WINDOW or None
cursor: CURSOR or None
time: TIMESTAMP or CurrentTime

=>

status: {Success, AlreadyGrabbed, Frozen, InvalidTime,
NotViewable}
Errors: Cursor, Window, Value

Actively grabs control of the pointer. Further pointer events are only reported to the grabbing client. The request overrides any active pointer grab by this client.

Event-mask is always augmented to include ButtonPress and ButtonRelease. If owner-events is False, all generated pointer events are reported with respect to grab-window, and are only reported if selected by event-mask. If owner-events is True, then if a generated pointer 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 event-mask. For either value of owner-events, unreported events are simply discarded.

Pointer-mode controls further processing of pointer events, and keyboard-mode controls further processing of keyboard events. If the mode is Asynchronous, event processing continues normally; if the device is currently frozen by this client, then processing of events for the device is resumed. If the mode is Synchronous, the device (as seen via the protocol) appears to freeze, and no further events for that device are generated by the server until the grabbing client issues a releasing AllowEvents request. Actual device changes are not lost while the device is frozen; they are simply queued for later processing.

If a cursor is specified, then it is displayed regardless of what window the pointer is in. If no cursor is specified, then when the pointer is in grab-window or one of its subwindows, the normal cursor for that window is displayed, and otherwise the cursor for grab-window is displayed.

If a confine-to window is specified, then the pointer will be restricted to stay contained in that window. The confine-to window need have no relationship to the grab-window. If the pointer is not initially in the confine-to window, then it is warped automatically to the closest edge (and enter/leave events generated normally) just before the grab activates. If the confine-to window is subsequently reconfigured, the pointer will be warped automatically as necessary to keep it contained in the window.

This request generates EnterNotify and LeaveNotify events.

The request fails with status AlreadyGrabbed if the pointer is actively grabbed by some other client. The request fails with status Frozen if the pointer is frozen by an active grab of another client. The request fails with status NotViewable if grab-window or confine-to window is not viewable. The request fails with status InvalidTime if the specified time is earlier than the last-pointer-grab time or later than the current server time; otherwise the last-pointer-grab time is set to the specified time, with CurrentTime replaced by the current server time.

UngrabPointer​

time: TIMESTAMP or CurrentTime

Releases the pointer if this client has it actively grabbed (from either GrabPointer or GrabButton or from a normal button press), and releases any queued events. The request has no effect if the specified time is earlier than the last-pointer-grab time or is later than the current server time.

This request generates EnterNotify and LeaveNotify events.

An UngrabPointer is performed automatically if the event window or confine-to window for an active pointer grab becomes not viewable.

GrabButton​

modifiers: SETofKEYMASK or AnyModifier
button: BUTTON or AnyButton
grab-window: WINDOW
owner-events: BOOL
event-mask: SETofPOINTEREVENT
pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
confine-to: WINDOW or None
cursor: CURSOR or None
Errors: Cursor, Window, Value, Access

This request establishes a passive grab. In the future, if the specified button is pressed when the specified modifier keys are down (and no other buttons or modifier keys are down), and grab-window contains the pointer, and the confine-to window (if any) is viewable, and these constraints are not satisfied for any ancestor, then the pointer is actively grabbed as described in GrabPointer, the last-pointer-grab time is set to the time at which the button was pressed (as transmitted in the ButtonPress event), and the ButtonPress event is reported. The interpretation of the remaining arguments is as for GrabPointer. The active grab is terminated automatically when all buttons are released (independent of the state of modifier keys).

A modifiers of AnyModifier is equivalent to issuing the request for all possible modifier combinations. A button of AnyButton is equivalent to issuing the request for all possible buttons.

An Access error is generated if some other client has already issued a GrabButton with the same button/key combination on the same window. When using AnyModifier or AnyButton, the request fails completely (no grabs are established) if there is a combination. The request has no effect on an active grab.

UngrabButton​

modifiers: SETofKEYMASK or AnyModifier
button: BUTTON or AnyButton
grab-window: WINDOW
Errors: Window

Releases the passive button/key combination on the specified window if it was grabbed by this client. A modifiers of AnyModifier is equivalent to issuing the request for all possible modifier combinations. A button of AnyButton is equivalent to issuing the request for all possible buttons. Has no effect on an active grab.

ChangeActivePointerGrab​

event-mask: SETofPOINTEREVENT
cursor: CURSOR or None
time: TIMESTAMP or CurrentTime
Errors: Cursor

Changes the specified dynamic parameters if the pointer is actively grabbed by the client and the specified time is no earlier than the last-pointer-grab time and no later than the current server time. The interpretation of event-mask and cursor are as in GrabPointer. The event-mask is always augmented to include ButtonPress and ButtonRelease. Has no effect on the passive parameters of a GrabButton.

GrabKeyboard​

grab-window: WINDOW
owner-events: BOOL
pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
time: TIMESTAMP or CurrentTime

=>

status: {Success, AlreadyGrabbed, Frozen, InvalidTime,
NotViewable}
Errors: Window, Value

Actively grabs control of the keyboard. Further key events are reported only to the grabbing client. The request overrides any active keyboard grab by this client.

If owner-events is False, all generated key events are reported with respect to grab-window. If owner-events is True, then if a generated key event would normally be reported to this client, it is reported normally; otherwise the event is reported with respect to the grab-window. Both KeyPress and KeyRelease events are always reported, independent of any event selection made by the client.

Pointer-mode controls further processing of pointer events, and keyboard-mode controls further processing of keyboard events. If the mode is Asynchronous, event processing continues normally; if the device is currently frozen by this client, then processing of events for the device is resumed. If the mode is Synchronous, the device (as seen via the protocol) appears to freeze, and no further events for that device are generated by the server until the grabbing client issues a releasing AllowEvents request. Actual device changes are not lost while the device is frozen; they are simply queued for later processing.

This request generates FocusIn and FocusOut events.

The request fails with status AlreadyGrabbed if the keyboard is actively grabbed by some other client. The request fails with status Frozen if the keyboard is frozen by an active grab of another client. The request fails with status NotViewable if grab-window is not viewable. The request fails with status InvalidTime if the specified time is earlier than the last-keyboard-grab time or later than the current server time; otherwise the last-keyboard-grab time is set to the specified time, with CurrentTime replaced by the current server time.

UngrabKeyboard​

time: TIMESTAMP or CurrentTime

Releases the keyboard if this client has it actively grabbed (from either GrabKeyboard or GrabKey), and releases any queued events. The request has no effect if the specified time is earlier than the last-keyboard-grab time or is later than the current server time.

This request generates FocusIn and FocusOut events.

An UngrabKeyboard is performed automatically if the event window for an active keyboard grab becomes not viewable.

GrabKey​

key: KEYCODE or AnyNonModifier
modifiers: SETofKEYMASK or AnyModifier
grab-window: WINDOW
owner-events: BOOL
pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
Errors: Window, Value, Access

This request establishes a passive grab on the keyboard. In the future, if the specified key (which can itself be a modifier key) is pressed when the specified modifier keys are down (and no other modifier keys are down), and the KeyPress event would be generated in grab-window or one of its inferiors, and these constraints are not satisfied for any ancestor, then the keyboard is actively grabbed as described in GrabKeyboard, the last-keyboard-grab time is transmitted in set to the time at which the key was pressed (as in the KeyPress event), and the KeyPress event is reported. The interpretation of the remaining arguments is as for GrabKeyboard. The active grab is terminated automatically when the specified key has been released (independent of the state of the modifier keys).

A modifiers of AnyModifier is equivalent to issuing the request for all possible modifier combinations. A key of AnyNonModifier is equivalent to issuing the request for all possible non-modifier key codes.

An Access error is generated if some other client has issued a GrabKey with the same key combination on the same window. When using AnyModifier or AnyNonModifier, the request fails completely (no grabs are established) if there is a conflicting grab for any combination.

UngrabKey​

key: KEYCODE or AnyNonModifier
modifiers: SETofKEYMASK or AnyModifier
grab-window: WINDOW
Errors: Window

Releases the key combination on the specified window if it was grabbed by this client. A modifiers of AnyModifier is equivalent to issuing the request for all possible modifier combinations. A key of AnyNonModifier is equivalent to issuing the request for all possible non-modifier key codes. Has no effect on an active grab.

AllowEvents​

mode: {AsyncPointer, SyncPointer, ReplayPointer,
AsyncKeyboard, SyncKeyboard, ReplayKeyboard}
time: TIMESTAMP or CurrentTime
Errors: Value

Releases some queued events if the client has caused a device to freeze. The request has no effect if the specified time is earlier than the last-grab time of the most recent active grab for the client, or if the specified time is later than the current server time.

For AsyncPointer, if the pointer is frozen by the client, pointer event processing continues normally. If the pointer is frozen twice by the client on behalf of two separate grabs, AsyncPointer "thaws" for both. AsyncPointer has no effect if the pointer is not frozen by the client, but the pointer need not be grabbed by the client.

For SyncPointer, if the pointer is frozen and actively grabbed by the client, pointer event processing continues normally until the next ButtonPress or ButtonRelease event is reported to the client, at which time the pointer again appears to freeze. However if the reported event causes the pointer grab to be released, then the pointer does not freeze. SyncPointer has no effect if the pointer is not frozen by the client, or if the pointer is not grabbed by the client.

For ReplayPointer, if the pointer is actively grabbed by the client and is frozen as the result of an event having been sent to the client (either from the activation of a GrabButton, or from a previous AllowEvents with mode SyncPointer, but not from a GrabPointer), then the pointer grab is released and that event is completely reprocessed, but this time ignoring any passive grabs at or above (towards the root) the grab-window of the grab just released. The request has no effect if the pointer is not grabbed by the client, or if the pointer is not frozen as the result of an event.

For AsyncKeyboard, if the keyboard is frozen by the client, keyboard event processing continues normally. If the pointer is frozen twice by the client on behalf of two separate grabs, AsyncPointer "thaws" for both. AsyncKeyboard has no effect if the keyboard is not frozen by the client, but the keyboard need not be grabbed by the client.

For SyncKeyboard, if the keyboard is frozen and actively grabbed by the client, keyboard event processing continues normally until the next KeyPress or KeyRelease event is reported to the client, at which time the keyboard again appears to freeze. However if the reported event causes the keyboard grab to be released, then the keyboard does not freeze. SyncKeyboard has no effect if the keyboard is not frozen by the client, or if the keyboard is not grabbed by the client.

For ReplayKeyboard, if the keyboard is actively grabbed by the client and is frozen as the result of an event having been sent to the client (either from the activation of a GrabKey, or from a previous AllowEvents with mode SyncKeyboard, but not from a GrabKeyboard), then the keyboard grab is released and that event is completely reprocessed, but this time ignoring any passive grabs at or above (towards the root) the grab-window of the grab just released. The request has no effect if the keyboard is not grabbed by the client, or if the keyboard is notfrozen as the result of an event.

AsyncPointer, SyncPointer, and Replay Pointer have no effect on processing of keyboard events. AsyncKeyboard, SyncKeyboard, and ReplayKeyboard have no effect on processing of pointer events.

It is possible for both a pointer grab and a keyboard grab to be active simultaneously (by the same or different clients). If a device is frozen on behalf of either grab, no event processing is performed for the device. It is possible for a single device to be frozen due to both grabs. In this case, the freeze must be released on behalf of both grabs before events can again be processed.

GrabServer​

Disables processing of requests and close-downs on all other connections (than the one this request arrived on).

UngrabServer​

Restarts processing of requests and close-downs on other connections.