Another method is to rewrite the XtMainLoop function and handle the desired events there and ignore the rest, but this is difficult and requires a good knowledge of events and event handling. A solution that allows events that the programmer wants to keep to be processed and prevents the others is to create an event mask. An event mask allows only the events specified to be placed in the event queue. A program uses an event mask through the Xlib function XSelectInput. This mask must be applied to all of the widgets in the application including composite widgets.
Composite widgets are widgets which have widgets as children.
These widget hierarchies are in tree form with children containing children. Using recursion is an elegant and simple way to reach every widget in an application. An event mask is used to specify which values in the XEvent union should be read when updating the resource values. Every member of the XEvent union has a bit assigned to it. For example, to allow exposure events to be updated in the XEvent union ExposureMask is used.