platform/upstream/kmscon.git
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>
12 years agovte: reset margins on soft-reset
David Herrmann [Sat, 14 Jul 2012 11:43:02 +0000 (13:43 +0200)]
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>
12 years agovte: implement DECSC DECRC
David Herrmann [Sat, 14 Jul 2012 11:39:43 +0000 (13:39 +0200)]
vte: implement DECSC DECRC

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>
12 years agoconsole: allow retrieving cursor state
David Herrmann [Sat, 14 Jul 2012 11:36:46 +0000 (13:36 +0200)]
console: allow retrieving cursor state

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>
12 years agoui: reopen terminal on HUP
David Herrmann [Sat, 14 Jul 2012 10:15:20 +0000 (12:15 +0200)]
ui: reopen terminal on HUP

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>
12 years agoterminal: close pty before opening it
David Herrmann [Sat, 14 Jul 2012 10:14:25 +0000 (12:14 +0200)]
terminal: close pty before opening it

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>
12 years agoxkb: fix null dereference
Ran Benita [Thu, 5 Jul 2012 10:16:40 +0000 (13:16 +0300)]
xkb: fix null dereference

Just an obvious silly mistake.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotests: fix tests to compile again
David Herrmann [Sat, 7 Jul 2012 11:45:29 +0000 (13:45 +0200)]
tests: fix tests to compile again

Whoops, I totally forgot about them. Fix the headers to be compatible with
eloop again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoRelease kmscon-2
David Herrmann [Sun, 1 Jul 2012 18:29:12 +0000 (20:29 +0200)]
Release kmscon-2

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>
12 years agoUpdate README
David Herrmann [Sun, 1 Jul 2012 18:26:30 +0000 (20:26 +0200)]
Update README

Fix the dependency information and add several TODO notes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agounicode: replace glib types with native types
David Herrmann [Sun, 1 Jul 2012 17:35:16 +0000 (19:35 +0200)]
unicode: replace glib types with native types

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>
12 years agomisc: change hashtable compare function to return bool
David Herrmann [Sun, 1 Jul 2012 17:29:33 +0000 (19:29 +0200)]
misc: change hashtable compare function to return bool

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>
12 years agomisc: remove glib dependency
David Herrmann [Sun, 1 Jul 2012 17:13:16 +0000 (19:13 +0200)]
misc: remove glib dependency

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>
12 years agouterm: monitor: make systemd optional
David Herrmann [Sun, 1 Jul 2012 14:43:09 +0000 (16:43 +0200)]
uterm: monitor: make systemd optional

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>
12 years agoAdd NEWS file
David Herrmann [Sun, 1 Jul 2012 14:31:54 +0000 (16:31 +0200)]
Add NEWS file

Whenever we do a release, this file will contain all the major changes as
a short list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: remove TODO from DIST_EXTRA
David Herrmann [Sun, 1 Jul 2012 14:18:23 +0000 (16:18 +0200)]
build: remove TODO from DIST_EXTRA

The TODO list was moved to github long ago so remove this dead reference.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: fix signal creation
David Herrmann [Sun, 1 Jul 2012 14:17:04 +0000 (16:17 +0200)]
eloop: fix signal creation

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>
12 years agouterm: vt: correctly initialize ret to 0
David Herrmann [Sun, 1 Jul 2012 14:11:10 +0000 (16:11 +0200)]
uterm: vt: correctly initialize ret to 0

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>
12 years agobuild: correctly clear GBM/EGL flags
David Herrmann [Sun, 1 Jul 2012 14:09:24 +0000 (16:09 +0200)]
build: correctly clear GBM/EGL flags

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>
12 years agoeloop: silence gcc warning
David Herrmann [Sun, 1 Jul 2012 13:49:36 +0000 (15:49 +0200)]
eloop: silence gcc warning

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>
12 years agollog: make debug statements produce real code
David Herrmann [Sun, 1 Jul 2012 13:47:11 +0000 (15:47 +0200)]
llog: make debug statements produce real code

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>
12 years agouterm: vt: silence gcc warning
David Herrmann [Sun, 1 Jul 2012 13:45:54 +0000 (15:45 +0200)]
uterm: vt: silence gcc warning

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>
12 years agovte/console: implement CSI 'M' (DL: delete line)
David Herrmann [Sun, 1 Jul 2012 13:35:28 +0000 (15:35 +0200)]
vte/console: implement CSI 'M' (DL: delete line)

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>
12 years agovte/console: implement CSI mode L (insert line: IL)
David Herrmann [Sun, 1 Jul 2012 13:27:10 +0000 (15:27 +0200)]
vte/console: implement CSI mode L (insert line: IL)

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>
12 years agobuild: make opengl optional
David Herrmann [Sun, 1 Jul 2012 12:59:43 +0000 (14:59 +0200)]
build: make opengl optional

This removes the mode where we compiled uterm with OpenGL instead of
OpenGLES2 (it was broken anyway) and makes it fully optional now.

gl_shader.h is no longer compiled if OpenGL is not available and provides
dummy helpers instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agogl: add wrappers for glClear and glClearColor
David Herrmann [Sun, 1 Jul 2012 12:39:30 +0000 (14:39 +0200)]
gl: add wrappers for glClear and glClearColor

This helps us moving opengl dependencies into a single source file so we
can easily disable it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: use UTERM_VIDEO_DUMB as fallback when DRM is not available
David Herrmann [Sun, 1 Jul 2012 12:31:50 +0000 (14:31 +0200)]
main: use UTERM_VIDEO_DUMB as fallback when DRM is not available

If the uterm video object fails to initialize the DRM device, then we try
again with the dumb device. Only if both devices fail, we drop the device
and continue.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: add dumb-drm backend
David Herrmann [Sun, 1 Jul 2012 12:28:26 +0000 (14:28 +0200)]
uterm: add dumb-drm backend

Nearly all drm drivers provide a GEM/TTM buffer backend called "dumb
buffers". These buffers can simply be mmap'ped like fbdev device so 2D
acceleration is available. This patch adds a backend to uterm-video that
uses these buffers. It is quite similar to the drm backend but removes all
the egl/gl/gles2 dependencies.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: rewrite configure.ac
David Herrmann [Sat, 30 Jun 2012 17:52:20 +0000 (19:52 +0200)]
build: rewrite configure.ac

Remove all obsolete code and make it more readable. Nearly all features
can now be configured. However, the code doesn't work correctly if udev or
systemd is removed. That will be fixed soon, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: monitor: refactor systemd code
David Herrmann [Sat, 30 Jun 2012 10:53:23 +0000 (12:53 +0200)]
uterm: monitor: refactor systemd code

Move all systemd dependencies into local helper functions so we can easily
make them optional.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: move systemd dependencies to libuterm
David Herrmann [Fri, 29 Jun 2012 11:00:00 +0000 (13:00 +0200)]
build: move systemd dependencies to libuterm

We use the sd-login library in uterm exclusively so move the dependecy to
libuterm.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: move vt.[hc] to libuterm
David Herrmann [Fri, 29 Jun 2012 10:59:25 +0000 (12:59 +0200)]
build: move vt.[hc] to libuterm

The kmscon VT layer is used in libuterm exclusively so build it as part of
it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: remove libudev.h includes if not needed
David Herrmann [Fri, 29 Jun 2012 10:49:37 +0000 (12:49 +0200)]
uterm: remove libudev.h includes if not needed

All udev-dependencies are now moved into uterm-monitor. This allows us to
easily make udev optional for hotplug-less systems or emergency setups.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: move uterm into shared library
David Herrmann [Fri, 29 Jun 2012 10:47:54 +0000 (12:47 +0200)]
build: move uterm into shared library

The uterm code was created to allow other applications to easily build new
user-space terminals for linux machines. Therefore, put it into a separate
library and install the header files correctly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: move eloop into shared library
David Herrmann [Fri, 29 Jun 2012 10:37:02 +0000 (12:37 +0200)]
build: move eloop into shared library

We use the eloop code in several other projects so move it into a shared
library to allow code-sharing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: first get keysyms, then update state
Ran Benita [Wed, 27 Jun 2012 10:23:38 +0000 (13:23 +0300)]
xkb: first get keysyms, then update state

This is the correct order, as specified in xkb_state_update_key header
comment.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: only repeat keys when they're supposed to repeat
Ran Benita [Wed, 27 Jun 2012 10:11:23 +0000 (13:11 +0300)]
xkb: only repeat keys when they're supposed to repeat

Support for this was added upstream, we can use it now. This mostly
means that modifiers won't repeat anymore.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: use unicode conversion from xkbcommon
Ran Benita [Wed, 27 Jun 2012 10:08:41 +0000 (13:08 +0300)]
xkb: use unicode conversion from xkbcommon

Support for this was added upstream, so we should avoid keeping the
entire conversion table twice in (readonly) memory. The old files are
still used by the dumb backend.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: move external sources into libkmscon-static
David Herrmann [Sun, 24 Jun 2012 19:15:08 +0000 (21:15 +0200)]
build: move external sources into libkmscon-static

Move all external sources into this library so we can use them everyone
but also be sure that we can link them statically. We will need this
guarantee later when adding LGPL stuff to libkmscon-static.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agodoc: fix header of gtk-doc makefile
David Herrmann [Sun, 24 Jun 2012 19:11:57 +0000 (21:11 +0200)]
doc: fix header of gtk-doc makefile

It still used the old name. So convert it to use the more general name as
we are building all documentation into one global document.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: add comments to Makefile.am
David Herrmann [Sun, 24 Jun 2012 19:11:19 +0000 (21:11 +0200)]
build: add comments to Makefile.am

Add more comments to Makefile.am to make it more readable.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: put static_* files into separate library
David Herrmann [Sun, 24 Jun 2012 18:43:34 +0000 (20:43 +0200)]
build: put static_* files into separate library

We now build all small helpers into a separate small library that can be
linked statically into all our others. That is, we don't need to keep
backwards compatibility or anything inside this library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agostatic: move statically linked subsystems to static_*
David Herrmann [Sun, 24 Jun 2012 18:35:22 +0000 (20:35 +0200)]
static: move statically linked subsystems to static_*

Small stuff that is not worth putting into a separate library is no moved
into the "static" library which is statically linked into all our
subsystems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: move to llog
David Herrmann [Sun, 24 Jun 2012 16:53:46 +0000 (18:53 +0200)]
eloop: move to llog

Move every use of log_* to llog_* and make all objects aware of llog
objects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agollop: add default helpers
David Herrmann [Sun, 24 Jun 2012 16:16:12 +0000 (18:16 +0200)]
llop: add default helpers

We often need to return the same message over and over again with the same
return value. Use default log-messages now instead of ignoring the log.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agollog: add direct log helpers
David Herrmann [Sun, 24 Jun 2012 16:15:14 +0000 (18:15 +0200)]
llog: add direct log helpers

Sometimes, the parent object might not be available so we need to pass in
the log-object directly. Use "d" as prefix for those functions and add
variants for the most oftenly used functions.

If you need more direct variants, add them when you introduce the first
user.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: require llog function in eloop-creation
David Herrmann [Sun, 24 Jun 2012 15:57:38 +0000 (17:57 +0200)]
eloop: require llog function in eloop-creation

When creating a new eloop object, we now require an lloop function so we
can perform conditional logging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: set LLOG_ENABLE_DEBUG
David Herrmann [Sun, 24 Jun 2012 15:55:59 +0000 (17:55 +0200)]
build: set LLOG_ENABLE_DEBUG

Set LLOG_ENABLE_DEBUG if debug mode is used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agolog: add link to llog
David Herrmann [Sun, 24 Jun 2012 15:55:26 +0000 (17:55 +0200)]
log: add link to llog

Add helper function that can be used as llog backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agollog: add library log helpers
David Herrmann [Sun, 24 Jun 2012 15:28:31 +0000 (17:28 +0200)]
llog: add library log helpers

Libraries must never log unconditionally. Otherwise, applications are
unable to disable logging and can get confused. This header contains
helpers to implement conditional logging on context objects inside of
libraries.

It is compatible to the log interface in kmscon apart from the runtime
configuration.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agolog: change severities to be identical to kernel sevs
David Herrmann [Sun, 24 Jun 2012 15:21:56 +0000 (17:21 +0200)]
log: change severities to be identical to kernel sevs

The kernel defines 8 severities. Lets be compatible to these numbers so
our API will not have to be changes in the future.

This also causes LOG_ALERT to be added. It is not used, yet, but may be in
the future.

We also change the parameter type of severities to "unsigned int". Enum
variables can change types if new enums are added. We don't want that so
use a fixed type.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: set AUTO_WRAP mode on reset for console object
David Herrmann [Sun, 24 Jun 2012 10:20:18 +0000 (12:20 +0200)]
vte: set AUTO_WRAP mode on reset for console object

We reset all modes but forget to set them on the console object, too. The
AUTO_WRAP mode is the only mode that matters here, so we can ignore the
other modes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: video_drm: set EGL_DISPLAY correctly
David Herrmann [Sun, 24 Jun 2012 09:09:21 +0000 (11:09 +0200)]
uterm: video_drm: set EGL_DISPLAY correctly

We force EGL_DISPLAY to drm now. Otherwise, we might cause segfaults if
the EGL library tries to use the X11 egl-backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: use --fbdev options to switch between DRM/fbdev
David Herrmann [Sun, 24 Jun 2012 09:01:25 +0000 (11:01 +0200)]
main: use --fbdev options to switch between DRM/fbdev

The new --fbdev option allows runtime switching between the two backends.
That is, we only use fbdev devices when --fbdev is given. Otherwise, DRM
is used.

Technically, it would also be possible to use both. However, almost every
DRM device does also register an fbdev device for backwards compatibility.
Therefore, we must avoid using both, the DRM and fbdev device of the same
display at the same time. As this would also mean dealing with failures in
one backend and then switching to the other, we avoid this for complexity
reasons. Who needs fbdev and drm simultaneously, anyway?

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: redraw on wake-up
David Herrmann [Sun, 24 Jun 2012 08:53:04 +0000 (10:53 +0200)]
terminal: redraw on wake-up

The drm video backend does automatically blit the framebuffer on wake-up,
however, the fbdev backend does not. Hence, we automatically redraw on
wake-up in the terminal backend now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: avoid adding displays multiple times
David Herrmann [Sun, 24 Jun 2012 08:52:05 +0000 (10:52 +0200)]
terminal: avoid adding displays multiple times

We now enumerate displays on wake-up so we might end up adding a display
twice. This causes the display to be redrawn twice which is nasty so we
avoid it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoui: do not modify callback parameters
David Herrmann [Sun, 24 Jun 2012 08:50:16 +0000 (10:50 +0200)]
ui: do not modify callback parameters

Other registered callbacks might get confused if we change the parameters.
Hence, we use a static copy for further actions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: support 2D blitting
David Herrmann [Sun, 24 Jun 2012 08:32:42 +0000 (10:32 +0200)]
font: support 2D blitting

If OpenGL is not supported, we now allow 2D blitting into the video
framebuffer as alternative to shaders.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovideo: return -EOPNOTSUPP in video_use without OpenGL
David Herrmann [Sun, 24 Jun 2012 08:31:34 +0000 (10:31 +0200)]
video: return -EOPNOTSUPP in video_use without OpenGL

If OpenGL is not supported, we should _not_ return 0. Otherwise, there is
not convenient way to detect this scenario.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoui: enumerate displays on wakeup
David Herrmann [Sun, 24 Jun 2012 08:30:28 +0000 (10:30 +0200)]
ui: enumerate displays on wakeup

We might have missed a display when our handler was not registered, yet.
So enumerate these displays on wakeup so we can be sure that we have all
displays registered with the terminal subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomain: do not depend on OpenGL
David Herrmann [Sun, 24 Jun 2012 08:28:40 +0000 (10:28 +0200)]
main: do not depend on OpenGL

We currently try activating the OpenGL context when adding a video device
to a seat. However, not all video backends provide OpenGL contexts so
remove this restriction. The terminal subsystem does all this by itself
now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: create shader only when OpenGL is available
David Herrmann [Sun, 24 Jun 2012 08:27:46 +0000 (10:27 +0200)]
terminal: create shader only when OpenGL is available

If the video backend does not provide an OpenGL context, there is no need
to create the gl shaders. We then use the 2D blitting functions instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: add debug message when removing display
David Herrmann [Sun, 24 Jun 2012 08:27:07 +0000 (10:27 +0200)]
terminal: add debug message when removing display

This can help a lot when debugging displays that are registered multiple
times with a terminal object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: video_fbdev: fix debug statements
David Herrmann [Sat, 23 Jun 2012 23:09:40 +0000 (01:09 +0200)]
uterm: video_fbdev: fix debug statements

Remove blitting debug statements as it is working fine now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: add internal header for blitting support
David Herrmann [Sat, 23 Jun 2012 23:07:01 +0000 (01:07 +0200)]
uterm: add internal header for blitting support

Whoops, forgot to add it in the fbdev commit. Pushing it now so it works
again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: video_drm: set .blit to NULL
David Herrmann [Sat, 23 Jun 2012 23:06:16 +0000 (01:06 +0200)]
uterm: video_drm: set .blit to NULL

We do not support blitting via drm (yet) so set it to NULL explicitely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: video_fbdev: make double-buffering optional
David Herrmann [Sat, 23 Jun 2012 23:04:50 +0000 (01:04 +0200)]
uterm: video_fbdev: make double-buffering optional

This makes double-buffering optional as not all drivers provide this. In
fact, only very few drivers implement this. Furthermore, this also adds a
fake display-mode that is used instead of NULL. Otherwise, the screen
object might not work as expected.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: video: add blitting support
David Herrmann [Sat, 23 Jun 2012 23:03:56 +0000 (01:03 +0200)]
uterm: video: add blitting support

All backends that do not provide OpenGL contexts can not implement buffer
blitting so we can at least draw rectangular areas to the framebuffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agouterm: add WAKEUP and SLEEP signals
David Herrmann [Sat, 23 Jun 2012 23:01:47 +0000 (01:01 +0200)]
uterm: add WAKEUP and SLEEP signals

Notify all listeners when going to sleep or waking up. This allows saving
energy in the listeners by not redrawing the screen while being asleep.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>