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>
DECSC is used to save the current console state. DECRC can restore the
console to a previously saved state.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds two functions to retrieve x/y positions of the cursor. This can
be used to save and restore cursor positions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now automatically reopen the pty when the child process died. This will
most-often simply restart the shell or login program.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
There is no explicit call to reopen the underlying pty so we simply
force-close it before (re)-opening it. This will allow the UI to reopen a
pty when the child died.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is the second release of kmscon. It's again a development release but
should now be good enough so it can run on any linux system.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
There is really no need to use these glib types here. They are relicts
from the time when we used the glib hashtable so we can safely replace
them now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
It really doesn't make sense to expect an integer here as memcmp() and
friends use an integer, too, but in reversed logic. So use bool to avoid
confusion.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a new drop-in replacement for the glib hashtable implementation.
The hash table can be found at github: github.com/rustyrussel/ccan
It's licensed under the terms of the LGPL and perfect for our
implementation. Please see COPYING for license information.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If systemd is not used for multi-seat support, we simply fake-add seat
"seat0" and avoid looking for the "seat" tag. However, if devices still
use ID_SEAT, we still parse it but all other devices are taken for seat0
by default.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>