The console layer guarantees that all glyphs are sent to the renderer so
there is no need to clear the screen before redrawing.
This reduces flickering of single-buffered video backends.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The freetype2 renderer uses ft2 and fontconfig to provide a very
simplistic renderer. We also simplify the logic of the whole subsystem a
lot and guarantee that each glyph will have the same size now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When compiling without xkbcommon we currently get compiler errors as the
uxkb_available variable hasn't been correctly renamed previously.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This fixes the console and terminal layer to use the new text renderer
instead of the old one.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Whoops, we were checking the wrong variable. Fix the OOM check to
correctly catch the right errors.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The bblit text-renderer is the most basic renderer which simply blits or
blends the glyphs into the framebuffer memory. It cannot be used with
displays that do not provide framebuffer access but only 3D access.
However, 3D rendering is currently broken, anyway, so we can ignore it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The text-renderer subsystem provides a way to register arbitrary
text-rendering backends. These backends use the font-objects to draw the
console into a framebuffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to actually increase the character count, otherwise, we will never
have a measurement set.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
VPA and VPR are used to change the current line but keep the column. One
does an absolute positioning and one a relative positioning.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
SU and SD are used to scroll-up and scroll-down the visible buffer.
Margins are kept and the cursor position does not change. This is a valid
vt510 CSI.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Xterm supports CSIs which simply move the visible buffer up/down so we
need these helpers to perform such operations from the VTE layer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When drawing single glyphs we often have the glyph as alpha-only buffer so
we can draw it with any color we want. blit() requires a full image that
can be copied, so the new blend() helper is introduced which takes a
foreground and background color and blends in an image. Only plain-alpha
buffers are currently supported.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Whoops, we missed the last line for all blit()/fill() operations. Fix the
decrement to correctly count as many lines as given.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The dummy fbdev backend included this function to allow outside access to
the framebuffer. This has for long been replaced with blit() and fill()
helpers and it was never actually implemented. Hence, remove the helper
function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When opengl rendering is not available on the target device, we now fall
back to software rendering. Instead of drawing a nice gradient we now draw
a white screen to the target device to avoid heavy calculations.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When using unaccelerated video we want to be able to fill a region of the
target framebuffer with a solid color. Hence, this adds the fill() helper
function with similar semantics to blit() but it uses a solid RGB color
value to fill in the framebuffers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of passing width/height separately, we now use the values from the
buffer object. The caller has to manipulate the buffer object to change
these values. In fact, they can simply create a buffer object on the stack
with the same values copied from the real buffer and just adjust the
offset, width, height and stride. With the help of the stride value, it is
possible to even shrink the buffer horizontally.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Since we moved to a runtime backend system for the input subsystem, we
cannot access the internal keysym_to_string() helpers anymore. Hence, use
the recently introduced uterm-input forwarding helper.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
There is no much gain from having an internal kbd_desc_keysym_to_string()
function if we cannot get access to the kbd_desc object. Therefore, add a
forward helper to uterm_input() which forwards the call to its internal
kbd_desc object. This allows outside access to the keysym_to_string()
function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The pango font backend is similar to the currently used older backend but
provides the new API. It is modular so we can disable it if not needed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When rendering underlines we need the baseline attribute. Therefore,
replace the unused x/y offsets with a baseline attribute.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
There is no need to include config.h manually so remove this to avoid
compilation errors when compiling external applications.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The 8x16 font is a static in-memory font that can be used as safe
fallback. It does not allow scaling or other font decorations so it's
really just for very basic text-layouts.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
A single glyph might be bigger/smaller than the other glyphs so allow them
to be positioned. As we are not interested in details like baselines, we
simply use an x/y offset.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When running as emergency console, we must correctly deal with missing
libraries. Therefore, our font renderers must be modular so if freetype2
is not found we must be able to load another font. Therefore, this
introduces a new font-subsystem which can add/remove font-renderers
on-the-fly.
The real font-renderer backends will follow. This only provides the
modular infrastructure.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using bpp as parameter for buffers we now use format
identifiers so we can add different formats with the same bpp. Please note
that currently only xrgb32 is supported.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently leak the fake display that is created for every fbdev video
device. Fix this by simply freeing this device during destruction.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The vt allocation returns a referenced object so deallocation should
correctly drop it again. We already depend on this behavior so fix it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We use a temporary array of "to-be-dispatched" event sources while
dispatching. However, we incorrectly set the "count" variable so sources
may access invalid memory when removing themself from the event loop.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must not assume that the string is longer than 0 characters. Therefore,
check whether we would access invalid memory before the string when
removing trailing whitespaces.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is a rewrite of the input system. The backends itself are not
modified. However, it is now possible to have multiple backends and change
them on runtime.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now schedule the terminal redraw from the UI to avoid having the
terminal using uterm-video directly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Move display-removal from terinal subsystem to UI subsystem to avoid
needing video-callback in the terminal subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This new function allows external subsystems to remove displays from the
terminal objects. It is required to make the terminal subsystem
independent of the uterm-video subsystem to allow different displays from
different video-objects to be part of a terminal.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If multiple video objects are added to a UI object, we need to manage them
in a list to allow each of them to be added to a running terminal.
This only changes the internal structure but does still create the video
object when creating the UI object. This is, because the terminal
subsystem depends on uterm-video and this needs to be resolved, first.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When adding displays, we know print errors if we cannot allocate buffers
or other resources. This helps debugging video problems where the device
is ready but the terminal is not printed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This again refactors the whole config subsystem but this should be the
last time. We now have generic parsers for booleans and strings and don't
leak any memory, anymore. Furthermore, this adds a config-file parser so
common options can now be placed into /etc/kmscon.conf or ~/.kmscon.conf.
The config files parse the same arguments as the command-line and the
command-line always has precedence even though it is parsed first.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We want to be able to parse our argument-list from other sources, too, so
put them into a separate array so we are not dependent of getopt() and
others.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We no longer require glib, yeah! Drop the mandatory glib dependency from
all build-files. Notice that there is not a single dependency, anymore,
except for libc.
We still have a not-mentioned pango dependency but this can be replaced
with freetype or a static font renderer so we currently do not care.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is the last glib dependency so add a short conversion helper and we
can finally drop glib. Anyway, the pango libs still depend on glib so
there is currently still a glib dependency, but it is no longer direct and
we can always choose the freetype font renderer to drop it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Replace the glib dependency with the new in-house dynamic-array
implementation. Now there is only one utf8 glib dependency left that we
need to convert so we can drop glib-dependency.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>