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>
This adds a new data-type: kmscon_array
It is used as a dynamicly growing array that can be freely accessed. We
currently use the glib type in unicode.c but can finally replace it with
our own implementation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If the background color is identical to the background-color of the glyph
to be drawn, then we can skip drawing the background. This increases
performance a _lot_.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
reset_state() is used to reset the saved state and not to reset the actual
state. We currently get invalid character-maps as we never initialize them
correctly. This fixes all these vte_map() related bugs.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
RIS is used to "hard"-reset the terminal. We simply clear every state
known and reset to initial state.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The DECID escape should be followed by a primary-DA answer. To avoid
copying the same primary-DA sources, we put the primary-DA into a static
helper function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
DSRs are used to query the terminal for data. This includes general status
reports but also cursor positions. We currently only implement VT220
features. DEC later introduced further modes to query more advanced
interfaces.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
CHT and CBT are used to move multiple tab-stops with a single call. The \t
char moves only one tab-stop forward. All are conformant to the vt510
specs.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Implement left and right tab movement in console backend. This is used by
the VTE layer to interpret different VT escape sequences and the tabulator
character.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Protected erase means erasing parts of the screen but preventing protected
characters from being erase. Protecting a character is done by setting
character attributes similarly to colors and backgrounds. Both are reset
on hard erase, soft-reset or screen clearance.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is probably a copy/paste bug but we sent the wrong application cursor
key sequences. This is only visible in xterm-mode so nobody noticed until
now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We definitely do not need to check the unset parameters so shorten the
loop so unparsed parameters are not checked.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
ICH is used to insert characters into the current line. DCH is used to
delete characters from the current line. They act as described in vt220
manual.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
VT220 allows protecting attributes. That is, they are not erased by
special new erase-commands. The normal erase-commands still erase all
characters.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Implement TBC CSI which clears the current or all tab-stops. This is
according to VT220 rules.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add three helpers to set and reset tab-stops. They will be used by the VTE
layer to add and remove tab-stops when requested by the application.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Whoops, current tab ruler turned out to be vertical. That's definitely not
what we want. Therefore, turn it around to be horizontal so we can
correctly move forward/backward in the console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
On soft-reset we reset the console to the initial state but keep current
line-state. That is, scrollback and cursor position are kept but the
non-visible state is reset.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
As we might need dbus for inter-process-communication later, this adds a
very rudimentary dbus client integration for epoll-based loops.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The tab-ruler is used to set console tab-stops. We use an array with one
cell per column that is set to true if it is a tab-stop and false if it is
not.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instruct console code to reset the console margins to default values (that
is, destroy the margins) on console soft-reset.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>