Grabbing the Keyboard

Usually, keyboard events will be delivered as soon as they occur to the appropriate window and client, which is determined by the window event masks and input focus. With these routines it is possible to grab the keyboard keys; in this case, events will be sent to the grabbing client, rather than the normal client who would have received the event. If the keyboard or pointer is in asynchronous mode, further mouse and keyboard events will continue to be processed. If the keyboard or pointer is in synchronous mode, no further events will be processed until the grabbing client allows them.

There are two kinds of grabs: active and passive. An active grab occurs when a single client grabs the keyboard explicitly. Clients can also grab a particular keyboard key in a window, this is called a passive grab and it activates when the key is actually pressed.

Many of the operations take a Time argument, which can be current_time (the X server current time) or an actual timestamp in milliseconds.