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>
The previous fix incorrectly registered new signals always to the last
found signal which is definitely incorrect. Therefore, we now correctly
traverse the list and register new signals as new signals.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to return "true", not "false" if a mode is unknown. Otherwise, we
will block the VT subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When building without DRM we should correctly clear the GBM and EGL flags.
Otherwise, we will be linking them either way.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Gcc warns about an uninitialized variable (which technically is correct).
However, there is really no way this can really happen. But to make gcc
happy (and to enhance code readability) we now depend on !sig whether the
list-search was successful.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of defining them to nothing we now produce real code which
evaluates to "void", though. This allows us to use the macros whereever an
rvalue can be used.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We initialize the variable to "true" to silence gcc warnings that we might
get an uninitialized variable (which we really cannot get here).
Anyway, in the future, if the number of types may increase, the correct
way to deal with unknown types is returning "true" so do this by default
now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The 'M' CSI mode is used to delete lines. This implements this mode
similar to the "INSERT LINES" CSI.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The IL CSI ('L') is used to insert a given number of lines at the current
cursor position. All lines below are moved down.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>