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:
“As I look at the human story I see two stories. They run parallel and never meet. One is of people who live, as they can or must, the events that arrive; the other is of people who live, as they intend, the events they create.”
—Margaret Anderson (18861973)
“The prime lesson the social sciences can learn from the natural sciences is just this: that it is necessary to press on to find the positive conditions under which desired events take place, and that these can be just as scientifically investigated as can instances of negative correlation. This problem is beyond relativity.”
—Ruth Benedict (18871948)
“By many a legendary tale of violence and wrong, as well as by events which have passed before their eyes, these people have been taught to look upon white men with abhorrence.... I can sympathize with the spirit which prompts the Typee warrior to guard all the passes to his valley with the point of his levelled spear, and, standing upon the beach, with his back turned upon his green home, to hold at bay the intruding European.”
—Herman Melville (18191891)