Events
Events are packets sent by the server to a client to communicate that something the client may be interested in has happened. For example, an event is sent when the user presses a key or clicks a mouse button. Events are not only used for input: for example, events are sent to indicate the creation of new subwindows of a given window.
Every event is relative to a window. For example, if the user clicks when the pointer is in a window, the event will be relative to that window. The event packet contains the identifier of that window.
A client can request the server to send an event to another client; this is used for communication between clients. Such an event is for example generated when a client requests the text that is currently selected: this event is sent to the client that is currently handling the window that holds the selection.
The Expose
event is sent when an area of a window of destroyed content is made visible. The content of a window may be destroyed in some conditions, for example, if the window is covered and the server is not maintaining a backing store. The server generates an Expose
event to notify the client that a part of the window has to be drawn.
Most kinds of events are sent only if the client previously stated an interest in them. This is because clients may only be interested in some kind of events. For example, a client may be interested in keyboard-related events but not in mouse-related events. Some kinds of events are however sent to clients even if they have not specifically requested them.
Clients specify which kinds of events they want to be sent by setting an attribute of a window. For example, in order to redraw a window when its content has been destroyed, a client must receive the Expose
events, which inform it that the window needs to be drawn again. The client will however be sent Expose
events only if the client has previously stated its interest in these events, which is done by appropriately setting the event mask attribute of the window.
Different clients can request events on the same window. They can even set different event masks on the same window. For example, a client may request only keyboard events on a window while another client requests only mouse events on the same window. This is possible because the server, for each window, maintains a separate event mask for each client. However, there are some kinds of events that can only be selected by one client at time for each window. In particular, these events report mouse button clicks and some changes related to window management.
The xev
program shows the events relative to a window. In particular, xev -id WID
requests all possible events relative to the window of identifier WID
and prints them.
Read more about this topic: X Window System Core Protocol
Famous quotes containing the word events:
“The great events of life often leave one unmoved; they pass out of consciousness, and, when one thinks of them, become unreal. Even the scarlet flowers of passion seem to grow in the same meadow as the poppies of oblivion.”
—Oscar Wilde (18541900)
“If I have renounced the search of truth, if I have come into the port of some pretending dogmatism, some new church, some Schelling or Cousin, I have died to all use of these new events that are born out of prolific time into multitude of life every hour. I am as bankrupt to whom brilliant opportunities offer in vain. He has just foreclosed his freedom, tied his hands, locked himself up and given the key to another to keep.”
—Ralph Waldo Emerson (18031882)
“The return of the asymmetrical Saturday was one of those small events that were interior, local, almost civic and which, in tranquil lives and closed societies, create a sort of national bond and become the favorite theme of conversation, of jokes and of stories exaggerated with pleasure: it would have been a ready- made seed for a legendary cycle, had any of us leanings toward the epic.”
—Marcel Proust (18711922)