846 Commits

Author SHA1 Message Date
David Herrmann
b4bbc2b087 console: add *_console_scroll_up()/_down() helpers
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>
2012-07-31 14:54:58 +02:00
David Herrmann
51b70bef52 uterm: video: add blend() helper
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>
2012-07-31 14:24:45 +02:00
David Herrmann
6ab01cbf6b uterm: video: fix blit() and fill() height adjustments
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>
2012-07-31 13:35:18 +02:00
David Herrmann
7c075e3891 uterm: video: remove unused UTERM_FORMAT_MONO
This format is not used, neither implemented, so it is safe to remove the
constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 13:12:05 +02:00
David Herrmann
254cb5f6cb uterm: video: remove fbdev_display_map() orphan
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>
2012-07-31 10:32:43 +02:00
David Herrmann
023fb41bb4 test_output: add blitting support
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>
2012-07-31 10:31:40 +02:00
David Herrmann
aada3038e1 uterm: video: add fill() helper
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>
2012-07-31 10:29:52 +02:00
David Herrmann
361177fe97 uterm: video: change blit'ting logic
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>
2012-07-31 10:22:39 +02:00
David Herrmann
20e0e69253 test_input: fix compilation for kbd_keysym_to_string()
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>
2012-07-31 10:01:32 +02:00
David Herrmann
dd3d67a6f4 uterm: input: add uterm_input_keysym_to_string()
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>
2012-07-31 10:00:03 +02:00
David Herrmann
99b2038f7f text: font: add pango font backend
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>
2012-07-30 17:44:02 +02:00
David Herrmann
36938b59d7 text: font: replace x/y offsets with baseline attribute
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>
2012-07-30 17:42:21 +02:00
David Herrmann
48beed72f4 build: add text-subsystem to build-sources
This finally adds the new font renderers to the build-sources so they are
actually built.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-30 11:09:57 +02:00
David Herrmann
f55715b60b external: htable: remove config.h inclusion
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>
2012-07-30 11:08:55 +02:00
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