Go to the first, previous, next, last section, table of contents.


Event Types

This section describes all event types by listing their fields and basic information on when they are generated. All events are defined in the module Xlib.protocol.event. All event types have the following two attributes:

Instance Variable: Event type

Stores the X type code of this event. Type codes are integers in the range 2-127, and are defined with symbolic names in Xlib.X. The symbolic names are the same as the event class names, except for the special event AnyEvent.

Instance Variable: Event send_event

This attribute is normally 0, meaning that the event was generated by the X server. It is set to 1 if this event was instead sent from another client.

Event object can be created by instantiating the corresponding event class, providing all the attributes described for the event as keyword arguments.

Event: KeyPress
Event: KeyRelease
Event: ButtonPress
Event: ButtonRelease
Event: MotionNotify

These events are generated when a key or a button logically changes state, or when the pointer logically moves. In the discussion below, the source window is the window that the event occured in. The event may be generated on some other window than the source window, see XKeyEvent(3X11) for details. The same man page also describes MotionNotify.

Instance Variable: KeyButtonPointerEvent time
The server X time when this event was generated.

Instance Variable: KeyButtonPointerEvent root
The root window which the source window is an inferior of.

Instance Variable: KeyButtonPointerEvent window
The window the event is reported on.

Instance Variable: KeyButtonPointerEvent same_screen
Set to 1 if window is on the same screen as root, 0 otherwise.

Instance Variable: KeyButtonPointerEvent child
If the source window is an inferior of window, child is set to the child of window that is the ancestor of (or is) the source window. Otherwise it is set to X.NONE.

Instance Variable: KeyButtonPointerEvent root_x
Instance Variable: KeyButtonPointerEvent root_y
The pointer coordinates at the time of the event, relative to the root window.

Instance Variable: KeyButtonPointerEvent event_x
Instance Variable: KeyButtonPointerEvent event_y
The pointer coordinates at the time of the event, relative to window. If window is not on the same screen as root, these are set to 0.

Instance Variable: KeyButtonPointerEvent state
The logical state of the button and modifier keys just before the event.

Instance Variable: KeyButtonPointerEvent detail
For KeyPress and KeyRelease, this is the keycode of the event key.

For ButtonPress and ButtonRelease, this is the button of the event.

For MotionNotify, this is either X.NotifyNormal or X.NotifyHint.

Event: EnterNotify
Event: LeaveNotify

If pointer motion or window hierarchy change causes the pointer to be in another window than before, these events are generated instead of a MotionNotify event.

The semantics are quite complex, see XCrossingEvent(3X11) for details.

Instance Variable: EnterLeaveEvent time
The server X time when this event was generated.

Instance Variable: EnterLeaveEvent root
The root window of the pointer at the end of this event.

Instance Variable: EnterLeaveEvent window
The window the event is reported for.

Instance Variable: EnterLeaveEvent child
In a LeaveNotify event, if a child of window contains the initial pointer position, this is set to that child window. In a EnterNotify event, if a child of window contains the final pointer position, this is set to that child window. Otherwise this is set to X.NONE.

Instance Variable: EnterLeaveEvent root_x
Instance Variable: EnterLeaveEvent root_y
The final pointer position relative to root.

Instance Variable: EnterLeaveEvent event_x
Instance Variable: EnterLeaveEvent event_y
The final pointer position relative to window.

Instance Variable: EnterLeaveEvent state
The modifier and button state at the time of the event.

Instance Variable: EnterLeaveEvent mode
One of X.NotifyNormal, X.NotifyGrab or X.NotifyUngrab.

Instance Variable: EnterLeaveEvent detail
One of X.NotifyAncestor, X.NotifyVirtual, X.NotifyInferior, X.NotifyNonlinear, or X.NotifyNonlinearVirtual.

Instance Variable: EnterLeaveEvent flags
If bit 0 is set, window is the focus window or an inferior of it. If bit 1 is set, window is on the same screen as root.

Event: FocusIn
Event: FocusOut

These events are generated when the focus changes. This is also very complex events, see XFocusChangeEvent(3X11) for details.

Instance Variable: FocusEvent window
The window the event is generated for.

Instance Variable: FocusEvent mode
One of X.NotifyNormal, X.NotifyWhileGrabbed, X.NotifyGrab, or X.NotifyUngrab.

Instance Variable: FocusEvent detail
One of X.NotifyAncestor, X.NotifyVirtual, X.NotifyInferior, X.NotifyNonlinear, X.NotifyNonlinearVirtual, X.NotifyPointer, X.NotifyPointerRoot, or X.NONE.

Event: KeymapNotify

This event is generated immediately after every EnterNotify and FocusIn.

Instance Variable: KeymapNotify data
A list of 31 eight-bit integers, as returned by query_keymap.

Event: Expose

This event is generated when regions of a window has to be redrawn. The regions are decomposed into a set of rectangles, and an Expose event is generated for each rectangle.

Instance Variable: Expose window
The window containing regions to redraw.

Instance Variable: Expose x
Instance Variable: Expose y
Instance Variable: Expose width
Instance Variable: Expose height
The coordinates of the rectangle to redraw.

Instance Variable: Expose count
At least this many more Expose events will immediately follow for this window. If this is the last event, count is set to 0.

This allows a simple application to ignore all Expose events with a non-zero count, and then redraw the entire window when the zero event is received.

Event: GraphicsExpose
Event: NoExpose

These events may be generated for drawables when a graphics context with graphics_exposures selected is used. See XGraphicsExposeEvent(3X11) for details.

Both events have these attributes:

Instance Variable: GraphicsExpose drawable
The drawable of the event.

Instance Variable: GraphicsExpose major_event
Instance Variable: GraphicsExpose minor_event
The major and minor number of the request that generated this event. For the core protocol major_event is always 62 (CopyArea) or 63 (CopyPlane), and minor_event is always 0.

GraphicsExpose have these additional attributes:

Instance Variable: GraphicsExpose x
Instance Variable: GraphicsExpose y
Instance Variable: GraphicsExpose width
Instance Variable: GraphicsExpose height
The coordinates of the event region.

Instance Variable: GraphicsExpose count
At least this many more GraphicsExposure events follows. The last one has count set to 0.

Event: VisibilityNotify

These events are generated when the visibility of a viewable window is changed. See XVisibilityNotifyEvent(3X11).

Instance Variable: VisibiltyNotify window
The window of the event.

Instance Variable: VisibiltyNotify state
One of X.VisibilityUnobscured, X.VisibilityPartiallyObscured, or X.VisibilityFullyObscured.

Event: CreateNotify

This event is generated when a window is created. X.SubstructureNotifyMask must be selected on the parent of the new window to receive this event.

Instance Variable: CreateNotify parent
The parent of the new window.

Instance Variable: CreateNotify window
The new window.

Instance Variable: CreateNotify x
Instance Variable: CreateNotify y
Instance Variable: CreateNotify width
Instance Variable: CreateNotify height
Instance Variable: CreateNotify border_width
Instance Variable: CreateNotify override
These values are fetched from the create_window call.

Event: DestroyNotify

This event is generated when a window is destroyed.

Instance Variable: DestroyNotify event
The window that the event is generated for.

Instance Variable: DestroyNotify window
The window that was destroyed.

Event: UnmapNotify

This event is generated when a window is unmapped.

Instance Variable: UnmapNotify event
The window that the event is generated for.

Instance Variable: UnmapNotify window
The window that was unmapped.

Instance Variable: Event from_configure
This is true if window was unmapped because its parent was resized and window had win-gravity X.UnmapGravity.

Event: MapNotify

This event is generated when a window is mapped.

Instance Variable: MapNotify event
The window that the event is generated for.

Instance Variable: MapNotify window
The window that was mapped.

Instance Variable: Event override
This is set from the corresponding window attribute.

Event: MapRequest

This event is reported to the client that has set X.SubstructureRedirectMask on a window, and an unmapped child of that window attempts to be mapped by some other client, unless the child has override-redirect set.

Instance Variable: MapRequest parent
The parent window.

Instance Variable: MapRequest window
The child window that attempts to be mapped.

Event: ReparentNotify

This event is reported to clients selecting X.SubstructureNotifyMask on either the old or the new parent and to clients selecting X.StructureNotifyMask on the reparented window.

Instance Variable: ReparentNotify event
The window the event is generated for.

Instance Variable: ReparentNotify window
The reparented window.

Instance Variable: ReparentNotify parent
The new parent window.

Instance Variable: ReparentNotify x
Instance Variable: ReparentNotify y
The coordinates of the upper-left outer corner of window in parent.

Instance Variable: ReparentNotify override
This is set from the corresponding attribute on window.

Event: ConfigureNotify

This event is generated when a configure request actually changes the state of the window.

Instance Variable: ConfigureNotify event
The window that the event is generated for.

Instance Variable: ConfigureNotify window
The window that has been changed.

Instance Variable: ConfigureNotify x
Instance Variable: ConfigureNotify y
Instance Variable: ConfigureNotify width
Instance Variable: ConfigureNotify height
Instance Variable: ConfigureNotify border_width
The new coordinate and geometry of window.

Instance Variable: ConfigureNotify above_sibling
This is X.NONE if this window is at the bottom of the window stack. Otherwise it is the sibling window that window is immediately above.

Instance Variable: ConfigureNotify override
This is set from the corresponding attribute on window.

Event: ConfigureRequest

This event is reported to the client that has set X.SubstructureRedirectMask on the parent of a window that another client attempts to configure, unless the window has override-redirect set.

Instance Variable: ConfigureRequest parent
The parent of the window being configured.

Instance Variable: ConfigureRequest window
The window being configured.

Instance Variable: ConfigureRequest value_mask
A bitmask indicating which values that the caller tries to change.

Instance Variable: ConfigureRequest x
Instance Variable: ConfigureRequest y
Instance Variable: ConfigureRequest width
Instance Variable: ConfigureRequest height
Instance Variable: ConfigureRequest border_width
The window geometry in the configure call. If X.CWX, X.CWY, X.CWWidth, X.CWHeight, or X.CWBorderWidth is set in value_mask, the corresponding attributes contains the new value as given in the configure call, otherwise the current value is used.

Instance Variable: ConfigureRequest stack_mode
If X.CWStackMode is set in value_mask, this is the stack mode specified in the configure call, one of X.Above, X.Below, X.TopIf, X.BottomIf, or X.Opposite. If the flag is not set, this is set to X.Above.

Instance Variable: ConfigureRequest sibling
If X.CWSibling is set in value_mask, this is the sibling window specified in the configure call. If the flag is not set, this is set to X.NONE.

Event: GravityNotify

This event is generated when a window is moved because its parent's size has changed.

Instance Variable: GravityNotify event
The window the event is generated for.

Instance Variable: GravityNotify window
The window that moved.

Instance Variable: GravityNotify x
Instance Variable: GravityNotify y
The new coordinates of the upper-left outer corner of window.

Event: ResizeRequest

This is reported to the client selecting X.ResizeRedirectMask on a window, and another client attempts to resize it.

Instance Variable: ResizeRedirect window
The window that was attempted to be resized.

Instance Variable: ResizeRedirect width
Instance Variable: ResizeRedirect height
The requested size of the window, excluding the border.

Event: CirculateNotify

This event is generated when a window is restacked caused by a circulate call.

Instance Variable: Event event
The window the event is reported on.

Instance Variable: Event window
The window that has been restacked.

Instance Variable: Event place
Either X.PlaceOnTop or X.PlaceOnBottom.

Event: CirculateRequest

This event is reported to the client that has set X.SubstructureRedirectMask on the parent of a window that needs to be restacked as a result of a circulate call on the parent.

Instance Variable: CirculateRequest parent
The parent window.

Instance Variable: CirculateRequest window
The window that should be restacked.

Instance Variable: CirculateRequest place
Where window should be placed, either X.PlaceOnTop or X.PlaceOnBottom.

Event: PropertyNotify

This event is generated when a property on a window is changed.

Instance Variable: Event window
The window which the property is or was set on.

Instance Variable: Event atom
The atom identifying the property.

Instance Variable: Event time
The server X time when the property was changed.

Instance Variable: Event state
What was changed, either X.PropertyNewValue or X.PropertyDelete.

Event: SelectionClear

This event is reported to the owner of a selection when it has gotten a new owner.

Instance Variable: SelectionClear window
The owner window of the selection.

Instance Variable: SelectionClear atom
The selection atom.

Instance Variable: SelectionClear time
The server X time when the selection was last changed.

Event: SelectionRequest

This event is reported to the owner of a selection when a client requests it by calling convert_selection.

Instance Variable: SelectionRequest owner
The owner window of the selection.

Instance Variable: SelectionRequest requestor
Instance Variable: SelectionRequest selection
Instance Variable: SelectionRequest target
Instance Variable: SelectionRequest property
Instance Variable: SelectionRequest time
These attributes are fetched from the convert_selection call.

Event: SelectionNotify

This event is generated by the server if there are no owner of a selection when convert_selection is called. If there is an owner, it should send this event to the requestor when the selection has been converted.

Instance Variable: SelectionNotify requestor
Instance Variable: SelectionNotify selection
Instance Variable: SelectionNotify target
Instance Variable: SelectionNotify property
Instance Variable: SelectionNotify time
See XSelectionEvent(3X11).

Event: ColormapNotify

This event is generated when the colormap attribute of a window is set, or when a window's colormap is installed or uninstalled.

Instance Variable: ColormapNotify window
The affected window.

Instance Variable: ColormapNotify colormap
The colormap of the window, or X.NONE.

Instance Variable: ColormapNotify new
Set to 1 if the colormap attribute has been set, 0 when the colormap is installed or uninstalled.

Instance Variable: ColormapNotify state
Indicates whether the colormap is installed or not, either X.ColormapInstalled or X.ColormapUninstalled.

Event: MappingNotify

This event is sent to all clients, without any event mask having to be set. It is sent when the keyboard or pointer mapping is changed.

Instance Variable: MappingNotify request
The mapping that has changed, one of X.MappingModifier, X.MappingKeyboard or X.Pointer.

Instance Variable: MappingNotify first_keycode
Instance Variable: MappingNotify count
If the keyboard mapping has changed, this is the range of modified keycodes.

Event: ClientMessage

This event is only generated by clients using send_event.

Instance Variable: ClientMessage window
The destination window of the event.

Instance Variable: ClientMessage client_type
The type of message, an atom.

Instance Variable: ClientMessage data
The message data as a tuple: (format, mdata)

Format must be one of 8, 16, or 32. mdata must either be a string of exactly 20 characters, or a list of exactly 20, 10 or 5 integers depending of the format.

Event: AnyEvent

This event is represents an event the Xlib does not recognise. These should never be returned by Display.next_event(), but they might be useful for sending special events to other clients.

Instance Variable: AnyEvent detail
An eight-bit integer.

Instance Variable: AnyEvent data
A string of exactly 28 characters.


Go to the first, previous, next, last section, table of contents.