1xcb_grab_key(3)                  XCB Requests                  xcb_grab_key(3)
2
3
4

NAME

6       xcb_grab_key - Grab keyboard key(s)
7

SYNOPSIS

9       #include <xcb/xproto.h>
10
11   Request function
12       xcb_void_cookie_t xcb_grab_key(xcb_connection_t *conn,
13              uint8_t owner_events, xcb_window_t grab_window,
14              uint16_t modifiers, xcb_keycode_t key, uint8_t pointer_mode,
15              uint8_t keyboard_mode);
16

REQUEST ARGUMENTS

18       conn      The XCB connection to X11.
19
20       owner_events
21                 If 1, the grab_window will still get the pointer events. If
22                 0, events are not reported to the grab_window.
23
24       grab_window
25                 Specifies the window on which the pointer should be grabbed.
26
27       modifiers The modifiers to grab.
28
29                 Using the special value XCB_MOD_MASK_ANY means grab the
30                 pointer with all possible modifier combinations.
31
32       key       The keycode of the key to grab.
33
34                 The special value XCB_GRAB_ANY means grab any key.
35
36       pointer_mode
37                 One of the following values:
38
39                 XCB_GRAB_MODE_SYNC
40                           The state of the keyboard appears to freeze: No
41                           further keyboard events are generated by the server
42                           until the grabbing client issues a releasing Allow‐
43                           Events request or until the keyboard grab is re‐
44                           leased.
45
46                 XCB_GRAB_MODE_ASYNC
47                           Keyboard event processing continues normally.
48
49
50
51       keyboard_mode
52                 One of the following values:
53
54                 XCB_GRAB_MODE_SYNC
55                           The state of the keyboard appears to freeze: No
56                           further keyboard events are generated by the server
57                           until the grabbing client issues a releasing Allow‐
58                           Events request or until the keyboard grab is re‐
59                           leased.
60
61                 XCB_GRAB_MODE_ASYNC
62                           Keyboard event processing continues normally.
63
64
65

DESCRIPTION

67       Establishes a passive grab on the keyboard. In the future, the keyboard
68       is actively grabbed (as for GrabKeyboard), the last-keyboard-grab time
69       is set to the time at which the key was pressed (as transmitted in the
70       KeyPress event), and the KeyPress event is reported if all of the fol‐
71       lowing conditions are true:
72
73       The keyboard is not grabbed and the specified key (which can itself be
74       a modifier key) is logically pressed when the specified modifier keys
75       are logically down, and no other modifier keys are logically down.
76
77       Either the grab_window is an ancestor of (or is) the focus window, or
78       the grab_window is a descendant of the focus window and contains the
79       pointer.
80
81       A passive grab on the same key combination does not exist on any ances‐
82       tor of grab_window.
83
84       The interpretation of the remaining arguments is as for XGrabKeyboard.
85       The active grab is terminated automatically when the logical state of
86       the keyboard has the specified key released (independent of the logical
87       state of the modifier keys), at which point a KeyRelease event is re‐
88       ported to the grabbing window.
89
90       Note that the logical state of a device (as seen by client applica‐
91       tions) may lag the physical state if device event processing is frozen.
92
93       A modifiers argument of AnyModifier is equivalent to issuing the re‐
94       quest for all possible modifier combinations (including the combination
95       of no modifiers).  It is not required that all modifiers specified have
96       currently assigned KeyCodes.  A keycode argument of AnyKey is equiva‐
97       lent to issuing the request for all possible KeyCodes.  Otherwise, the
98       specified keycode must be in the range specified by min_keycode and
99       max_keycode in the connection setup, or a BadValue error results.
100
101       If some other client has issued a XGrabKey with the same key combina‐
102       tion on the same window, a BadAccess error results.  When using AnyMod‐
103       ifier or AnyKey, the request fails completely, and a BadAccess error
104       results (no grabs are established) if there is a conflicting grab for
105       any combination.
106

RETURN VALUE

108       Returns an xcb_void_cookie_t. Errors (if any) have to be handled in the
109       event loop.
110
111       If you want to handle errors directly with xcb_request_check instead,
112       use xcb_grab_key_checked. See xcb-requests(3) for details.
113

ERRORS

115       xcb_access_error_t
116                 Another client has already issued a GrabKey with the same
117                 button/key combination on the same window.
118
119       xcb_value_error_t
120                 TODO: reasons?
121
122       xcb_window_error_t
123                 The specified window does not exist.
124

SEE ALSO

126       xcb-requests(3), xcb_grab_keyboard(3)
127

AUTHOR

129       Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐
130       rections and improvements.
131
132
133
134X Version 11                      libxcb 1.13                  xcb_grab_key(3)
Impressum