X Window System Core Protocol - Events

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:

    Reporters are not paid to operate in retrospect. Because when news begins to solidify into current events and finally harden into history, it is the stories we didn’t write, the questions we didn’t ask that prove far, far more damaging than the ones we did.
    Anna Quindlen (b. 1952)

    A curious thing about atrocity stories is that they mirror, instead of the events they purport to describe, the extent of the hatred of the people that tell them.
    Still, you can’t listen unmoved to tales of misery and murder.
    John Dos Passos (1896–1970)

    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 (1803–1882)