An event is an object that encapsulates information about an interesting occurrence in the operating system. Events are generated either by user action, direct (e.g. typing on the keyboard or moving the mouse) or indirect (moving another window, thereby generating an expose event on an Emacs frame), or as a result of some other typically asynchronous action happening, such as output from a subprocess being ready or a timer expiring. Events come into the system in an asynchronous fashion (typically through a callback being called) and are converted into a synchronous event queue (first-in, first-out) in a process that we will call collection.
Note that each application has its own event queue. (It is immaterial whether the collection process directly puts the events in the proper application’s queue, or puts them into a single system queue, which is later split up.)
The most basic level of event collection is done by the operating system or window system. Typically, SXEmacs does its own event collection as well. Often there are multiple layers of collection in SXEmacs, with events from various sources being collected into a queue, which is then combined with other sources to go into another queue (i.e. a second level of collection), with perhaps another level on top of this, etc.
SXEmacs has its own types of events (called Emacs events), which provides an abstract layer on top of the system-dependent nature of the most basic events that are received. Part of the complex nature of the SXEmacs event collection process involves converting from the operating-system events into the proper Emacs events—there may not be a one-to-one correspondence.
Emacs events are documented in events.h; I’ll discuss them later.