dthain / basekernel

A simple OS kernel for research, teaching, and fun.
GNU General Public License v2.0
805 stars 109 forks source link

Add Event Model #273

Closed dthain closed 3 years ago

dthain commented 3 years ago

Currently, all streams between applications are (presumed) to be streams of untyped ASCII data, built up from keyboard or file streams. In order to support interactive graphical applications, we need an event stream coming from the mouse and the keyboard that can be easily interpreted and forwarded via the window manager.

Build up a common event module that buffers incoming events from the keyboard and mouse, and presents them as a single kernel object of type event. Should yield fixed size objects looking something like this:

struct event {
    int x, y;
    event_type_t type;
    int code;
};

Where type is something like KEYUP, KEYDOWN, BUTTONUP, CLOSE, RESIZE, and so forth. Some of these events are generated directly via the kernel, while others can be injected via the window manager to modify running applications.

dthain commented 3 years ago

Mouse and keyboard devices now route all events to a common event model and a KOBJECT_EVENT. However, this event kobject only returns cooked keyboard events. Need some more machinery to make events available to processes.

dthain commented 3 years ago

All events now route through kernel window abstraction.