main
to handle all events from the X
workstation.
After the application is initialized, main
just sits in a
loop where it reads an event from the workstation and passes the
event to DispatchEvent.
DispatchEvent searches the list of all windows that
are used by the application to find the window
object
which should receive the event.
The appropriate event-handling function of the target window is then
called to handle the event.
The table below lists events defined in X windows, the mask needed to
solicit the event and the handler function which is called when the
event occurs.
Event Name | Event nr | Mask | Handler |
---|---|---|---|
KeyPress | 2 | KeyPressMask | EV_KeyPress |
KeyRelease | 3 | KeyReleaseMask | EV_KeyRelease |
ButtonPress | 4 | ButtonPressMask | EV_ButtonPress |
ButtonRelease | 5 | ButtonReleaseMask | EV_ButtonRelease |
MotionNotify | 6 | PointerMotionMask ButtonMotionMask Button[1-5]MotionMask | |
EnterNotify | 7 | EnterWindowMask | EV_EnterNotify |
LeaveNotify | 8 | LeaveWindowMask | EV_LeaveNotify |
FocusIn | 9 | FocusChangeMask | |
FocusOut | 10 | FocusChangeMask | |
KeymapNotify | 11 | KeymapStateMask | |
Expose | 12 | ExposureMask | EV_Expose |
GraphicsExpose | 13 | ||
NoExpose | 14 | ||
VisibilityNotify | 15 | VisibilityChangeMask | |
CreateNotify | 16 | ||
DestroyNotify | 17 | StructureNotifyMask | |
UnmapNotify | 18 | StructureNotifyMask | |
MapNotify | 19 | StructureNotifyMask | |
MapRequest | 20 | ||
ReparentNotify | 21 | StructureNotifyMask | |
ConfigureNotify | 22 | StructureNotifyMask | EV_ConfigureNotify |
ConfigureRequest | 23 | ||
GravityNotify | 24 | StructureNotifyMask | |
ResizeRequest | 25 | ||
CirculateNotify | 26 | StructureNotifyMask | |
CirculateRequest | 27 | ||
PropertyNotify | 28 | PropertyChangeMask | |
SelectionClear | 29 | ||
SelectionRequest | 30 | ||
SelectionNotify | 31 | ||
ColormapNotify | 32 | ColormapChangeMask | |
ClientMessage | 33 | ||
MappingNotify | 34 |