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>
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>
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>
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>
terminal: allow external redraw-schedule

Allow UI subsystem to schedule redraws.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>
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>
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>
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>
eloop: prevent recursive dispatching

We do not support recursive dispatching so prevent it explicitely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>
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>
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>