632 Commits

Author SHA1 Message Date
David Herrmann
d5f85bba13 text: font: Add 8x16 font
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>
2012-07-28 16:40:22 +02:00
David Herrmann
4b7d694902 text: font: add x/y offsets for glyphs
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>
2012-07-28 16:37:22 +02:00
David Herrmann
fb1e7a93bf text_font: add new font renderer subsystem
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>
2012-07-28 13:12:54 +02:00
David Herrmann
c170a43624 uterm: video: replace bpp with format id
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>
2012-07-22 16:16:51 +02:00
David Herrmann
a4ab9158f1 misc: free hashtable on destruction
Fix memory leak as we didn't free the hashtable memory after destruction.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-21 23:32:07 +02:00
David Herrmann
a67df3a069 video: fbdev: fix freeing fake display
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>
2012-07-21 21:01:22 +02:00
David Herrmann
4d803f54ab vt: fix dropping reference on deallocation
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>
2012-07-21 20:45:30 +02:00
David Herrmann
1715ec526a eloop: prevent recursive dispatching
We do not support recursive dispatching so prevent it explicitely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-21 20:20:09 +02:00
David Herrmann
f3609f6ed9 eloop: fix invalid memory access during dispatch
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>
2012-07-21 20:14:38 +02:00
David Herrmann
52fa0f80d9 conf: fix invalid memory access in strip_spaces()
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>
2012-07-21 20:12:00 +02:00
David Herrmann
741b8d33df Refactor input backend-system
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>
2012-07-21 19:06:50 +02:00
David Herrmann
a0217124e5 ui: dispatch redraws in UI instead of terminal
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>
2012-07-21 17:22:05 +02:00
David Herrmann
e18e063d87 terminal: allow external redraw-schedule
Allow UI subsystem to schedule redraws.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-21 16:40:05 +02:00
David Herrmann
181d26f0e7 ui: explicitely remove displays from terminals
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>
2012-07-21 15:47:51 +02:00
David Herrmann
45c2284ece terminal: add API to remove displays
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>
2012-07-21 15:44:41 +02:00
David Herrmann
e9019e42cb ui: arrange video objects in a list
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>
2012-07-21 15:38:04 +02:00
David Herrmann
354a67555b terminal: be more verbose when adding displays
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>
2012-07-21 15:32:19 +02:00
David Herrmann
dd68e97016 conf: add config-file parser
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>
2012-07-17 22:47:15 +02:00
David Herrmann
3cadb1d349 conf: add generic argument array
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>
2012-07-16 19:35:05 +02:00
David Herrmann
8a9eccdaf9 build: remove glib dependency
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>
2012-07-15 16:41:26 +02:00
David Herrmann
d0672030ff unicode: implement ucs4 to utf8 encoding
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>
2012-07-15 16:29:34 +02:00
David Herrmann
a97c580afd unicode: use kmscon_array instead of GArray
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>
2012-07-15 14:45:19 +02:00
David Herrmann
f59e6f5e12 misc: add dynamic-array implementation
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>
2012-07-15 14:45:10 +02:00
David Herrmann
2cd8cdbea4 console/font: draw bg only if needed
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>
2012-07-15 12:55:50 +02:00
David Herrmann
a6bca387da vte: fix reset_state() resetting only saved-states
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>
2012-07-15 12:54:19 +02:00
David Herrmann
2551efdbac vte: implement RIS hard reset
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>
2012-07-15 12:06:57 +02:00
David Herrmann
2222e316cb vte: send primary-DA on 7bit DECID
Also send the primary-DA when receiving 7bit variant of DECID.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 12:02:18 +02:00
David Herrmann
9cd05223a5 vte: send primary DA on DECID
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>
2012-07-15 11:59:21 +02:00
David Herrmann
aa31b1297e vte: implement device status reports (DSR)
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>
2012-07-15 11:55:51 +02:00
David Herrmann
10d72851bb vte: stop advertising UDK support
We do not support user-defined-keys (UDK) so do not advertise it in
primary-DA lines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:36:35 +02:00
David Herrmann
1641241e5d vte: implement CHT, CBT and tabulators
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>
2012-07-15 11:30:51 +02:00
David Herrmann
a7f39f23fe console: implement tab movement
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>
2012-07-15 11:26:11 +02:00
David Herrmann
785137264b vte/console: implement protected erase
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>
2012-07-14 23:51:56 +02:00
David Herrmann
01527f9f55 vte: support ECH CSI
The ECH CSI is used to erase partial lines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 20:24:10 +02:00
David Herrmann
bdf032898e console: fix invalid cursor state after resize
Set cursor state to next valid position on resize to avoid invalid cursor
states.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 20:00:06 +02:00
David Herrmann
59e82152d3 console: allow erasing partial lines
Later VTs allow erasing only partial lines so add support for that in the
console backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:58:38 +02:00
David Herrmann
60527b2d64 vte: extend SGR/color handling
This adds full xterm 256color support and improves SGR handling in
general.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:49:55 +02:00
David Herrmann
ba59f62a26 vte: fix application cursor keys
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>
2012-07-14 19:34:04 +02:00
David Herrmann
f4375dcc76 console: hide cursor if requested
When the HIDE_CURSOR flag is set, we must not draw the cursor.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:31:37 +02:00
David Herrmann
7fb5c5c454 vte: tune SGR handling
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>
2012-07-14 17:38:32 +02:00
David Herrmann
492ac8f72c console/vte: implement ICH DCH
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>
2012-07-14 17:33:28 +02:00
David Herrmann
60b180a369 console: support "protect" character attribute
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>
2012-07-14 16:49:35 +02:00
David Herrmann
8c42b38cd3 vte: implement TBC
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>
2012-07-14 16:24:08 +02:00
David Herrmann
6177d4fa69 vte: allow setting tab-stops
Allow applications to set new tab-stops according to vt220 rules.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 16:18:42 +02:00
David Herrmann
1d87be8c98 console: add tab-stop helpers
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>
2012-07-14 14:21:43 +02:00
David Herrmann
abb4deb4b8 console: fix tab ruler to be horizontal
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>
2012-07-14 14:20:39 +02:00
David Herrmann
10c90c6c5d console: implement console soft-reset
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>
2012-07-14 14:12:51 +02:00
David Herrmann
2ca0c915a7 Add optional dbus support
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>
2012-07-14 14:00:23 +02:00
David Herrmann
e1095b5ef2 console: add tab-ruler support
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>
2012-07-14 13:53:52 +02:00
David Herrmann
2543f13630 vte: reset margins on soft-reset
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>
2012-07-14 13:43:02 +02:00