Client has an
connected to their root window or client window, respectivly.
WindowManager has an
which is connected to all the root windows (through the dispatchers of
An event is passed to the event handling functions which have been registered for that particular event type. There are three levels of event handlers in a dispatcher:
First of all the handlers in the global dispatcher are called. Then, if
the event can be associated with a managed screen through its
screen attributes the handlers
in the dispatcher for that screen are called. Finally, if the event is
for a managed window the handlers in the dispatcher for that client are
Grab handlers do not interfere with the dispatcher sequence directly, but a grab handler do block grab handlers and normal handlers in later dispatchers. System handler are always called, though.
An example: Assume that an event for a managed client has been fetched and is about to be passed through the dispatchers. The matching event handlers are the following: in the global dispatcher one system handler and two normal handlers, in the screen dispatcher a grab handler and one normal handler, and in the client dispatcher one system handler, one grab handler and one normal handler. The handlers will be called in this order: global system, global normals, screen grab, client system. The screen normal, client grab and normal handlers will be ignored because of the grab handler in the screen.
Handlers are registered with one of these methods:
Add a handler for type events. handler is a function which will get one argument, the event object.
If masks is omitted or None the default X event masks for the
event type will be set for the
Otherwise it should be an event mask or a list or tuple of event masks
handler_id identifies this handler, and defaults to the handler itself if not provided.
Remove the handler or handlers identified by handler_id. This will also clear the masks the handlers had installed.
Event masks can also be handled manually when necessary. All event masks keep a reference count, so calls to the following functions nest neatly.
Set masks on the window, without installing any handlers. masks should be an event mask or a list or tuple of event masks to set.
Clear masks on the window. masks should be an event mask or a list or tuple of event masks to set.
Block masks on the window. This will prevent any matching X events to be generated on the window until a matching unblock_masks. masks should be an event mask or a list or tuple of event masks to set.
Unblock masks on the window, allowing the matching X events to be generated. masks should be an event mask or a list or tuple of event masks to set.
Go to the first, previous, next, last section, table of contents.