121 Commits

Author SHA1 Message Date
Ran Benita
9b75aa0b9d 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>
2012-01-23 13:49:41 +01:00
Ran Benita
7cf93b8930 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>
2012-01-23 13:44:07 +01:00
David Herrmann
629221b060 font: add debug messages
Add debug messages to freetype font backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22 22:49:33 +01:00
David Herrmann
5a3801386a 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>
2012-01-22 22:44:12 +01:00
David Herrmann
0b320653d8 math: new helper backend for linear algebra
We use this to perform proper matrix transformations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22 22:42:53 +01:00
David Herrmann
e5f5c2729a 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>
2012-01-22 13:51:23 +01:00
David Herrmann
0f6c75637f 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>
2012-01-22 13:47:55 +01:00
David Herrmann
b860e485b4 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>
2012-01-20 18:11:03 +01:00
David Herrmann
67d0b75640 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>
2012-01-20 18:07:52 +01:00
David Herrmann
32e869b99f 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>
2012-01-20 17:15:18 +01:00
David Herrmann
fd390c6043 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>
2012-01-20 16:52:58 +01:00
David Herrmann
7085084b1d 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>
2012-01-20 16:11:30 +01:00
David Herrmann
a10af939fa 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>
2012-01-20 16:01:30 +01:00
David Herrmann
2df4692df1 context: fix wrong GL func declaration
I copied the wrong declaration. This fixes this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20 15:58:50 +01:00
David Herrmann
c96b0ffac3 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>
2012-01-20 15:52:54 +01:00
Ran Benita
e0a1902616 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>
2012-01-20 15:49:09 +01:00
Ran Benita
32e622f8f2 terminal: also unref the idle object
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20 15:48:27 +01:00
David Herrmann
83cec439c6 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>
2012-01-20 15:45:58 +01:00
David Herrmann
84f29458e5 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>
2012-01-20 15:35:32 +01:00
David Herrmann
a422c9f370 context: enable blend by default
Enable blending by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20 15:34:21 +01:00
David Herrmann
5e0789a15b 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>
2012-01-18 19:11:14 +01:00
David Herrmann
05a1747f00 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>
2012-01-18 18:09:08 +01:00
David Herrmann
cb9ef04ec3 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>
2012-01-18 16:26:42 +01:00
David Herrmann
f3c42dd0a3 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>
2012-01-18 15:52:45 +01:00
David Herrmann
6dabf93f9b 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>
2012-01-18 14:01:42 +01:00
David Herrmann
2d71ef276c 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>
2012-01-17 15:19:43 +01:00
David Herrmann
7c7a4e32f9 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>
2012-01-16 17:37:42 +01:00
David Herrmann
a8dcede8c7 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>
2012-01-11 15:28:06 +01:00
David Herrmann
2227350145 output: add header protection
output.h was missing an include-protection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-11 15:25:20 +01:00
David Herrmann
88f6e93095 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>
2012-01-11 15:22:05 +01:00
Ran Benita
0fc69a4ca5 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>
2012-01-11 13:32:04 +01:00
Ran Benita
01698145a7 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>
2012-01-11 13:31:03 +01:00
Ran Benita
86ec128d91 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>
2012-01-11 13:28:47 +01:00
Ran Benita
e823d283c5 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>
2012-01-11 13:28:12 +01:00
Ran Benita
0d0cac0ad1 Fix compiler sign-mismatch warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-09 20:20:58 +01:00
Ran Benita
993b7386d7 font_pango: fix uninitialized variable
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-09 20:20:58 +01:00
Ran Benita
58b9f1fdb6 a few cosmetic changes
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-09 20:20:58 +01:00
David Herrmann
319aae35c9 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>
2012-01-01 23:11:48 +01:00
David Herrmann
c203b3a83d 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>
2012-01-01 18:27:09 +01:00
David Herrmann
4c236e110b 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>
2012-01-01 17:45:57 +01:00
David Herrmann
a7128cc683 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>
2012-01-01 17:43:57 +01:00
David Herrmann
4eca3ef714 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>
2012-01-01 17:42:57 +01:00
David Herrmann
39f90a4536 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>
2012-01-01 16:47:06 +01:00
David Herrmann
af9ab4197c 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>
2011-12-31 17:38:17 +01:00
Ran Benita
8d28790ba4 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>
2011-12-31 16:53:54 +01:00
Ran Benita
7c9fb7bf29 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>
2011-12-31 16:52:22 +01:00
Ran Benita
c3912b23a2 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>
2011-12-31 16:50:52 +01:00
Ran Benita
bb499f7513 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>
2011-12-31 16:29:58 +01:00
Ran Benita
83b95f643f 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>
2011-12-31 16:28:31 +01:00
Ran Benita
2b540610e4 input: fix formatting
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31 16:27:45 +01:00