1XGrabKey(3X11)                  XLIB FUNCTIONS                  XGrabKey(3X11)
2
3
4

NAME

6       XGrabKey, XUngrabKey - grab keyboard keys
7

SYNTAX

9       int XGrabKey(Display *display, int keycode, unsigned int modifiers,
10              Window grab_window, Bool owner_events, int pointer_mode, int
11              keyboard_mode);
12
13       int XUngrabKey(Display *display, int keycode, unsigned int modifiers,
14              Window grab_window);
15

ARGUMENTS

17       display   Specifies the connection to the X server.
18
19       grab_window
20                 Specifies the grab window.
21
22       keyboard_mode
23                 Specifies further processing of keyboard events.  You can
24                 pass GrabModeSync or GrabModeAsync.
25
26       keycode   Specifies the KeyCode or AnyKey.
27
28       modifiers Specifies the set of keymasks or AnyModifier.  The mask is
29                 the bitwise inclusive OR of the valid keymask bits.
30
31       owner_events
32                 Specifies a Boolean value that indicates whether the keyboard
33                 events are to be reported as usual.
34
35       pointer_mode
36                 Specifies further processing of pointer events.  You can pass
37                 GrabModeSync or GrabModeAsync.
38

DESCRIPTION

40       The XGrabKey function establishes a passive grab on the keyboard.  In
41       the future, the keyboard is actively grabbed (as for XGrabKeyboard),
42       the last-keyboard-grab time is set to the time at which the key was
43       pressed (as transmitted in the KeyPress event), and the KeyPress event
44       is reported if all of the following conditions are true:
45
46       ·    The keyboard is not grabbed and the specified key (which can
47            itself be a modifier key) is logically pressed when the specified
48            modifier keys are logically down, and no other modifier keys are
49            logically down.
50
51       ·    Either the grab_window is an ancestor of (or is) the focus window,
52            or the grab_window is a descendant of the focus window and con‐
53            tains the pointer.
54
55       ·    A passive grab on the same key combination does not exist on any
56            ancestor of grab_window.
57
58       The interpretation of the remaining arguments is as for XGrabKeyboard.
59       The active grab is terminated automatically when the logical state of
60       the keyboard has the specified key released (independent of the logical
61       state of the modifier keys).
62
63       Note that the logical state of a device (as seen by client applica‐
64       tions) may lag the physical state if device event processing is frozen.
65
66       A modifiers argument of AnyModifier is equivalent to issuing the
67       request for all possible modifier combinations (including the combina‐
68       tion of no modifiers).  It is not required that all modifiers specified
69       have currently assigned KeyCodes.  A keycode argument of AnyKey is
70       equivalent to issuing the request for all possible KeyCodes.  Other‐
71       wise, the specified keycode must be in the range specified by min_key‐
72       code and max_keycode in the connection setup, or a BadValue error
73       results.
74
75       If some other client has issued a XGrabKey with the same key combina‐
76       tion on the same window, a BadAccess error results.  When using AnyMod‐
77       ifier or AnyKey, the request fails completely, and a BadAccess error
78       results (no grabs are established) if there is a conflicting grab for
79       any combination.
80
81       XGrabKey can generate BadAccess, BadValue, and BadWindow errors.
82
83       The XUngrabKey function releases the key combination on the specified
84       window if it was grabbed by this client.  It has no effect on an active
85       grab.  A modifiers of AnyModifier is equivalent to issuing the request
86       for all possible modifier combinations (including the combination of no
87       modifiers).  A keycode argument of AnyKey is equivalent to issuing the
88       request for all possible key codes.
89
90       XUngrabKey can generate BadValue and BadWindow error.
91

DIAGNOSTICS

93       BadAccess A client attempted to grab a key/button combination already
94                 grabbed by another client.
95
96       BadValue  Some numeric value falls outside the range of values accepted
97                 by the request.  Unless a specific range is specified for an
98                 argument, the full range defined by the argument's type is
99                 accepted.  Any argument defined as a set of alternatives can
100                 generate this error.
101
102       BadWindow A value for a Window argument does not name a defined Window.
103

SEE ALSO

105       XAllowAccess(3X11), XGrabButton(3X11), XGrabKeyboard(3X11), XGrab‐
106       Pointer(3X11)
107       Xlib - C Language X Interface
108
109
110
111X Version 11                     libX11 1.0.3                   XGrabKey(3X11)
Impressum