947 Commits

Author SHA1 Message Date
David Herrmann
54108a2b49 shl: misc: add SHL_HAS_BITS() helper
This helper checks whether a bitmask has all the given bits set.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 12:21:10 +02:00
David Herrmann
79ef4f9505 Move grab-parsing into conf.c
We really need to clean this up and allow parsing of grabs in conf.c
again. xkbcommon is now mandatory so we can fix all the input layers to
use it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 11:23:21 +02:00
David Herrmann
a3abdfc5bc Make xkbcommon mandatory
We really need xkbcommon. There is so much stuff (including parsing of
keyboard shortcuts in conf.c) that depends on it. Therefore, we make it
mandatory now which allows us to use xkbcommon functions all over the
place.

Note that xkbcommon itself has no runtime dependencies so it is a small
self-contained library. The only reason I didn't do this ealier is that
xkbcommon has not seen a public release, yet. However, that should be done
in the near future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 10:10:50 +02:00
David Herrmann
e827ef4d6a wlt: toolkit: implement proper minimal sizes
A widget may have different constraints regarding minimal sizes and the
size it occupies. Therefore, we need to pass a hint with the minimal size
together with the prepare-resize round.

The catch-all user can then decide to resize the catch-all field until it
is big enough to hold all minimal-sizes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 00:16:57 +02:00
David Herrmann
9dc929b942 wlt: terminal: remove dead non-snap code
This code isn't needed at all. It doesn't make sense to disable snapping
so remove this dead code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:51:34 +02:00
David Herrmann
2496caaffa wlt: terminal: do not clear terminal background
We snap to terminal borders now so there is no need to clear the
background as we paint it during redraw, anyway.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:50:12 +02:00
David Herrmann
f145bd0ee5 wlt: toolkit: fix scheduling resize on widget-creation
Instead of scheduling for redraw, we have to schedule for resize as the
new widget might want to change the size constraints.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:49:24 +02:00
David Herrmann
0f04e6a86c wlt: toolkit: fix forcing redraw during unneeded resize-round
If we resize the buffers, we skip redrawing as resizing implies this.
However, if the resize-handler skips resizing because the size didn't
change, it also skips redrawing.
Hence, we add a new flag to force redrawing even if the resize-operation
is skipped. This fixes a bug where we didn't redraw during stalling resize
operations by the user.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:39:33 +02:00
David Herrmann
bf319380ef tsm: screen: fix moving cursor when scrolling during resize
If we scroll the screen during resize to keep the screen-content constant,
we should also move the cursor position. Otherwise, the application has an
inconsistent state.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:38:30 +02:00
David Herrmann
f198f28d02 wlt: terminal: snap to console-size on resize
Instead of resizing linearly, we now always resize only to the next
possible console size.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 23:01:24 +02:00
David Herrmann
d69414297c wlt: toolkit: allow widgets to control new size
This changes the prepare-resize logic to allow widgets full control of the
new size. The initial size starts at 0 and each widget can increase it.
The last widget should be a catch-all that uses all size that is available
and computes a good new size based on the requirements that the previous
widgets provided.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 22:50:38 +02:00
David Herrmann
5347c62688 tsm: screen: fix buffer-overflow when resizing and scrolling
We call screen_scroll_up() under special conditions when resizing. We
require it to allocate the lines with the new width even though we didn't
set it yet. Therefore, we need to set the width before calling it and then
adjust the height.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 21:59:45 +02:00
David Herrmann
c43d1ca722 kmscon: allow paths with --vt=<xy>
The getty variants out there (including agetty) require an relative path
to the /dev directory as argument. This is really odd but we want to be
backwards-compatible to them so we allow this, too.

--vt now accepts:
  * A positive number which is internally converted into /dev/ttyXY
  * A string that does not start with '/' or '.' which is interpreted
    relative to /dev as /dev/%s
  * Everything else is interpreted as path

This option still selects only the TTY on seat0. On all other seats we do
not use controlling TTYs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 19:13:02 +02:00
David Herrmann
c95bcdf22b shl: add shl_strtou() helper
The standard C/POSIX helpers are really ugly to use. This small helper
returns 0 on success, otherwise an error.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 18:57:40 +02:00
David Herrmann
32faedbfb4 Fix printf() specified bugs all over the code
When enabling the printf() logic for the logging subsystem, several
warnings were produced about missing or wrong specifiers. This fixes all
those occurrences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 18:01:35 +02:00
David Herrmann
17a56a24f2 tsm: unicode: do not encode invalid UTF8
We must under all conditions avoid encoding invalid UTF8. Otherwise, we
would rely on other applications to do error-recovery.
Unfortunately, this is no syntactical change but a semnatical fix as the
Unicode standard defines several codepoints which are invalid or which
must never be used in UTF8.
See the Unicode standard if you're interested in these codepoint ranges.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 17:59:36 +02:00
David Herrmann
e0d30b2283 log/llog: add gcc format checks
Add gcc attributes so the printf formats are correctly checked. This
causes a lot of warnings which will be fixed in the following commits.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 15:41:08 +02:00
David Herrmann
26fae42b0c Release kmscon-5
This is a stable release for kmscon. It includes mainly bugfixes and
cleanups. The TSM library was created out of the internal VTE layers and
mostly code-cleanups took place.
Happy testing!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon-5
2012-09-30 15:15:41 +02:00
David Herrmann
e39aa6533f test_vt: fix compilation with new allocation API
We changed the uterm API so we need to fix this test again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 15:15:06 +02:00
David Herrmann
8f3ce0d5ed Update NEWS entry
Add all important changes since kmscon-4.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-30 15:05:13 +02:00
Matthew Monaco
c6c1fa5083 build: autogen.sh cleanup
Use "set -e" to force exit on failure and convert $* to "$@".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 14:48:47 +02:00
David Herrmann
bf18799015 kmscon: add --vt=<num> option to select VT for seat0
VTs are only available on seat0 so this option does not affect other
seats. On seat0 it selects the VT that we run on. We do _not_ fall back to
another seat if it fails but disable this seat instead.

Reported-by: Matthew Monaco
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 11:49:54 +02:00
David Herrmann
a6165a03c7 conf: add INT datatype
This is very similar to the UINT datatype but allows signed values. This
will be required for the coming --vt option as default value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 11:47:42 +02:00
Scott Moreau
f612529141 wlt: toolkit: add maximize toggle functionality
Use wl_shell_surface_set_maximized() to notify the compositor that we
support being maximized now. The server actually decides whether it
resizes our window.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 10:34:00 +02:00
David Herrmann
522d2aa205 build: fix compilation if _Static_assert() is not available
I just noticed that older compiles do not support _Static_assert() so we
now check in configure.ac for it. We do not use it heavily, anyway.
Dynamic asserts are avoided entirely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 10:13:45 +02:00
David Herrmann
a284ce33d4 eloop: don't warn when removing bad fds from epoll-set
People might want to close file-descriptors before destroying the ev_fd
object if they actually have no direct control of it. For instance if used
through a library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 19:15:28 +02:00
David Herrmann
1a34c00796 wlt: terminal: forward HUP event to the caller
This forwards the PTY-HUP event to the caller so we can close the terminal
window when the client application exits.

Reported-by: Alexander Preisinger
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 19:08:41 +02:00
David Herrmann
54064096d2 tsm: vte: be less verbose about unhandled escapes
This converts a warning into a debug message to avoid spending too much
time in the logger when parsing unknown content. This speeds up "cat
/dev/urandom" by like 1000x.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 18:57:50 +02:00
David Herrmann
182d8a8145 eloop: make timerfd non-blocking
We actually allow draining a timer so we cannot be sure that a timer has
valid data that we can read. We already handle the non-blocking case
everywhere, we just missed setting this flag.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 14:29:33 +02:00
David Herrmann
f391ee24aa wlt: toolkit: repeat key events
This adds a timer that automatically repeats key-events while pressed. In
the XKB-1 protocol embedded in wayland, key-repeates are not sent for
performance reason so we have to emulate them.

It is currently unclear where to take key-repeat rates from. This will be
solved in the future, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:56:18 +02:00
David Herrmann
b3aba6f61c eloop: allow NULL for timer updates
If NULL is passed for timer udpates, we simply assume that the timer
should be disarmed and use a zeroed itimerspec.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:54:37 +02:00
David Herrmann
3f4e8a498b wlt: add some --font-* options
Copy the options from kmscon which are font-* engine, size, dpi and name.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:36:10 +02:00
David Herrmann
2c328b2300 tsm: screen: fix cleaning buffers on resize
There is some nasty bug where we do not correctly clean buffers when
resizing. So we now clear the whole offscreen region on resize to go sure
everything is clean.

Note that cells can pretty much move everywhere during their
offscreen-life so this is a quite sophisticated task to keep track which
cells are clean and which not. Therefore, simply clean all of them when
taking them on-screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:26:30 +02:00
David Herrmann
fd3816ec4d tsm: unicode: fix accessing symbol-array out of bounds
The array type used to be from glib which did that check automatically. We
now have to check explicitely that we do not access it out-of-bounds.

This fixes a nasty resizing-bug of TSM.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:13:18 +02:00
David Herrmann
090ead3bd6 tsm: unicode: fix not recreating the default-table all the time
We actually created a new table all the time which led to huge memory
leaks. We now actually use the default table if it is available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 12:11:52 +02:00
David Herrmann
de2536f4e4 wlt: toolkit: fix use after free of dp_fd
We need to keep dp_fd alive for all calls to wl_display_*(). Otherwise,
the callback will use it and access invalid memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 11:34:15 +02:00
David Herrmann
e5855f8b61 wlt: toolkit: fix sending two surface.attach() reqs in one frame
The need_frame and idle_frame logic was slightly wrong. We ended up not
correctly requesting the frame-cb after a _real_ frame-cb. Hence, the
idle-cb did simply send the next attach() request.

This fixes this small race and adds a comment how all this is supposed to
work.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 10:45:20 +02:00
David Herrmann
01c97de5bd wlt: main: increase default window size to 600x400
Current default size is pretty small and there are still some resizing
bugs so increase it to have a working terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 00:45:32 +02:00
David Herrmann
3ee5d58e4f wlt: terminal: handle keyboard events
Pass keyboard events straight through to the TSM handler.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 00:45:05 +02:00
David Herrmann
6ef6ab7aeb wlt: toolkit: add keyboard events
This implements the wl_keyboard client-side of the wayland protocol and
takes care of pushing keyboard events to the correct window.

A new callback is added to all widgets which is called when keyboard input
is sent to the specific window.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-27 00:44:44 +02:00
David Herrmann
d56f811de7 wlt: terminal: draw terminal to buffers during redraw-cb
Use the font subsystem to blit the console glyphs to the wlterm window
during redraw-callbacks.

This is mostly copied from src/terminal.c and the blitting functions from
uterm-fbdev.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 23:48:35 +02:00
David Herrmann
ddb5c42c19 wlt: load font modules during startup
We need the text-font modules to render fonts in wlterm. Therefore, load
all the font modules during startup before initializing the application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 23:47:12 +02:00
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