platform/upstream/kmscon.git
12 years agovte: parse basic control codes
David Herrmann [Wed, 1 Feb 2012 16:13:22 +0000 (17:13 +0100)]
vte: parse basic control codes

This adds a parser for basic control codes but does not implement their
functionality, yet. Only the newline handler is kept.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: first check for special keys then for ucs4 char
David Herrmann [Wed, 1 Feb 2012 15:03:54 +0000 (16:03 +0100)]
vte: first check for special keys then for ucs4 char

We should first check whether we recognize the XK_* identifier before we
rely on the converted UCS4 character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: implement basic key mappings
David Herrmann [Wed, 1 Feb 2012 14:59:53 +0000 (15:59 +0100)]
vte: implement basic key mappings

The system keys are mapped to their ASCII equivalents. We do not support
CR/NL mode nor scroll-lock yet (is this supported by any term?).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agodoc: add VTE links and resources
David Herrmann [Tue, 31 Jan 2012 18:59:02 +0000 (19:59 +0100)]
doc: add VTE links and resources

The vte.txt file will contain information about the terminal emulator
used by KMSCON. Our main goal is xterm-compatibility but for now it
might be easier to try to be linux-console compatible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: avoid 4KB buffers on the stack
David Herrmann [Mon, 30 Jan 2012 21:01:32 +0000 (22:01 +0100)]
pty: avoid 4KB buffers on the stack

Allocate the IO-buffer dynamically on the heap for every pty object to
avoid 4KB objects on the stack. This may not be a problem now but we
might get stack overflows later if we continue to use such huge arrays
on the stack.

This doesn't affect the runtime performance as the buffer is still
allocated only once on pty-creation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: increase input buffer size
Ran Benita [Mon, 30 Jan 2012 16:50:28 +0000 (18:50 +0200)]
pty: increase input buffer size

Increase the buffer size to match the kernel's. This should guarantee
(practically) that we read() everything queued up for us.

This speeds us up considerably when running something like
$ find /
Such a process spends most of its time blocking on write() waiting for
us. By increasing the buffer size we avoid repeated
read pty -> draw screen -> read pty
cycles, which take most of our time.

To time it, before:
real  0m22.588s
user  0m00.000s
sys   0m00.020s

After:
real  0m00.680s
user  0m00.023s
sys   0m00.000s

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agokbd: correctly initialize refcount
Ran Benita [Sat, 28 Jan 2012 19:51:40 +0000 (21:51 +0200)]
kbd: correctly initialize refcount

The ->ref field was always zero and so the object was never released.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: fix invalid read from uninitialized memory
Ran Benita [Sat, 28 Jan 2012 19:21:44 +0000 (21:21 +0200)]
xkb: fix invalid read from uninitialized memory

The memset was missing a sizeof(..) multiplication.

Really the entire function is more complex than need be, so simplify it.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoRemove TODO
David Herrmann [Sun, 29 Jan 2012 16:10:51 +0000 (17:10 +0100)]
Remove TODO

The TODO is now located in the wiki at github.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: handle keyboard "return"/linefeed
David Herrmann [Sun, 29 Jan 2012 13:51:35 +0000 (14:51 +0100)]
vte: handle keyboard "return"/linefeed

This makes the VTE subsystem emulate a linefeed if XK_Return is read
from the keyboard.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: use UTF8 state machine
David Herrmann [Sun, 29 Jan 2012 13:23:27 +0000 (14:23 +0100)]
terminal: use UTF8 state machine

This adds a converter from UTF8 stream to UCS4 data so the VTE subsystem
can handle the input correctly without complicated UTF8 input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: change callback parameters to "const xy"
David Herrmann [Sun, 29 Jan 2012 13:22:48 +0000 (14:22 +0100)]
pty: change callback parameters to "const xy"

There is no reason to allow the callbacks to modify our internal data so
make it constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_buffer: add utf8 state machine test
David Herrmann [Sun, 29 Jan 2012 13:21:19 +0000 (14:21 +0100)]
test_buffer: add utf8 state machine test

Add trivial test to show how to use the utf8 state machine.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agounicode: add utf8 state machine
David Herrmann [Sun, 29 Jan 2012 13:19:49 +0000 (14:19 +0100)]
unicode: add utf8 state machine

The state machine is used to convert a stream of UTF8 data into UCS4
characters. It is slightly based on the machine found in the
wayland-compositor demos.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovte: handle keyboard input (stub)
David Herrmann [Sat, 28 Jan 2012 21:14:20 +0000 (22:14 +0100)]
vte: handle keyboard input (stub)

Make the vte subsystem handle the keyboard input instead of doing this
inside of test_terminal.

The handling is just a stub function. No actual keys are parsed yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: add header protection
David Herrmann [Sat, 28 Jan 2012 17:08:10 +0000 (18:08 +0100)]
console: add header protection

The header was missing a #ifndef to protect against multiple inclusions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: remove unneeded variable in setup_child
David Herrmann [Sat, 28 Jan 2012 16:43:26 +0000 (17:43 +0100)]
pty: remove unneeded variable in setup_child

We can use "ret" instead of "saved_errno" here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: move fork_pty_child to setup_child
David Herrmann [Sat, 28 Jan 2012 16:35:43 +0000 (17:35 +0100)]
pty: move fork_pty_child to setup_child

The name fork_pty_child was misleading. It doesn't fork at all but
instead sets up the child's environment.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: avoid FIONREAD ioctl
David Herrmann [Sat, 28 Jan 2012 16:23:49 +0000 (17:23 +0100)]
pty: avoid FIONREAD ioctl

This ioctl is really not needed and performs needles kernel context
switches. We can simply read into our buffer without checking how many
data is available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: buffer data between pty and child
David Herrmann [Sat, 28 Jan 2012 16:17:20 +0000 (17:17 +0100)]
pty: buffer data between pty and child

If the child returns EWOULDBLOCK on write we need to save the input in a
buffer to avoid loosing data. We need to work in non-blocking mode to
avoid UI hangs so we simply use the new ring-buffer object to store
data.

This also changes the callback behavior. The pty is no longer closed
implicitely so the owner must call pty_close now even if the close
callback is called. This avoids circular callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdd ring buffer object
David Herrmann [Sat, 28 Jan 2012 16:16:37 +0000 (17:16 +0100)]
Add ring buffer object

The new ring buffer object will be used to buffer a byte-stream between
two sockets.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: merge input and close callbacks
David Herrmann [Sat, 28 Jan 2012 13:03:52 +0000 (14:03 +0100)]
pty: merge input and close callbacks

There is no reason to keep two callbacks as the caller always registers
both. Hence, we can use a shared callback. Reading length 0 means closed
like reading from an fd.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal, pty: pass eloop reference on obj creation
David Herrmann [Sat, 28 Jan 2012 12:56:13 +0000 (13:56 +0100)]
terminal, pty: pass eloop reference on obj creation

There is no reason to pass the eloop reference late at terminal/pty
open. If we pass it early on object creation we will always have a valid
reference and can remove several code paths.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: move output_cb to input_cb
David Herrmann [Sat, 28 Jan 2012 12:45:06 +0000 (13:45 +0100)]
pty: move output_cb to input_cb

The output_cb handles output from the pty but it actually makes more
sense to call it input_cb as we are handling input to our console here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: move pty_input to pty_write
David Herrmann [Sat, 28 Jan 2012 12:44:25 +0000 (13:44 +0100)]
pty: move pty_input to pty_write

pty_write actually makes more sense as we are writing to the other end
and not reading input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: fix style issue
David Herrmann [Sat, 28 Jan 2012 12:43:09 +0000 (13:43 +0100)]
pty: fix style issue

Fix small indentation style issue.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: merge fork_pty and pty_spawn
David Herrmann [Sat, 28 Jan 2012 12:22:44 +0000 (13:22 +0100)]
pty: merge fork_pty and pty_spawn

pty_spawn was just a short wrapper so we can merge both into one
function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agopty: unblock all signals before exec'ing the child
Ran Benita [Mon, 23 Jan 2012 16:16:09 +0000 (18:16 +0200)]
pty: unblock all signals before exec'ing the child

When we register signals in the eloop we also block them in our signal
mask. The signal mask is inherited by the child. Therefore, if the child
does not reset its mask (e.g. bash and most normal processes), it will
not receive any of the signals that we handle. So for example C-c
(SIGINT) does nothing in the child process.

We now unblock all signals before we exec the child.

It's also worth noting that if we _ignore_ a signal -
sigaction(SIG_IGN) - this is also inherited and we must reset it to
default. However, we do not ignore signals so this is unneeded.

Here is some more discussion on signalfd and this problem:
https://lwn.net/Articles/415684/

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agokbd-dumb: fix log_warning -> log_warn
David Herrmann [Sat, 28 Jan 2012 11:38:11 +0000 (12:38 +0100)]
kbd-dumb: fix log_warning -> log_warn

We recently moved log_warning to log_warn and I forgot to fix it when
merging the kbd-dumb backend. Fix this now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: fix out-of-tree build and distcheck
Ran Benita [Fri, 27 Jan 2012 10:04:51 +0000 (12:04 +0200)]
build: fix out-of-tree build and distcheck

The paths can be off when building out of tree, so have make put them in
for us instead. This requires turning the straight genshader.c file to a
template.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agokbd: add a new "dumb" keyboard backend
Ran Benita [Tue, 17 Jan 2012 22:09:16 +0000 (00:09 +0200)]
kbd: add a new "dumb" keyboard backend

This commit adds a very simple keyboard backend which does basic keycode
interpretation. It is used as a fallback when xkbcommon is unavailable
or is not required.

See the file header for what is supported.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agobuild: depend on xproto explicitly
Ran Benita [Tue, 17 Jan 2012 22:03:16 +0000 (00:03 +0200)]
build: depend on xproto explicitly

Currently it's required by xkbcommon. However, we will need it for other
backends as well, even with xkbcommon support disabled.

xproto consisted only of static header files. We use the XK_ keysym
definitions. It is therefore only required during compilation and we
shouldn't needlessly duplicate it ourselves.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: fix merge failure
David Herrmann [Sat, 28 Jan 2012 11:14:48 +0000 (12:14 +0100)]
xkb: fix merge failure

Merging the big xkb cleanup reversed the previous modifier state change.
Fix this now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agolog: move log_warning to log_warn
David Herrmann [Tue, 24 Jan 2012 14:29:55 +0000 (15:29 +0100)]
log: move log_warning to log_warn

log_warn is much shorter and we already use log_err instead of log_error
so this is more consistent now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: use GL_RGBA when full OpenGL is used
David Herrmann [Tue, 24 Jan 2012 14:14:15 +0000 (15:14 +0100)]
context: use GL_RGBA when full OpenGL is used

GL_BGRA_EXT as internal format is not supported with full OpenGL so we
must use GL_RGBA as internal format.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: remove verbose debug messages
David Herrmann [Tue, 24 Jan 2012 14:10:16 +0000 (15:10 +0100)]
eloop: remove verbose debug messages

These dispatch debug messages are currently no longer needed and just
fill the log needlessly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_terminal: wait on children to avoid zombies
Ran Benita [Tue, 10 Jan 2012 00:52:42 +0000 (02:52 +0200)]
test_terminal: wait on children to avoid zombies

Unfortunately, there is no clean way I see to hook this up from the pty
object. We can (and will) have more than one pty object opened at a
time, but the semantics of signalfd make it impossible to deliver each
SIGCHLD to its rightful owner without complicating things.

[ From what I tested:
 - If you have two signalfd's listening to the same signal, they will be
   dispatched in some round-robin manner.
 - Also, if more than one child exits before we read signalfd (possibly
   beloging to different terminals), they will be compressed to one
    event. ]

We therefore need to do the reaping from a central location, and need to
remember to copy this snippet over to main.c in the future.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: use new pty object
Ran Benita [Fri, 13 Jan 2012 10:53:46 +0000 (12:53 +0200)]
terminal: use new pty object

Add a new terminal_open/terminal_close methods to correspond to the pty
ones, and notify when the terminal is closed.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdd pseudo terminal support
Ran Benita [Fri, 13 Jan 2012 10:42:13 +0000 (12:42 +0200)]
Add pseudo terminal support

This commit adds a new pty object.

The pty object takes care of all pseudo terminal handling, reading and
writing. It can be opened and closed, and notify through callbacks when
input arrives or the child process exits/dies. It can also receive input
and pass it along to the child process.

There is not yet any real VTE processing, so we display raw escape
codes and so on. However, this should provide immediate feedback for
any further vte development, as we start to act like a real terminal
emulator.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_input: simplify and drop xkbcommon dependency
Ran Benita [Tue, 17 Jan 2012 22:14:16 +0000 (00:14 +0200)]
test_input: simplify and drop xkbcommon dependency

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput, xkb: port to new kbd object
Ran Benita [Tue, 17 Jan 2012 21:57:11 +0000 (23:57 +0200)]
input, xkb: port to new kbd object

This commit ports the XKB handling to the new kbd interface, and makes
the input subsystem use it without any direct knowledge of XKB.

Some code is moved around but there are no functional changes.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdd skeleton for multiple keyboard handling backends
Ran Benita [Tue, 17 Jan 2012 21:12:44 +0000 (23:12 +0200)]
Add skeleton for multiple keyboard handling backends

This defines the API the keyboard backends will need to implement. It is
based on what's in input_xkb.h but cleaned up and simplified.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: add debug messages
David Herrmann [Sun, 22 Jan 2012 21:49:33 +0000 (22:49 +0100)]
font: add debug messages

Add debug messages to freetype font backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: rewrite font backend
David Herrmann [Sun, 22 Jan 2012 21:44:12 +0000 (22:44 +0100)]
font: rewrite font backend

We now properly draw fonts with OpenGL. We now use FreeType2 instead of
pango to avoid big dependencies.

We also add a DejaVu font so we currently don't have to deal with font
selection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agomath: new helper backend for linear algebra
David Herrmann [Sun, 22 Jan 2012 21:42:53 +0000 (22:42 +0100)]
math: new helper backend for linear algebra

We use this to perform proper matrix transformations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: require compositor reference
David Herrmann [Sun, 22 Jan 2012 12:51:23 +0000 (13:51 +0100)]
font: require compositor reference

To avoid cairo dependencies we now take a compositor reference in the
font backend so fonts can be drawn with GL textures instead of cairo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: fix memleak in freetype backend
David Herrmann [Sun, 22 Jan 2012 12:47:55 +0000 (13:47 +0100)]
font: fix memleak in freetype backend

We didn't unref the symbol table correctly. Fix it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: add GLES2 support
David Herrmann [Fri, 20 Jan 2012 17:11:03 +0000 (18:11 +0100)]
context: add GLES2 support

OpenGL pulls in lot of X dependencies on linux. To avoid this we also
support OpenGLES2 now. This will also allow to run kmscon on
embedded/mobile platforms.
We still get X dependencies through EGL which we cannot avoid as EGL is
compiled with multiple backends on most systems. However, switching to
GLES2 reduces memory footprint by 30MB which is pretty good.

This also enables GLES2 as default in autogen.sh. However, default
behaviour of configure will still be GL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: use BGRA_EXT texture internally
David Herrmann [Fri, 20 Jan 2012 17:07:52 +0000 (18:07 +0100)]
context: use BGRA_EXT texture internally

Some GLES2 implementations do not support RGBA so use BGRA internally,
too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: warn on shader creation error
David Herrmann [Fri, 20 Jan 2012 16:15:18 +0000 (17:15 +0100)]
context: warn on shader creation error

If we cannot allocate a shader object we should write a message to the
log.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: first initialize EGL then find functions
David Herrmann [Fri, 20 Jan 2012 15:52:58 +0000 (16:52 +0100)]
context: first initialize EGL then find functions

We should first create a GL context before we try to find GL functions
to avoid errors on some platforms.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: use GL_TRIANGLES instead of GL_QUADS
David Herrmann [Fri, 20 Jan 2012 15:11:30 +0000 (16:11 +0100)]
context: use GL_TRIANGLES instead of GL_QUADS

GL_QUADS may actually be not supported on some embedded platforms so we
use GL_TRIANGLES.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: use GL_BGRA_EXT to avoid undeclared exts
David Herrmann [Fri, 20 Jan 2012 15:01:30 +0000 (16:01 +0100)]
context: use GL_BGRA_EXT to avoid undeclared exts

GL_BGRA is not declared on older systems so we use the extension
constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: fix wrong GL func declaration
David Herrmann [Fri, 20 Jan 2012 14:58:50 +0000 (15:58 +0100)]
context: fix wrong GL func declaration

I copied the wrong declaration. This fixes this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: replace GL functions with new context subs
David Herrmann [Fri, 20 Jan 2012 14:52:54 +0000 (15:52 +0100)]
terminal: replace GL functions with new context subs

We should use the context of the compositor instead of directly calling
the GL functions to avoid direct dependencies.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: don't fill events purely for modifiers
Ran Benita [Wed, 18 Jan 2012 16:54:48 +0000 (18:54 +0200)]
xkb: don't fill events purely for modifiers

We have no use for Control_L or Alt_R by themselves, the information is
in the "mods" field.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoterminal: also unref the idle object
Ran Benita [Tue, 10 Jan 2012 22:43:01 +0000 (00:43 +0200)]
terminal: also unref the idle object

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: use new drawing pipeline
David Herrmann [Fri, 20 Jan 2012 14:45:58 +0000 (15:45 +0100)]
console: use new drawing pipeline

Instead of drawing with fixed-function GL pipeline we now use our own
shader for texture drawing. This also fixes test_console to no longer
depend on GL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: avoid code duplication in cairo destruction code
David Herrmann [Fri, 20 Jan 2012 14:35:32 +0000 (15:35 +0100)]
console: avoid code duplication in cairo destruction code

We can use our destruction function to avoid code duplication.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocontext: enable blend by default
David Herrmann [Fri, 20 Jan 2012 14:34:21 +0000 (15:34 +0100)]
context: enable blend by default

Enable blending by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: use UniformMatrix4fv instead of ~2fv
David Herrmann [Wed, 18 Jan 2012 18:11:14 +0000 (19:11 +0100)]
output: use UniformMatrix4fv instead of ~2fv

We use a 4x4 matrix so we should use the correct uniform handler.
Otherwise we might get errors on some GL implementations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: take reference of compositor
David Herrmann [Wed, 18 Jan 2012 17:09:08 +0000 (18:09 +0100)]
console: take reference of compositor

To switch to the new drawing subsystem we need a reference to a valid
compositor object so we can retrieve the GL context.
This also applies to the terminal object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_output: use new drawing pipeline
David Herrmann [Wed, 18 Jan 2012 14:54:59 +0000 (15:54 +0100)]
test_output: use new drawing pipeline

This converts the output test function to use the new kmscon_context for
drawing operations so we no longer depend directly on GL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: add function to draw colored vertices
David Herrmann [Wed, 18 Jan 2012 14:54:26 +0000 (15:54 +0100)]
output: add function to draw colored vertices

The new function kmscon_context_draw_def() can draw colored quads to the
screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: add default shader
David Herrmann [Wed, 18 Jan 2012 14:52:45 +0000 (15:52 +0100)]
output: add default shader

Besides the texture shader this also adds a second shader (def/default)
which is used to draw arbitrary colored vertices to the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: add function to retrieve context
David Herrmann [Wed, 18 Jan 2012 13:01:42 +0000 (14:01 +0100)]
output: add function to retrieve context

Allow other subsystems to retrieve the context of a compositor. The
context has no reference count as it is tied to the compositor.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: add shader support
David Herrmann [Tue, 17 Jan 2012 14:19:43 +0000 (15:19 +0100)]
output: add shader support

To avoid the fixed function pipeline we should use shaders instead of
old glBegin/glEnd. This patch adds two basic shaders and functions that
load and initialize them.

To avoid loading the shaders at runtime we generate a source file which
contains them as strings so they are embedded in the binary.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: move EGL/GL calls into separate header
David Herrmann [Mon, 16 Jan 2012 16:37:42 +0000 (17:37 +0100)]
output: move EGL/GL calls into separate header

This splits off all EGL/GL calls into output_context.c. This way we can
replace the backend of the drawing functions very easily.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: remove *_get_fd
David Herrmann [Wed, 11 Jan 2012 14:28:06 +0000 (15:28 +0100)]
output: remove *_get_fd

There is no need to retrieve the fd of the compositor as we now have an
eloop subsystem which takes care of event handling.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: add header protection
David Herrmann [Wed, 11 Jan 2012 14:25:20 +0000 (15:25 +0100)]
output: add header protection

output.h was missing an include-protection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agooutput: replace "DRI" with "DRM" in comments
David Herrmann [Wed, 11 Jan 2012 14:22:05 +0000 (15:22 +0100)]
output: replace "DRI" with "DRM" in comments

We work with DRM not DRI so fix the comments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agovt: add a few CLOEXEC's
Ran Benita [Sun, 8 Jan 2012 23:28:36 +0000 (01:28 +0200)]
vt: add a few CLOEXEC's

These are the only open() calls missing the flag.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput: make "us" default layout, override by env vars
Ran Benita [Sun, 8 Jan 2012 22:57:15 +0000 (00:57 +0200)]
input: make "us" default layout, override by env vars

The other layouts can be confusing.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agolog: make sure not to override errno
Ran Benita [Sun, 8 Jan 2012 22:48:39 +0000 (00:48 +0200)]
log: make sure not to override errno

This makes things easier in the common case of
<some error> -> <log error> -> <goto error handler> - <do something with
errno>

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoeloop: allow reporting error conditions
Ran Benita [Sun, 8 Jan 2012 22:47:25 +0000 (00:47 +0200)]
eloop: allow reporting error conditions

Add KMSCON_ERR, the equivalent of EPOLLERR.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoFix compiler sign-mismatch warnings
Ran Benita [Sat, 31 Dec 2011 10:39:09 +0000 (12:39 +0200)]
Fix compiler sign-mismatch warnings

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_console: fix use-after-free
Ran Benita [Sat, 31 Dec 2011 10:31:53 +0000 (12:31 +0200)]
test_console: fix use-after-free

Here's how it goes:
1. stdin reaches EOF, kmscon_eloop_rm_fd is called on stdin_fd.
2. The fd object is freed, the memory is reused in the meantime.
3. rm_fd is called again in destroy_eloop.
4. con->stdin_fd points to garbage and we get a segmentation fault.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont_pango: fix uninitialized variable
Ran Benita [Sun, 8 Jan 2012 23:14:11 +0000 (01:14 +0200)]
font_pango: fix uninitialized variable

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoa few cosmetic changes
Ran Benita [Sun, 8 Jan 2012 23:08:58 +0000 (01:08 +0200)]
a few cosmetic changes

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoUpdate README to include new dependencies
David Herrmann [Sun, 1 Jan 2012 22:39:23 +0000 (23:39 +0100)]
Update README to include new dependencies

Rework dependency list and also add new configure flags.
We also update the subsystem list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdd configure to autogen.sh
David Herrmann [Sun, 1 Jan 2012 22:27:13 +0000 (23:27 +0100)]
Add configure to autogen.sh

Use ./autogen.sh --<options> to run autogen with configure in one call.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAvoid installing doc files with "make install"
David Herrmann [Sun, 1 Jan 2012 22:26:10 +0000 (23:26 +0100)]
Avoid installing doc files with "make install"

Move all documentation into EXTRA_DIST, otherwise it gets installed systemwide.
And probably no one is interested in having the README installed in the system.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconfigure: fix debug option NDEBUG definition
David Herrmann [Sun, 1 Jan 2012 22:19:40 +0000 (23:19 +0100)]
configure: fix debug option NDEBUG definition

We currently define NDEBUG only if --<set>-debug is not specified at all. That
is, --disable-debug currently has almost no effect.
This fixes this bug and also corrects a wrong parenthesis.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: add unfinished freetype backend
David Herrmann [Sun, 1 Jan 2012 22:11:48 +0000 (23:11 +0100)]
font: add unfinished freetype backend

This is a first attempt of a freetype2 backend for the font drawing functions.
This avoids the heavy pango/cairo dependencies, although, we might lose
important font handling that pango does for us like correctly drawing combined
characters.

This is still a stub implementation. The drawing operations are not supported,
yet. Use --enable-pango during configure to enable the still working pango
backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoUpdate TODO
David Herrmann [Sun, 1 Jan 2012 22:04:13 +0000 (23:04 +0100)]
Update TODO

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agofont: move font handling into new subsystem
David Herrmann [Sun, 1 Jan 2012 17:27:09 +0000 (18:27 +0100)]
font: move font handling into new subsystem

We use a new font factory which is used to create a new font. It will later also
be used to cache fonts and select proper system fonts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoRemove kmscon_char implementation
David Herrmann [Sun, 1 Jan 2012 16:45:57 +0000 (17:45 +0100)]
Remove kmscon_char implementation

It was superceded by kmscon_symbol_t and is no longer used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdjust all code to use new kmscon_symbol_t
David Herrmann [Sun, 1 Jan 2012 16:43:57 +0000 (17:43 +0100)]
Adjust all code to use new kmscon_symbol_t

This is a big performance boost and reduces the code size quite a bit.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agounicode: provide utf8 converter
David Herrmann [Sun, 1 Jan 2012 16:42:57 +0000 (17:42 +0100)]
unicode: provide utf8 converter

Allow converting a ucs4 string into a utf8 string. Also export the default
symbol so other subsystems may use it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_buffer: add kmscon_symbol_t test
David Herrmann [Sun, 1 Jan 2012 15:52:30 +0000 (16:52 +0100)]
test_buffer: add kmscon_symbol_t test

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoAdd faster kmscon_char replacement
David Herrmann [Sun, 1 Jan 2012 15:47:06 +0000 (16:47 +0100)]
Add faster kmscon_char replacement

Instead of allocating big buffers with kmscon_char's for every character we now
reduce a single character to an integer. This integer is either the Unicode
codepoint or an ID to an internally allocated string.

The so called kmscon_symbol_t integer can now be used as if it were a classic
"char" value without bothering with combining marks etc.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agotest_terminal: add experimental input support
David Herrmann [Sat, 31 Dec 2011 16:38:46 +0000 (17:38 +0100)]
test_terminal: add experimental input support

Add input subsystem to terminal test app. This currently allows to actually
"write" to the console. There is still much to do to convert the input to proper
data but basic alphanumeric characters work for now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoconsole: add UCS4 to UTF8 conversion
David Herrmann [Sat, 31 Dec 2011 16:38:17 +0000 (17:38 +0100)]
console: add UCS4 to UTF8 conversion

Allow to create new kmscon_char objects with UCS4 input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoUpdate TODO regarding input subsystem
Ran Benita [Fri, 30 Dec 2011 21:08:42 +0000 (23:08 +0200)]
Update TODO regarding input subsystem

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput: define our own modifiers
Ran Benita [Fri, 30 Dec 2011 20:48:46 +0000 (22:48 +0200)]
input: define our own modifiers

Just a direct mapping to X modifiers for now (= Shift, Control,
Lock, Mod1-5).
This gives us more flexibility to adapt it to our needs in the future.
Also we don't have to include libxkbcommon headers just for the modifier
definitions.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput: don't use 0 to signal lack of unicode value
Ran Benita [Fri, 30 Dec 2011 20:00:07 +0000 (22:00 +0200)]
input: don't use 0 to signal lack of unicode value

0 is actually a valid unicode value, so instead we use
KMSCON_INPUT_INVALID which is not legal unicode.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoinput: shuffle headers and includes
Ran Benita [Fri, 30 Dec 2011 16:46:20 +0000 (18:46 +0200)]
input: shuffle headers and includes

Just some renames/moving/prefixing to conform to the style of the
other files.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoCorrectly set Xlib copyright headers
Ran Benita [Fri, 30 Dec 2011 16:06:32 +0000 (18:06 +0200)]
Correctly set Xlib copyright headers

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: fix group wrapping
Ran Benita [Thu, 29 Dec 2011 19:46:56 +0000 (21:46 +0200)]
xkb: fix group wrapping

- Use the number of groups we actually have instead of the maximum
  number of groups, when wrapping according to group_wrap control.

- Be careful with negative relative group actions. The group fields of
  xkb_state are all unsigned (and have a weird FIXME..), so don't use
  them directly.

- Add the grp:ctrl_shift_toggle option to the rmlvo set to also test
  locking the previous group (i.e. a negative relative group action).

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agoxkb: refactor keysym compat_init into a separate function
Ran Benita [Wed, 28 Dec 2011 20:05:47 +0000 (22:05 +0200)]
xkb: refactor keysym compat_init into a separate function

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>