On user-input we now reset the scrollback-position so it is set to the
actualy screen again. This is normal behavior of most other terminals and
I see no reason not to do this.
If anybody requests it, we can make it easily optional via a command-line
setting.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When maximized, we might have a small margin as we do not snap to
grid-sizes. Therefore, we need to correctly draw the background color for
these margins.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We shouldn't snap to console-grid sizes when maximized. This produces
weird artifacts that are not expected by the users.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If a window is maximized, fullscreen or should be drawn without
decorations, then the widgets must be notified about it. Hence, this adds
a flags argument to resize and redraw callbacks.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new uterm-vt helpers allow us to activate or deactivate all VTs during
startup and shutdown. Use them to make --switchvt work again.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Two new helpers to activate or deactivate all VTs at once. They return the
total count of VT switches that are pending or an error code.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is probably a copy&paste error from real_deactivate(). We should skip
real_activate() if we are _active_, not if we are _inactive_.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We used to activate fake-VTs directly after they were allocated. This is
not needed anymore as we can control them directly now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This makes uterm_vt_(de)activate() forward the request to fake-VTs, too.
The fake-VTs directly forward it to the callbacks.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We used to return 0 if we don't know the VT id in real_deactivate().
However, the VT id is nowadays always known so we must return an error
instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
real_activate() has alsmost the same semantics as real_deactivate() so we
should also return -EINPROGRESS when we scheduled the VT switch. This
isn't used by kmscon currently, but may be used by other uterm users.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When drawing scroll-back buffer, we cannot guarantee that the lines are as
long as the current screen. Therefore, check that we aren't accessing out
of bounds and draw empty glyphs instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This copies the grabs from kmscon over to wlterm. It is now possible to
scroll up and down in the scrollback-buffer if you manually increase the
buffer size.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We do not parse num-lock anymore, so remove the unused array. GCC didn't
warn about it, which is weird, but it's definitely not needed, anymore.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>