Zum Hauptinhalt springen

Requests: Input Queries and Focus

QueryPointer​

window: WINDOW

=>

root: WINDOW
child: WINDOW or None
same-screen: BOOL
root-x, root-y, win-x, win-y: INT16
mask: SETofKEYBUTMASK
Errors: Window

The root window the pointer is currently on, and pointer coordinates relative to the root's origin, are returned. If same-screen is False, then the pointer is not on the same screen as the argument window, and child is None and win-x and win-y are zero. If same-screen is True, then win-x and win-y are the pointer coordinates relative to the argument window's origin, and child is the child containing the pointer, if any. The current state of the modifier keys and the buttons are also returned.

GetMotionEvents​

start, stop: TIMESTAMP or CurrentTime
window: WINDOW

=>

events: LISTofTIMECOORD

where

TIMECOORD: {x, y: CARD16
time: TIMESTAMP}
Error: Window

Returns all events in the motion history buffer that fall between the specified start and stop times (inclusive) and that have coordinates that lie within (including borders) the specified window at its present placement. The x and y coordinates are reported relative to the origin of the window.

TranslateCoordinates​

src-window, dst-window: WINDOW
src-x, src-y: INT16

=>

same-screen: BOOL
child: WINDOW or None
dst-x, dst-y: INT16
Errors: Window

The src-x and src-y coordinates are taken relative to src-window's origin, and returned as dst-x and dst-y coordinates relative to dst-window's origin. If same-screen is False, then src-window and dst-window are on different screens, and dst-x and dst-y are zero. If the coordinates are contained in a mapped child of dst-window, then that child is returned.

WarpPointer​

src-window: WINDOW or None
dst-window: WINDOW
src-x, src-y: INT16
src-width, src-height: CARD16
dst-x, dst-y: INT16
Errors: Window

Moves the pointer to [dst-x, dst-y] relative to dst-window's origin. If src-window is None, the move is independent of the current pointer position, but if a window is specified, the move only takes place if the pointer is currently contained in a visible portion of the specified rectangle of the src-window.

The src-x and src-y coordinates are relative to src-window's origin. If src-height is zero, it is replaced with the current height of src-window minus src-y. If src-width is zero, it is replaced with the current width of src-window minus src-x.

This request cannot be used to move the pointer outside the confine-to window of an active pointer grab; an attempt will only move the pointer as far as the closest edge of the confine-to window.

SetInputFocus​

focus: WINDOW or PointerRoot or None
revert-to: {Parent, PointerRoot, None}
time: TIMESTAMP or CurrentTime
Errors: Window, Value

Changes the input focus and the last-focus-change time. The request has no effect if the specified time is earlier than the current last-focus-change time or is later than the current server time; otherwise, the last-focus-change time is set to the specified time, with CurrentTime replaced by the current server time.

If None is specified as the focus, all keyboard events are discarded until a new focus window is set. In this case, therevert-to argument is ignored.

If a window is specified as the focus, it becomes the keyboard's focus window. If a generated keyboard event would normally be reported to this window or one of its inferiors, the event is reported normally; otherwise, the event is reported with respect to the focus window.

If PointerRoot is specified as the focus, the focus window is dynamically taken to be the root window of whatever screen the pointer is on at each keyboard event. In this case, the revert-to argument is ignored.

This request generates FocusIn and FocusOut events.

If the focus window becomes not viewable, the new focus window depends on the revert-to argument. If revert-to is Parent, the focus reverts to the parent (or the closest viewable ancestor) and the new revert-to value is take to be None. If revert-to is PointerRoot or None, the focus reverts to that value. When the focus reverts, FocusIn and FocusOut events are generated, but the last-focus-change time is not affected.

GetInputFocus​

=>

focus: WINDOW or PointerRoot or None
revert-to: {Parent, PointerRoot, None}

Returns the current focus state.

QueryKeymap​

=>

keys: LISTofCARD8

Returns a bit vector for the keyboard; each one bit indicates that the corresponding key is currently pressed. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N+7, with the least significant bit in the byte representing key 8N.