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.
A Head consists of:
- One local Interface Group
- A pointer to the global Interface Group
- Any number of TermStacks
- 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:
- CmdTSWakeup - the Interface Group devices are
available, and read() and write()
calls should be performed. Also,
the display should be refreshed.
- CmdTSSuspend - stop writing to any Interface Group
devices, and block any read() or
write() calls
- CmdTSBackground - stop writing to any Interface Group
devices, and emulate (if possible)
any read() or write() calls.
- CmdTSDeactivate - Detach from all Interface Group
devices. read()s and write()s may
be emulated, at the TermStack's discretion.
- CmdTSActivate - Re-attach to the Head's Interface Group
devices. Note that the Interface Group
may be different that the
Interface Group detached via CmdTSDeactivate
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.
- MouseKeys - Converts numeric keypad cursor keys to mouse
movement and mouse clicks.
- Keymapper - Adds `keysyms' to the emKeyboard class
of events
- MacroExpand - Expands `macro' keys to strings
- Selection - Processes emMouse events to mark text
into a global buffer, and retreive it.
- XTerm Emulator - Draws emKeypress and emString
events onto the display device, or the
back-buffer if un-focused
- /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:
- /dev/graph - Passes events to the application
via read(), and sends events to
the Interface Group via write().