platform/upstream/kmscon.git
11 years agoterminal: choose "gltex" renderer if OpenGL is available
David Herrmann [Fri, 10 Aug 2012 09:49:12 +0000 (11:49 +0200)]
terminal: choose "gltex" renderer if OpenGL is available

If the uterm backend supports OpenGL, then we should use the "gltex"
renderer as the "bblit" renderer performs pretty badly on OpenGL displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: fix choosing fallback backend
David Herrmann [Fri, 10 Aug 2012 09:48:28 +0000 (11:48 +0200)]
text: fix choosing fallback backend

We didn't correctly choose the fallback backend but instead used the
last-registered backend. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: gltex: add OpenGL text renderer
David Herrmann [Fri, 10 Aug 2012 09:43:07 +0000 (11:43 +0200)]
text: gltex: add OpenGL text renderer

This adds an OpenGL text renderer. It uses textures to store glyph
information and renders the characters by assembling a vertex-list first.
To improve performance, we use texture-atlases.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: rework text renderer system
David Herrmann [Fri, 10 Aug 2012 09:42:00 +0000 (11:42 +0200)]
text: rework text renderer system

This reworks the text renderer system to make it easier to write backends.
We also allow returning errors during rendering now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: reset vertex-attrib-arrays after use
David Herrmann [Fri, 10 Aug 2012 09:38:42 +0000 (11:38 +0200)]
uterm: video: drm: reset vertex-attrib-arrays after use

We should reset all used vertex-attrib-arrays, otherwise, we have to reset
them before drawing as we cannot sure that some other renderer left them
on.
As a rule we always assume a reset state similar to our assumption that no
VBO is bound during rendering.

This is a quite bad side-effect from OpenGL being a state-machine. As we
are a library, we cannot make any undocumented assumptions about the
OpenGL state. Therefore, we try to be as strict as possible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: make bblit backend optional
David Herrmann [Wed, 8 Aug 2012 17:33:34 +0000 (19:33 +0200)]
build: make bblit backend optional

This allows configuring the bblit backend during kmscon-build. If other
rendering backends are preferred, you can now compile kmscon without the
bblit backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: implement .blit, .blend and .fill callbacks
David Herrmann [Wed, 8 Aug 2012 17:01:53 +0000 (19:01 +0200)]
uterm: video: drm: implement .blit, .blend and .fill callbacks

This implements the static 2D blitting callbacks for the DRM backend. It
uses OpenGL to push the images with textures through the rendering
pipeline. Please note that this is horribly slow when used like 2D
blitting. However, it is a safe backend and better than nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogl: add shader helpers
David Herrmann [Wed, 8 Aug 2012 13:32:01 +0000 (15:32 +0200)]
gl: add shader helpers

New helper functions for working with OpenGL shaders.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomisc: fix returning false in kmscon_hashtable_find() when invalid
David Herrmann [Wed, 8 Aug 2012 13:14:35 +0000 (15:14 +0200)]
misc: fix returning false in kmscon_hashtable_find() when invalid

We currently return "true" if the hashtable is invalid which is
irritating. Fix this to be "false".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomisc: fix rehashing hashtable entries
David Herrmann [Wed, 8 Aug 2012 13:13:49 +0000 (15:13 +0200)]
misc: fix rehashing hashtable entries

We need to hash the key instead of the whole entry, otherwise, we have
dead/wrong entries in the hash-table after a rehash-round.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agollog: mark llog_format as unused
David Herrmann [Wed, 8 Aug 2012 11:02:44 +0000 (13:02 +0200)]
llog: mark llog_format as unused

Gcc emits useless warnings when llog_format is not used so mark it as
unused.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agostatic: add gl math helpers
David Herrmann [Wed, 8 Aug 2012 10:21:23 +0000 (12:21 +0200)]
static: add gl math helpers

These are the same helpers that were previously removed, however, they are
now part of the static-kmscon library and can be stripped away by the
linker.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogenshader: make shader generation more flexible
David Herrmann [Wed, 8 Aug 2012 10:13:29 +0000 (12:13 +0200)]
genshader: make shader generation more flexible

The genshader program now takes all input shaders as arguments so we can
easily add new shaders. We also name the constants after the shader file
to be as flexible as possible.

This also moves the generated shaders into the static-kmscon library. The
linker will strip unused symbols, anyway, so we aren't loosing anything
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agogl: remove GL subsystem
David Herrmann [Wed, 8 Aug 2012 09:36:51 +0000 (11:36 +0200)]
gl: remove GL subsystem

The GL subsystem is no longer used so we can remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: remove gl.h include
David Herrmann [Wed, 8 Aug 2012 09:28:23 +0000 (11:28 +0200)]
terminal: remove gl.h include

We do not use this header inside of the terminal subsystem so we can
remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agofont: remove font.h
David Herrmann [Wed, 8 Aug 2012 09:28:03 +0000 (11:28 +0200)]
font: remove font.h

This header is unused so we can remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: move font_char_attr to text.h
David Herrmann [Wed, 8 Aug 2012 09:27:19 +0000 (11:27 +0200)]
text: move font_char_attr to text.h

This way we can now remove all font.h includes. We can rename the
structure later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: adopt new libgbm API
David Herrmann [Wed, 8 Aug 2012 09:21:20 +0000 (11:21 +0200)]
uterm: video: drm: adopt new libgbm API

libgbm changed the API (why?) so we need to use get_stride() instead of
get_pitch().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: remove OpenGL drawing stubs
David Herrmann [Wed, 8 Aug 2012 09:20:36 +0000 (11:20 +0200)]
terminal: remove OpenGL drawing stubs

Drawing with OpenGL didn't work, so we can safely remove the stubs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agomisc: remove log references
David Herrmann [Mon, 6 Aug 2012 17:04:04 +0000 (19:04 +0200)]
misc: remove log references

The static-* code does not depend on the log subsystem so it should not
include the header nor define some internal logging helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: bblit: remove unused private data
David Herrmann [Mon, 6 Aug 2012 13:44:41 +0000 (15:44 +0200)]
text: bblit: remove unused private data

The bit-blitting renderer does not really use the helper structure so
remove it and simplify the code a lot.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: add --disable-optimizations option
David Herrmann [Mon, 6 Aug 2012 13:27:53 +0000 (15:27 +0200)]
build: add --disable-optimizations option

We are in a state where redrawing the console can take a significant
amount of time on slower machines. Therefore, we definitely need gcc code
optimizations which help here a _lot_. However, they are currently bundled
to the debug flags.

This splits this into two options. We still need this flag to get getter
backtraces. Otherwise, those inlined functions are horrible to track done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoSuppress some odd gcc warnings
David Herrmann [Mon, 6 Aug 2012 13:04:42 +0000 (15:04 +0200)]
Suppress some odd gcc warnings

As gcc is not aware of out list-semantics, it warns about uninitialized
variables when in fact we know that they must be initialized. Suppress
some by initializing the variables to NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: bblit: do not clear screen
David Herrmann [Mon, 6 Aug 2012 12:54:34 +0000 (14:54 +0200)]
text: bblit: do not clear screen

The console layer guarantees that all glyphs are sent to the renderer so
there is no need to clear the screen before redrawing.

This reduces flickering of single-buffered video backends.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: Simplify font-system and add freetype2 renderer
David Herrmann [Mon, 6 Aug 2012 12:48:22 +0000 (14:48 +0200)]
text: font: Simplify font-system and add freetype2 renderer

The freetype2 renderer uses ft2 and fontconfig to provide a very
simplistic renderer. We also simplify the logic of the whole subsystem a
lot and guarantee that each glyph will have the same size now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: uxkb: fix typo in (u)xkb_available=false
David Herrmann [Mon, 6 Aug 2012 12:47:12 +0000 (14:47 +0200)]
uterm: uxkb: fix typo in (u)xkb_available=false

When compiling without xkbcommon we currently get compiler errors as the
uxkb_available variable hasn't been correctly renamed previously.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add "font-engine" option
David Herrmann [Mon, 6 Aug 2012 12:45:03 +0000 (14:45 +0200)]
conf: add "font-engine" option

This option allows to select the font-engine during run-time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoRemove old font renderer sources
David Herrmann [Wed, 1 Aug 2012 13:42:35 +0000 (15:42 +0200)]
Remove old font renderer sources

font_freetype.c was unused for long and font_pango.c has been removed
recently.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoUse new text renderer
David Herrmann [Wed, 1 Aug 2012 13:41:22 +0000 (15:41 +0200)]
Use new text renderer

This fixes the console and terminal layer to use the new text renderer
instead of the old one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: pango: fix memory allocation
David Herrmann [Tue, 31 Jul 2012 14:59:36 +0000 (16:59 +0200)]
text: font: pango: fix memory allocation

Whoops, we were checking the wrong variable. Fix the OOM check to
correctly catch the right errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: add bblit text-renderer
David Herrmann [Tue, 31 Jul 2012 14:50:20 +0000 (16:50 +0200)]
text: add bblit text-renderer

The bblit text-renderer is the most basic renderer which simply blits or
blends the glyphs into the framebuffer memory. It cannot be used with
displays that do not provide framebuffer access but only 3D access.
However, 3D rendering is currently broken, anyway, so we can ignore it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: add text renderer subsystem
David Herrmann [Tue, 31 Jul 2012 14:49:32 +0000 (16:49 +0200)]
text: add text renderer subsystem

The text-renderer subsystem provides a way to register arbitrary
text-rendering backends. These backends use the font-objects to draw the
console into a framebuffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: pango: fix font width being 0
David Herrmann [Tue, 31 Jul 2012 14:46:22 +0000 (16:46 +0200)]
text: font: pango: fix font width being 0

We must avoid having a width of zero, otherwise, the text renderers might
divide by zero.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotext: font: correctly measure pango fonts
David Herrmann [Tue, 31 Jul 2012 14:44:28 +0000 (16:44 +0200)]
text: font: correctly measure pango fonts

We need to actually increase the character count, otherwise, we will never
have a measurement set.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: add CHA CSI
David Herrmann [Tue, 31 Jul 2012 12:57:47 +0000 (14:57 +0200)]
vte: add CHA CSI

The CHA CSI is used to move the cursor horizontally but keep the vertical
position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: add VPA/VPR CSIs
David Herrmann [Tue, 31 Jul 2012 12:57:04 +0000 (14:57 +0200)]
vte: add VPA/VPR CSIs

VPA and VPR are used to change the current line but keep the column. One
does an absolute positioning and one a relative positioning.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agovte: add SU/SD CSIs
David Herrmann [Tue, 31 Jul 2012 12:56:11 +0000 (14:56 +0200)]
vte: add SU/SD CSIs

SU and SD are used to scroll-up and scroll-down the visible buffer.
Margins are kept and the cursor position does not change. This is a valid
vt510 CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconsole: add *_console_scroll_up()/_down() helpers
David Herrmann [Tue, 31 Jul 2012 12:54:58 +0000 (14:54 +0200)]
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>
11 years agouterm: video: add blend() helper
David Herrmann [Tue, 31 Jul 2012 12:24:45 +0000 (14:24 +0200)]
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>
11 years agouterm: video: fix blit() and fill() height adjustments
David Herrmann [Tue, 31 Jul 2012 11:35:18 +0000 (13:35 +0200)]
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>
11 years agouterm: video: remove unused UTERM_FORMAT_MONO
David Herrmann [Tue, 31 Jul 2012 11:12:05 +0000 (13:12 +0200)]
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>
11 years agouterm: video: remove fbdev_display_map() orphan
David Herrmann [Tue, 31 Jul 2012 08:32:43 +0000 (10:32 +0200)]
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>
11 years agotest_output: add blitting support
David Herrmann [Tue, 31 Jul 2012 08:31:40 +0000 (10:31 +0200)]
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>
11 years agouterm: video: add fill() helper
David Herrmann [Tue, 31 Jul 2012 08:29:52 +0000 (10:29 +0200)]
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>
11 years agouterm: video: change blit'ting logic
David Herrmann [Tue, 31 Jul 2012 08:22:39 +0000 (10:22 +0200)]
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>
11 years agotest_input: fix compilation for kbd_keysym_to_string()
David Herrmann [Tue, 31 Jul 2012 08:01:32 +0000 (10:01 +0200)]
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>
11 years agouterm: input: add uterm_input_keysym_to_string()
David Herrmann [Tue, 31 Jul 2012 08:00:03 +0000 (10:00 +0200)]
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>
11 years agotext: font: add pango font backend
David Herrmann [Mon, 30 Jul 2012 15:44:02 +0000 (17:44 +0200)]
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>
11 years agotext: font: replace x/y offsets with baseline attribute
David Herrmann [Mon, 30 Jul 2012 15:42:21 +0000 (17:42 +0200)]
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>
11 years agobuild: add text-subsystem to build-sources
David Herrmann [Mon, 30 Jul 2012 09:09:57 +0000 (11:09 +0200)]
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>
11 years agoexternal: htable: remove config.h inclusion
David Herrmann [Mon, 30 Jul 2012 09:08:55 +0000 (11:08 +0200)]
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>
11 years agotext: font: Add 8x16 font
David Herrmann [Sat, 28 Jul 2012 14:40:22 +0000 (16:40 +0200)]
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>
11 years agotext: font: add x/y offsets for glyphs
David Herrmann [Sat, 28 Jul 2012 14:37:22 +0000 (16:37 +0200)]
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>
11 years agotext_font: add new font renderer subsystem
David Herrmann [Sat, 28 Jul 2012 11:12:54 +0000 (13:12 +0200)]
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>
11 years agouterm: video: replace bpp with format id
David Herrmann [Sun, 22 Jul 2012 14:16:51 +0000 (16:16 +0200)]
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>
11 years agomisc: free hashtable on destruction
David Herrmann [Sat, 21 Jul 2012 21:32:07 +0000 (23:32 +0200)]
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>
11 years agovideo: fbdev: fix freeing fake display
David Herrmann [Sat, 21 Jul 2012 19:01:22 +0000 (21:01 +0200)]
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>
11 years agovt: fix dropping reference on deallocation
David Herrmann [Sat, 21 Jul 2012 18:45:30 +0000 (20:45 +0200)]
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>
11 years agoeloop: prevent recursive dispatching
David Herrmann [Sat, 21 Jul 2012 18:20:09 +0000 (20:20 +0200)]
eloop: prevent recursive dispatching

We do not support recursive dispatching so prevent it explicitely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: fix invalid memory access during dispatch
David Herrmann [Sat, 21 Jul 2012 18:14:38 +0000 (20:14 +0200)]
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>
11 years agoconf: fix invalid memory access in strip_spaces()
David Herrmann [Sat, 21 Jul 2012 18:12:00 +0000 (20:12 +0200)]
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>
11 years agoRefactor input backend-system
David Herrmann [Sat, 21 Jul 2012 17:06:50 +0000 (19:06 +0200)]
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>
11 years agoui: dispatch redraws in UI instead of terminal
David Herrmann [Sat, 21 Jul 2012 15:22:05 +0000 (17:22 +0200)]
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>
11 years agoterminal: allow external redraw-schedule
David Herrmann [Sat, 21 Jul 2012 14:40:05 +0000 (16:40 +0200)]
terminal: allow external redraw-schedule

Allow UI subsystem to schedule redraws.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoui: explicitely remove displays from terminals
David Herrmann [Sat, 21 Jul 2012 13:47:51 +0000 (15:47 +0200)]
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>
11 years agoterminal: add API to remove displays
David Herrmann [Sat, 21 Jul 2012 13:44:41 +0000 (15:44 +0200)]
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>
11 years agoui: arrange video objects in a list
David Herrmann [Sat, 21 Jul 2012 13:38:04 +0000 (15:38 +0200)]
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>
11 years agoterminal: be more verbose when adding displays
David Herrmann [Sat, 21 Jul 2012 13:32:19 +0000 (15:32 +0200)]
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>
12 years agoconf: add config-file parser
David Herrmann [Tue, 17 Jul 2012 20:47:15 +0000 (22:47 +0200)]
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>
12 years agoconf: add generic argument array
David Herrmann [Mon, 16 Jul 2012 17:35:05 +0000 (19:35 +0200)]
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>
12 years agobuild: remove glib dependency
David Herrmann [Sun, 15 Jul 2012 14:41:26 +0000 (16:41 +0200)]
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>
12 years agounicode: implement ucs4 to utf8 encoding
David Herrmann [Sun, 15 Jul 2012 14:29:34 +0000 (16:29 +0200)]
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>
12 years agounicode: use kmscon_array instead of GArray
David Herrmann [Sun, 15 Jul 2012 12:45:19 +0000 (14:45 +0200)]
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>
12 years agomisc: add dynamic-array implementation
David Herrmann [Sun, 15 Jul 2012 12:32:44 +0000 (14:32 +0200)]
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>
12 years agoconsole/font: draw bg only if needed
David Herrmann [Sun, 15 Jul 2012 10:55:50 +0000 (12:55 +0200)]
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>
12 years agovte: fix reset_state() resetting only saved-states
David Herrmann [Sun, 15 Jul 2012 10:54:19 +0000 (12:54 +0200)]
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>
12 years agovte: implement RIS hard reset
David Herrmann [Sun, 15 Jul 2012 10:06:57 +0000 (12:06 +0200)]
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>
12 years agovte: send primary-DA on 7bit DECID
David Herrmann [Sun, 15 Jul 2012 10:02:18 +0000 (12:02 +0200)]
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>
12 years agovte: send primary DA on DECID
David Herrmann [Sun, 15 Jul 2012 09:59:21 +0000 (11:59 +0200)]
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>
12 years agovte: implement device status reports (DSR)
David Herrmann [Sun, 15 Jul 2012 09:55:51 +0000 (11:55 +0200)]
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>
12 years agovte: stop advertising UDK support
David Herrmann [Sun, 15 Jul 2012 09:36:35 +0000 (11:36 +0200)]
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>
12 years agovte: implement CHT, CBT and tabulators
David Herrmann [Sun, 15 Jul 2012 09:30:51 +0000 (11:30 +0200)]
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>
12 years agoconsole: implement tab movement
David Herrmann [Sun, 15 Jul 2012 09:26:11 +0000 (11:26 +0200)]
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>
12 years agovte/console: implement protected erase
David Herrmann [Sat, 14 Jul 2012 21:51:56 +0000 (23:51 +0200)]
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>
12 years agovte: support ECH CSI
David Herrmann [Sat, 14 Jul 2012 18:24:10 +0000 (20:24 +0200)]
vte: support ECH CSI

The ECH CSI is used to erase partial lines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: fix invalid cursor state after resize
David Herrmann [Sat, 14 Jul 2012 18:00:06 +0000 (20:00 +0200)]
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>
12 years agoconsole: allow erasing partial lines
David Herrmann [Sat, 14 Jul 2012 17:55:35 +0000 (19:55 +0200)]
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>
12 years agovte: extend SGR/color handling
David Herrmann [Sat, 14 Jul 2012 17:49:55 +0000 (19:49 +0200)]
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>
12 years agovte: fix application cursor keys
David Herrmann [Sat, 14 Jul 2012 17:34:04 +0000 (19:34 +0200)]
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>
12 years agoconsole: hide cursor if requested
David Herrmann [Sat, 14 Jul 2012 17:31:37 +0000 (19:31 +0200)]
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>
12 years agovte: tune SGR handling
David Herrmann [Sat, 14 Jul 2012 15:38:32 +0000 (17:38 +0200)]
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>
12 years agoconsole/vte: implement ICH DCH
David Herrmann [Sat, 14 Jul 2012 15:33:28 +0000 (17:33 +0200)]
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>
12 years agoconsole: support "protect" character attribute
David Herrmann [Sat, 14 Jul 2012 14:49:35 +0000 (16:49 +0200)]
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>
12 years agovte: implement TBC
David Herrmann [Sat, 14 Jul 2012 14:24:08 +0000 (16:24 +0200)]
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>
12 years agovte: allow setting tab-stops
David Herrmann [Sat, 14 Jul 2012 14:18:42 +0000 (16:18 +0200)]
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>
12 years agoconsole: add tab-stop helpers
David Herrmann [Sat, 14 Jul 2012 12:21:43 +0000 (14:21 +0200)]
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>
12 years agoconsole: fix tab ruler to be horizontal
David Herrmann [Sat, 14 Jul 2012 12:20:39 +0000 (14:20 +0200)]
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>
12 years agoconsole: implement console soft-reset
David Herrmann [Sat, 14 Jul 2012 12:12:51 +0000 (14:12 +0200)]
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>
12 years agoAdd optional dbus support
David Herrmann [Sat, 14 Jul 2012 12:00:23 +0000 (14:00 +0200)]
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>
12 years agoconsole: add tab-ruler support
David Herrmann [Sat, 14 Jul 2012 11:53:52 +0000 (13:53 +0200)]
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>