905 Commits

Author SHA1 Message Date
David Herrmann
d16f429335 wlterm: add hard-dependency to xkbcommon
wlterm needs xkbcommon as the wayland protocol depends on XKB states.
Hence, we add a hard-dependency for wlterm.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 23:45:02 +02:00
David Herrmann
b87b6555e8 pty: remove useless debug message
Remote pty debug message about resizing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 22:45:38 +02:00
David Herrmann
5117852e75 text: add helpers to (un)load all modules at once
Instead of doing all this in main() we now use the two helpers. This makes
the code much more readable and avoids too many stuff in main().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 22:00:01 +02:00
David Herrmann
f40c6eaf32 build: build text_font subsystem as separate static library
We want to use the font-rendering layer in wlterm so we need to split this
out. Gladly, the layer has only a build-time dependency on uterm and not
other hard-coded stuff. That is, we have no cleanup to do.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 21:54:37 +02:00
David Herrmann
6e5eb4f92f wlt: terminal: add TSM and PTY objects
Create TSM screens and VTE objects plus a PTY and connect everything so we
have a working terminal. Keyboard input still needs to be hooked up and
the drawing functions aren't implemented, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 21:39:15 +02:00
David Herrmann
27fa6c3310 wlt: toolkit: add wlt_window_get_eloop() helper
This helper allows widgets to retrieve the eloop that is used by the
window. Otherwise, we couldn't dispatch events there.
No refcounting is needed as all widgets are destroyed before the window is
destroyed. Other users need to perform ref-counting by themself.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 21:38:00 +02:00
David Herrmann
89cb239fce pty: set argv via helper function
This makes the pty layer independent of kmscon global state. This allows
us to use it in other applications bundled with kmscon. There is still
some work to do to make it fully independent so we can integrate it into
TSM. But that's not really needed, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 21:24:34 +02:00
David Herrmann
9c48153e30 pty: set "TERM" via helper function instead of kmscon_conf
Instead of accessing global state, we now set the TERM value via a helper
function. This is needed to make the pty layer independent of kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 19:25:35 +02:00
David Herrmann
a7f871dcfb wlt: theme: fix calculating window size regarding buttons
We need to avoid reducing window size beyond our minimal width used to
draw buttons.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 19:12:16 +02:00
David Herrmann
f9de068a09 build: update autotools logic and add "wlterm" application
Sorry for the big commit, but I was working on the wlterm application and
then thought I can rework the whole configure-logic again. This mainly
renames all build-defines to BUILD_DEFINE_* and BUILD_HAVE_* and allows
specifying which applications to build via --enable-kmscon/--enable-wlterm
and similar.

wlterm is a new application which is a native wayland client with no
external dependencies. It serves several purposes:
  * It uses TSM (not yet implemented, but will come soon) to create a
    console independent from kmscon. This shows how TSM can easily be used
    to create independent terminal emulators.
  * It is a native wayland application (probably the first independent
    wayland app so far?) and is used to test how well the wayland API
    works. As wayland is still under heavy development, we need more
    application-writers who report back whether the wayland-API makes
    sense to them and whether it works correctly.
  * A proper terminal-emulator for wayland! There is currently no proper
    emulator so we really need something that we can work with.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 18:56:41 +02:00
David Herrmann
f2081c84ee conf: remove uterm depedency
We move the GRAB type into kmscon-main.c to avoid any uterm dependency in
the conf subsystem. It is still open how we can better handle the
key-parser without a valid uterm_input object, but when there will be a
xkbcommon release, we can hopefully add a hard depedency to it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-24 21:57:23 +02:00
David Herrmann
6b500b39e9 main: pick up non-FBDEV_DRM devices without --fbdev
Now that we can differentiate between fbdev-DRM and normal fbdev devices,
we can just pick up the normal fbdev devices by default.

--fbdev now makes kmscon use the FBDEV_DRM devices instead of pure DRM.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-21 14:31:27 +02:00
David Herrmann
02ddaaeb9f uterm: monitor: mark DRM-fbdev devices as such
Most DRM drivers also provide a legacy fbdev device so fbcon can pick it
up (and more importantly, we get kernel panics on it). However, as an
application developer, I don't want to use two devices which drive the
same physical hardware.

This marks all such DRM fbdev devices as FBDEV_DRM so kmscon doesn't pick
them up automatically.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-21 14:25:10 +02:00
David Herrmann
ed969b99a8 uterm: video: ignore NULL buffers in vector requests
When multiple requests are pushed into the video backends at once, we
should ignore NULL buffers. Otherwise, users might have to re-order
buffers just so we don't segfault. Instead, we now ignore them and the
application can set requests to NULL to signal us that it is unused.

This fixes some bugs with multi-monitor setups and kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-21 13:20:21 +02:00
David Herrmann
d8620f05c1 uterm: video: fbdev: disable double buffering
Kernel fbdev drivers are really broken in respect to virtual framebuffer
sizes. They all report success when allocating and even mmap()'ing them
but memory access will result in SIGBUS or even SIGSEGV.

Therefore, we disable it by default now. We might consider re-enabling it,
but there is really no need to work too much on fbdev backends.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-21 13:17:43 +02:00
David Herrmann
be4cd8edd0 test_key: add small helper for client-side key-input
We sometimes need to test what keys a client receives when specific keys
are pressed. This small helper simply runs in a terminal and receives raw
keyboard input and prints it to stdout with debugging information.

This can definitely be improved with the help of the TSM state-machine to
print more useful information and directly parse the input. However, this
is better than nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-20 13:16:32 +02:00
David Herrmann
abde919bbd pty: set VERASE character to backspace during setup
Some crazy guy decided to set VERASE to DEL by default in the kernel. So
when starting an application which does not initialize the terminal on
startup, they may not notice that we actually send BACKSPACE as
erase-character (like /bin/login). Therefore, initialize VERASE to 010 so
everyone is happy.

Thanks to Etam for reporting this!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-19 21:13:48 +02:00
David Herrmann
e1f04b12ab tsm: vte: send original VT220 escape codes for Shift+F1 to F12
Nearly all terminals behave differently regarding Shift+FX keys. We now
mimic the behavior of the classic VT220 instead of the new-style function
keys. Nearly all applications expect the old codes.

This might be changed in the future, though. It does make much more sense
to send the new codes as they provide more information to the application.
And remappings should be done via XKB instead of inside of kmscon.
However, as long as xkbcommon does not have a config-file, we will be
stuck with this little hack.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-19 20:27:48 +02:00
David Herrmann
38759fed14 docs: add systemd kmscon unit
This is a very basic unit that can start kmscon with a login shell. We may
have to improve it to replace agetty/etc fully, but it is a good start.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 20:41:55 +02:00
David Herrmann
b5aa89f4ac pty: remove public eloop dependency
We now create an eloop object internally to avoid requiring public eloop
headers. Functionality is still the same but now hidden in the library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 19:22:09 +02:00
David Herrmann
a1a590dd47 tsm: vte: convert to use llog
Instead of using kmscon log_* functions, we now use the independent llog
subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 19:21:28 +02:00
David Herrmann
8d44f672c8 build: make libtsm build separately
This builds libtsm as separate library so we can use it in other projects,
too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 17:58:35 +02:00
David Herrmann
a0a8be1c0a tsm: vte: introduce own modifiers
We do not want to depend on uterm just for the modifiers so introduce new
modifier-names which are in-sync with the UTERM names.

Inside of kmscon we still use the UTERM names everywhere, but inside of
TSM we now rely on the new names.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 17:36:29 +02:00
David Herrmann
25dcee52f5 tsm: vte: remove unused keyboard-action enum
This enum is no longer used to remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 17:34:55 +02:00
David Herrmann
1d764ebfbc tsm: add *_set_palette() helper
Instead of accessing kmscon-state we now add a helper to select the
palette and make the terminal-subsystem use it on initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 17:25:34 +02:00
David Herrmann
62e720e069 tsm: vte: rename kmscon_vte object to tsm_vte
Perform final rename of the remaining vte objects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:59:39 +02:00
David Herrmann
67cd0ef3a7 tsm: rename files
Rename all TSM files to have a tsm_* prefix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:54:25 +02:00
David Herrmann
93c5d61a05 tsm: vte: move vte layer to tsm_vte_*
This pushes the whole VTE layer into TSM and performs the huge rename
which turned out to be quite easy to accomplish.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:37:17 +02:00
David Herrmann
2f7bb5a57f terminal: drain timer after wakeup
Use the new timer_drain() helper to reset the timer after waking up.
Otherwise, we get spurious warnings that the CPU is too slow.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:24:48 +02:00
David Herrmann
d3a0358797 eloop: add ev_timer_drain() helper
This helper reads the current expiration-count from a timer. This can be
used when waking up from an idle-period or similar to reset the timer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:24:06 +02:00
David Herrmann
0cf2f8efbd tsm: screen: switch to llog
We already have an llog context so use it instead of relying on kmscon-log
subsystem. TSM-screen is now fully independent. Next step is TSM-vte.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 16:04:03 +02:00
David Herrmann
3e71989955 tsm: screen: introduce TSM_SCREEN_OPT_RENDER_TIMING
Instead of accessing kmscon state from TSM, we now introduce options to
control the behavior of TSM-screens. Apart from logging, TSM is now
independent of any kmscon state/code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 15:58:54 +02:00
David Herrmann
0ee83010ff tsm: screen: add screen-options helpers
Allow setting global options for screen objects. These are different from
flags as the latter affects the state-machine but options affect global
operation modes.

Options should be set by the application while flags are set by the VTE
handler. The latter might change often, while options should be set on
startup and then remain mainly constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 15:54:31 +02:00
David Herrmann
64635943d2 build: fix build without uterm-keysyms.h
uterm-keysyms.h is no longer available but the makefile still references
it. Remove all occurrences of it to fix build again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 15:53:07 +02:00
David Herrmann
e638e6f039 tsm: add tsm_log_t llog-compatible log object
We need to avoid logging to stderr directly in TSM so introduce the
tsm_log_t object similar to eloop.h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 15:01:45 +02:00
David Herrmann
613e7e7000 tsm: screen: move filenames to tsm_screen.[ch]
All TSM files use the "tsm_*" prefix and the object is now named "screen"
so rename the files to resemble this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:53:46 +02:00
David Herrmann
f919b3ad81 tsm: fix header comments
Remove "kmscon" from any TSM headers and replace it by "tsm".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:50:02 +02:00
David Herrmann
efb210469d console: rename prefix to tsm_screen_*
This is part of the TSM library creation. We also rename "console" to
"screen" as this layer actually manages the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:49:20 +02:00
David Herrmann
32fec77420 tsm: unicode: remove tsm_symbol_get_u8()
This is no longer used. You should first retrieve the UCS4 string and then
use the UCS4 to U8 conversion helpers instead.

All users have already been converted so we can remove this helper safely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:12:28 +02:00
David Herrmann
c63330d9e9 terminal: don't include tsm_unicode.h
This is not needed. And we want to avoid any dependencies to this layer
wherever possible.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 13:47:19 +02:00
David Herrmann
f2c1dd77ff text: pass symbol-data directly into text layer
Instead of converting symbols into UCS4 string in each backend, we now
pass the whole data from the console layer into the renderers.

This makes all renderers indepedent of any recently introduced
symbol-tables and they can be implemented inside of TSM without exporting
them. However, we still need to pass the IDs to the text layer. The text
layer must not use them for anything but identification. Moreover, it must
never assume that they are valid tsm_symbol_t values.
We do this so the backends can still have fast hashtable lookups rather
than allocating big keys containing the UCS4 string+length and using these
for lookups.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 13:46:44 +02:00
David Herrmann
57928f5df0 tsm: unicode: add helper for ucs4->u8 string conversions
This small helper allocates a string big enough to hold the whole u8
string. This should be used for short and temporary strings only! It
allocates way to much memory for bigger or long-living strings.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 13:41:17 +02:00
David Herrmann
69259c8d64 build: make xkbcommon built-time dependency
We really need xkbcommon-keysyms.h for building kmscon/uterm/TSM/etc.
However, the recent fix was ugly and didn't really help. Instead we copy
the keysyms file into external/xkbcommon/ so we can just include the real
xkbcommon files from any source but have a fallback in external/.

Hence, you can still build kmscon without xkbcommon with this fallback,
but this will be removed the first day when xkbcommon sees a public
release.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 12:29:06 +02:00
David Herrmann
c15604b6b7 tsm: unicode: fix error-path in tsm_symbol_append()
We never checked the memory helpers for errors because they used to be
from glib. However, with our own helpers we need to check for errors to be
sure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 12:17:41 +02:00
David Herrmann
0273802809 shl: hashtable: add shl_hashtable_remove() helper
This adds a helper that removes entries from a hashtable. This hasn't been
needed, yet, so we never provided it. However, the new unicode-helpers
will need it for proper error recovery.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 12:14:53 +02:00
David Herrmann
372948af53 tsm: unicode: add symbol-table helpers
Add three helpers to create and manage symbol-tables. Also fix internal
default-table to use them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 12:03:17 +02:00
David Herrmann
da51fe1589 tsm: unicode: merge tsm_symbol_get() into table__get()
We do not do locking in tsm anymore so we can remove the table__get()
helper.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 11:48:02 +02:00
David Herrmann
4af046d39d tsm: unicode: export tsm_ucs4_to_utf8()
This helper function may be useful to other external code and allows us to
always return UCS4 strings. Other code can then use this helper to convert
it into UTF8.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 11:39:08 +02:00
David Herrmann
d5a0c9644c tsm: unicode: add symbol-table contexts
We should avoid any global state in shared libraries. As the TSM code is
becoming a shared library, we definitely need contexts for symbol tables.
However, we don't want to fix up all code now so we use a default table
NULL instead.

This can be fixed later but is ok for now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 11:30:38 +02:00
David Herrmann
52d2eb09b1 tsm: unicode: remove log_* calls
The logging-layer is not a dependency of TSM so we cannot use it. It is
also not needed anymore, as the unicode-layer is working pretty well.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 11:04:50 +02:00