The Personal Website of Jeremy Boles

SDL2

A thin layer over video, input, and fonts, including on machines with no desktop.

Owl draws with SDL2 and its TTF extension. Not because it’s the nicest way to build a Linux application, but because of where the application has to run: the appliance points SDL_VIDEODRIVER at KMSDRM and draws straight to the kernel’s mode-setting, with no X server and no desktop environment underneath it. GTK assumes a desktop. SDL2 will talk to bare hardware.

There’s a happy accident in the packaging. Installing libsdl2-dev pulls in libdrm-dev, libgbm-dev, and libegl-dev, which are precisely what the KMSDRM backend needs at runtime, so putting the compiler on the netbook quietly puts the video path there too.

Sharp Edges

SDL emits a TextInput event for some Ctrl combinations on top of the KeyDown, Ctrl+digit in particular, which would insert the digit as a character. Owl swallows TextInput while Ctrl is held, since those keystrokes are commands rather than typing.

Holding Alt suppresses TextInput altogether, which is awkward when Alt is the key you hold to search. So Owl reads the pattern characters off raw keycodes during a leap instead.

Fonts and the caret decorations are compiled into the binary with include_bytes!, so there’s no runtime file dependency beyond the document you opened. The decorations are white bitmaps tinted at draw time through per-texture color modulation, which recolors a theme with one state change rather than a fresh upload.