XGrabKeyboard, XUngrabKeyboard − grab the keyboard
int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, Time time);
int XUngrabKeyboard(Display *display, Time time);
Specifies the connection to the X server.
Specifies the grab window.
Specifies further processing of keyboard events. You can pass GrabModeSync or GrabModeAsync.
Specifies a Boolean value that indicates whether the keyboard events are to be reported as usual.
Specifies further processing of pointer events. You can pass GrabModeSync or GrabModeAsync.
Specifies the time. You can pass either a timestamp or CurrentTime.
The XGrabKeyboard function actively grabs control of the keyboard and generates FocusIn and FocusOut events. Further key events are reported only to the grabbing client. XGrabKeyboard 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 and 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.
If the keyboard_mode argument is GrabModeAsync, keyboard event processing continues as usual. If the keyboard is currently frozen by this client, then processing of keyboard events is resumed. If the keyboard_mode argument is GrabModeSync, the state of the keyboard (as seen by client applications) appears to freeze, and the X server generates no further keyboard events until the grabbing client issues a releasing XAllowEvents call or until the keyboard grab is released. Actual keyboard changes are not lost while the keyboard is frozen; they are simply queued in the server for later processing.
If pointer_mode is GrabModeAsync, pointer event processing is unaffected by activation of the grab. If pointer_mode is GrabModeSync, the state of the pointer (as seen by client applications) appears to freeze, and the X server generates no further pointer events until the grabbing client issues a releasing XAllowEvents call or until the keyboard grab is released. Actual pointer changes are not lost while the pointer is frozen; they are simply queued in the server for later processing.
If the keyboard is actively grabbed by some other client, XGrabKeyboard fails and returns AlreadyGrabbed. If grab_window is not viewable, it fails and returns GrabNotViewable. If the keyboard is frozen by an active grab of another client, it fails and returns GrabFrozen. If the specified time is earlier than the last-keyboard-grab time or later than the current X server time, it fails and returns GrabInvalidTime. Otherwise, the last-keyboard-grab time is set to the specified time (CurrentTime is replaced by the current X server time).
XGrabKeyboard can generate BadValue and BadWindow errors.
The XUngrabKeyboard function releases the keyboard and any queued events if this client has it actively grabbed from either XGrabKeyboard or XGrabKey. XUngrabKeyboard does not release the keyboard and any queued events if the specified time is earlier than the last-keyboard-grab time or is later than the current X server time. It also generates FocusIn and FocusOut events. The X server automatically performs an UngrabKeyboard request if the event window for an active keyboard grab becomes not viewable.
Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument’s type is accepted. Any argument defined as a set of alternatives can generate this error.
A value for a Window argument does not name a defined Window.
XGrabButton(3), XGrabKey(3), XGrabPointer(3)
Xlib − C Language X Interface
More Linux Commands
gtf(1) - calculate VESA GTF mode lines - Linux manual page
Gtf is a utility for calculating VESA GTF modes. Given the desired horizontal and vertical resolutions and refresh rate (in Hz), the parameters for a matching V
gnutls_pkcs11_privkey_get_info(3) - API function (Man Page)
This function will return information about the PKCS 11 private key such as the label, id as well as token information where the key is stored. When output is t
telnet(1) - user interface to the TELNET protocol (ManPage)
The telnet command is used to communicate with another host using the TELNET protocol. If telnet is invoked without the host argument, it enters command mode, i
git-update-ref(1) - Update the object name stored in a ref s
Given two arguments, stores the <newvalue> in the <ref>, possibly dereferencing the symbolic refs. E.g. git update-ref HEAD <newvalue> updates the current branc
syncok(3ncurses) - create curses windows - Linux man page...
Calling newwin creates and returns a pointer to a new window with the given number of lines and columns. The upper left-hand corner of the window is at line beg
snmp_select_info(3) - netsnmp_session_api functions.........
Snmp_sess_init prepares a netsnmp_session that sources transport characteristics and common information that will be used for a set of SNMP transactions. After
sane-fujitsu(5) - SANE backend for Fujitsu flatbed and ADF s
The sane-fujitsu library implements a SANE (Scanner Access Now Easy) backend which provides access to most Fujitsu flatbed and ADF scanners. This document descr
editres(1) - a dynamic resource editor for X Toolkit applica
Editres is a tool that allows users and application developers to view the full widget hierarchy of any X Toolkit application that speaks the Editres protocol.
asn1_find_node(3) - API function (Library - Linux man page)
Searches for an element called name starting from pointer . The name is composed by differents identifiers separated by dots. When * pointer has a name, the fir
menubutton(n) - Create and manipulate menubutton widgets....
The menubutton command creates a new window (given by the pathName argument) and makes it into a menubutton widget. Additional options, described above, may be
ispunct(3) - character classification routines (Man Page)...
These functions check whether c, which must have the value of an unsigned char or EOF, falls into a certain character class according to the specified locale. T
Tcl_DictObjGet(3) - manipulate Tcl objects as dictionaries
Tcl dictionary objects have an internal representation that supports efficient mapping from keys to values and which guarantees that the particular ordering of