1XGrabKeyboard(3)                XLIB FUNCTIONS                XGrabKeyboard(3)
2
3
4

NAME

6       XGrabKeyboard, XUngrabKeyboard - grab the keyboard
7

SYNTAX

9       int    XGrabKeyboard(Display   *display,   Window   grab_window,   Bool
10              owner_events, int pointer_mode, int keyboard_mode, Time time);
11
12       int XUngrabKeyboard(Display *display, Time time);
13

ARGUMENTS

15       display   Specifies the connection to the X server.
16
17       grab_window
18                 Specifies the grab window.
19
20       keyboard_mode
21                 Specifies further processing of  keyboard  events.   You  can
22                 pass GrabModeSync or GrabModeAsync.
23
24       owner_events
25                 Specifies a Boolean value that indicates whether the keyboard
26                 events are to be reported as usual.
27
28       pointer_mode
29                 Specifies further processing of pointer events.  You can pass
30                 GrabModeSync or GrabModeAsync.
31
32       time      Specifies  the time.  You can pass either a timestamp or Cur‐
33                 rentTime.
34

DESCRIPTION

36       The XGrabKeyboard function actively grabs control of the  keyboard  and
37       generates FocusIn and FocusOut events.  Further key events are reported
38       only to the grabbing client.  XGrabKeyboard overrides any  active  key‐
39       board grab by this client.  If owner_events is False, all generated key
40       events are reported with respect to grab_window.   If  owner_events  is
41       True  and  if  a generated key event would normally be reported to this
42       client, it is reported normally; otherwise, the event is reported  with
43       respect  to  the  grab_window.  Both KeyPress and KeyRelease events are
44       always reported, independent of any event selection made by the client.
45
46       If the keyboard_mode argument is GrabModeAsync, keyboard event process‐
47       ing  continues  as  usual.  If the keyboard is currently frozen by this
48       client, then processing of keyboard events is  resumed.   If  the  key‐
49       board_mode   argument  is  GrabModeSync,  the state of the keyboard (as
50       seen by client applications) appears to freeze, and the X server gener‐
51       ates  no further keyboard events until the grabbing client issues a re‐
52       leasing XAllowEvents call or until the keyboard grab is released.   Ac‐
53       tual  keyboard  changes are not lost while the keyboard is frozen; they
54       are simply queued in the server for later processing.
55
56       If pointer_mode is GrabModeAsync, pointer  event  processing  is  unaf‐
57       fected by activation of the grab.  If pointer_mode is GrabModeSync, the
58       state of the pointer  (as  seen  by  client  applications)  appears  to
59       freeze,  and the X server generates no further pointer events until the
60       grabbing client issues a releasing XAllowEvents call or until the  key‐
61       board  grab is released.  Actual pointer changes are not lost while the
62       pointer is frozen; they are simply queued in the server for later  pro‐
63       cessing.
64
65       If the keyboard is actively grabbed by some other client, XGrabKeyboard
66       fails and returns AlreadyGrabbed.  If grab_window is not  viewable,  it
67       fails and returns GrabNotViewable.  If the keyboard is frozen by an ac‐
68       tive grab of another client, it fails and returns GrabFrozen.   If  the
69       specified  time  is  earlier  than the last-keyboard-grab time or later
70       than the current X server time, it fails and  returns  GrabInvalidTime.
71       Otherwise,  the last-keyboard-grab time is set to the specified time is
72       replaced by the current X server time).
73
74       XGrabKeyboard can generate BadValue and BadWindow errors.
75
76       The XUngrabKeyboard function  releases  the  keyboard  and  any  queued
77       events if this client has it actively grabbed from either XGrabKeyboard
78       or XGrabKey.  XUngrabKeyboard does not release  the  keyboard  and  any
79       queued  events if the specified time is earlier than the last-keyboard-
80       grab time or is later than the current X server time.  It  also  gener‐
81       ates  FocusIn and FocusOut events.  The X server automatically performs
82       an UngrabKeyboard request if the event window for  an  active  keyboard
83       grab becomes not viewable.
84

DIAGNOSTICS

86       BadValue  Some numeric value falls outside the range of values accepted
87                 by the request.  Unless a specific range is specified for  an
88                 argument,  the  full  range defined by the argument's type is
89                 accepted.  Any argument defined as a set of alternatives  can
90                 generate this error.
91
92       BadWindow A value for a Window argument does not name a defined Window.
93

SEE ALSO

95       XAllowEvents(3), XGrabButton(3), XGrabKey(3), XGrabPointer(3)
96       Xlib - C Language X Interface
97
98
99
100X Version 11                     libX11 1.7.0                 XGrabKeyboard(3)
Impressum