<HTML> <HEAD> <!-- Created by texi2html 1.56k from ../src/python-xlib.texi on 22 October 2013 --> <TITLE>The Python X Library - Selecting Events</TITLE> </HEAD> <BODY> Go to the <A HREF="python-xlib_1.html">first</A>, <A HREF="python-xlib_11.html">previous</A>, <A HREF="python-xlib_13.html">next</A>, <A HREF="python-xlib_25.html">last</A> section, <A HREF="python-xlib_toc.html">table of contents</A>. <P><HR><P> <H2><A NAME="SEC11" HREF="python-xlib_toc.html#TOC11">Selecting Events</A></H2> <P> To avoid flooding the clients with events in which they have no interest, they must explicitly tell the server which events they are interested in. This is done by providing the <CODE>event_mask</CODE> attribute when creating windows with <CODE>Window.create_window</CODE> or in calls to <CODE>Window.change_attributes</CODE>. The value of this attribute is a mask of all types of events the client is interested in on that particular window. Whenever the server generates an event for a window which matches the clients event mask on that window, the event will be sent to the client. <P> The following table lists all event masks and the corresponding event types and classes. All event masks and types are integer constants defined in the module <CODE>Xlib.X</CODE>. Classes have the same name as the event type, and are defined in <CODE>Xlib.protocol.event</CODE>. <TABLE BORDER> <TR><TD><STRONG>Mask</STRONG> </TD><TD> <STRONG>Type and Class</STRONG> </TD><TD> <STRONG>Generated when</STRONG></TD> </TR> <TR><TD>ButtonMotionMask <BR> Button1MotionMask <BR> Button2MotionMask <BR> Button3MotionMask <BR> Button4MotionMask <BR> Button5MotionMask</TD> </TD><TD> MotionNotify </TD><TD> Pointer moved with any or a certain button down </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>ButtonPressMask </TD><TD> ButtonPress</TD> </TD><TD> Pointer button pressed </TR> <TR><TD>ButtonReleaseMask </TD><TD> ButtonRelease</TD> </TD><TD> Pointer button released </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>ColormapChangeMask </TD><TD> ColormapNotify</TD> </TD><TD> Colormap changed or installed </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>EnterWindowMask </TD><TD> EnterNotify</TD> </TD><TD> Pointer enters window </TR> <TR><TD>LeaveWindowMask </TD><TD> LeaveNotify</TD> </TD><TD> Pointer leaves window </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>ExposureMask </TD><TD> Expose <BR> NoExpose</TD> </TD><TD> Window needs to be redrawn </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>FocusChangeMask </TD><TD> FocusIn <BR> FocusOut</TD> </TD><TD> Focus changes </TR> <TR><TD>KeymapStateMask </TD><TD> KeymapNotify</TD> </TD><TD> After EnterNotify and FocusIn </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>KeyPressMask </TD><TD> KeyPress</TD> </TD><TD> Key is pressed </TR> <TR><TD>KeyReleaseMask </TD><TD> ReleasePress</TD> </TD><TD> Key is released </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>PointerMotionMask </TD><TD> MotionNotify</TD> </TD><TD> Pointer is moved </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>PropertyChangeMask </TD><TD> PropertyNotify</TD> </TD><TD> Window properties change </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>StructureNotifyMask</TD> </TD><TD> CirculateNotify <BR> ConfigureNotify <BR> DestroyNotify <BR> GravityNotify <BR> MapNotify <BR> ReparentNotify <BR> UnmapNotify </TD><TD> Window structure changes </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>SubstructureNotifyMask</TD> </TD><TD> CirculateNotify <BR> ConfigureNotify <BR> CreateNotify <BR> DestroyNotify <BR> GravityNotify <BR> MapNotify <BR> ReparentNotify <BR> UnmapNotify </TD><TD> Child window structure changes </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>ResizeRedirectMask </TD><TD> ResizeRequest</TD> </TD><TD> Controlling window size change </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>SubstructureRedirectMask</TD> </TD><TD> CirculateRequest <BR> ConfigureRequest <BR> MapRequest </TD><TD> Controlling changes to child windows </TR> <TR><TD></TD><TD> </TD><TD></TD> </TR> <TR><TD>VisibilityChangeMask </TD><TD> VisibilityNotify</TD> </TD><TD> Window is obscured or visible </TR></TABLE> <P> There are also some event types which are always sent to the clients, regardless of any event masks: <TABLE BORDER> <TR><TD><STRONG>Type and Class</STRONG> </TD><TD> <STRONG>Cut'n'pasting between windows</STRONG></TD> </TR> <TR><TD>ClientMessage </TD><TD> Other client sends message</TD> </TR> <TR><TD></TD><TD></TD> </TR> <TR><TD>MappingMotify </TD><TD> Keyboard mapping changes</TD> </TR> <TR><TD></TD><TD></TD> </TR> <TR><TD>SelectionClear <BR></TD> SelectionNotify <BR> SelectionRequest </TD><TD> Cut'n'pasting between windows </TR></TABLE> <P> <P><HR><P> Go to the <A HREF="python-xlib_1.html">first</A>, <A HREF="python-xlib_11.html">previous</A>, <A HREF="python-xlib_13.html">next</A>, <A HREF="python-xlib_25.html">last</A> section, <A HREF="python-xlib_toc.html">table of contents</A>. </BODY> </HTML>