Event Stack

The event-stack system is designed to create a simple and flexible way to manage console devices and virtual consoles, and be easy to implement.

Interface Groups
An Interface Group is a collection of physical or virtual devices (event handlers) that generate and respond to events for specific devices.
Head
A Head is a Interface Group to TermStack manager, passing events to the appropriate units, and manages `focus' - the mapping of a Interface Group to a TermStack.
TermStack
A TermStack is a stack of event-parsers. Events are `pushed' through the TermStack, one handler after another, each able to modify the event buffer.

Interface Group

An Interface Group is simply a collection of event-handlers, similar to the original Event Ring specification.

Most Interface Groups are local to their respective Heads.

A global Interface Group exists which contains KGI virtual devices. Some of the proposed devices for the global Interface Group include:

Null
Device which receives any failed send_event() calls. (For logging purposes)
Dev Broadcast
Sends any events received to all devices.
Head Broadcast
Sends any events received to all Heads.
TermStack Broadcast
Sends any events received to all TermStacks of all Heads, including TermStacks not currently in focus.

Head

A Head is similar the the `Fokus' concept of the Event Ring specification. Here, a Head contains a local Interface Group and any number of TermStacks. Also, it manages the Interface Group to TermStack mapping (aka VC Switching).

An event send to the Head (excluding Head-control events) are sent to all of the Heads' TermStacks.

TermStacks may be moved between Heads by sending a `CmdTSDeactivate' event to the target TermStack, moving the TermStack pointer to the target Head, and having the target Head send a `CmdTSActivate' event to the TermStack.


TermStack

A TermStack provides the interface between user devices and and the user. This interface consists of a stack of event parsers which take a event buffer, perform actions on the events and returns an event buffer. This allows the creation of an `ordered stack' of event parsers to perform keymapping, terminal emulation, macro-keys, etc.

TermStacks must handle certain command events:

A TermStack can be created and tested in user-space by read()ing and write()ing events to a /dev/graph device. Of course, TermStack Head migration can only be tested in the kernel. A TermStack emulation library should be developed for user-space work.

A simple TermStack that emulates current VC behavior is listed below.

  1. MouseKeys - Converts numeric keypad cursor keys to mouse movement and mouse clicks.
  2. Keymapper - Adds `keysyms' to the emKeyboard class of events
  3. MacroExpand - Expands `macro' keys to strings
  4. Selection - Processes emMouse events to mark text into a global buffer, and retreive it.
  5. XTerm Emulator - Draws emKeypress and emString events onto the display device, or the back-buffer if un-focused
  6. /dev/tty - Converts emKeypress and emString events into the read() buffer, and accepts characters from the write() buffer and sends them to the top of the stack.

Or, for the /dev/graph devices, it's simply a one-piece stack:

  1. /dev/graph - Passes events to the application via read(), and sends events to the Interface Group via write().