This implements copy/paste support for the terminal widgets via the
recently introduced helpers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Two new helpers which are needed to implement copy-support. They create
data-sources and set the current selection-source. This allows widgets to
copy data for others to paste.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a new helper that returns the UTF8 encoded data of the selected
parts in the tsm-screen object.
There is still much to do and it isn't a nice solution. However, it's a
proof-of-concept and works for now so we can just keep it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Input offers are used to implement pasting data from other applications.
This adds the infrastructure to operate on data-managers and allows
applications to retrieve the currently active selection-data via a
file-descriptor.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is useful to get access to input devices from the display when only a
widget or window is available.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We used to remove dead FDs from the epoll-loop, but we should do this only
if they are no longer readable. An FD might be dead/HUP but still
readable.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If the mouse is not moved during a mouse-click, then we clear the current
selection. This can be increased to allow a short range of few pixels of
mouse-movement if required.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to draw the final character of a selection with inversed
background, too. This is a bit tricky as the selection may be inversed
itself. Therefore, we just keep a flag that tells us whether the previous
character was selected and just draw the new character also selected.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to check whether the point is left/atop of the rectangle, too.
Otherwise, the function just doesn't make sense.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This implements UI selection for the console buffer. This selection is not
to be confused with PTY application selection provided by the
mouse-protocol via VT200 protocol.
Instead, this selection allows UIs to tell the TSM layer to select a
special part of the screen. Moreover, it allows selections to go into the
scrollback-buffer and to be bigger than a single screen. The UI can even
implement scrolling during selection to allow arbitrarily big selections.
There might still be some special cases where we need to fix selection.
However, it already works pretty well.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If we have pointers somewhere into the scrollback-buffer, there is not
easy way to see which of two lines comes first. Therefore, we introduce
scrollback buffer IDs. These are unique and every line gets one assigned
when it is linked into the sb-buffer. These IDs guarantee that front lines
have lower IDs than bottom lines.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This function is not used and I do not intend to use it anywhere soon.
Therefore, remove it so it doesn't generate sparse warnings.
The only reason why I kept is was that we might want to retrieve these
when increasing window size. However, this will not be implemented in the
near future as we need to keep a buffer-fill state for it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to subtract the allocation because we get absolute pointer data as
input. This doesn't matter for the theme as long as it is the root widget,
but this might change when we introduce shadows.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now create the next bigger/smaller font on ctrl+plus/minus keyboard
input. This is currently done by integer-steps but may be changed to
smaller steps. You can currently use the DPI values to control the
step-size, even though this is an ugly hack.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If zero is passed as new size, we now simply use the current size. This
allows widgets to schedule a resize round without having to specify the
current size explicitely.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Before starting a pty on a terminal, we now perform a hard-reset to avoid
any left-overs from the previous pty.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now use xkbcommon in lots of places so add the build-flags to all
libraries and applications that use it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If *_toggle_maximized() is called while in fullscreen, we still change our
internal state, but we do not modify the application behavior in regard to
wl_shell_surface state. Instead, we stay fullscreen until it is
deactivated again.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When fullscreen mode is active, we should not draw any decorations.
Instead just skip every callback in the theme layer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If we are in fullscreen mode, we should allocate all space that is
available (like in maximized mode) instead of snapping to the next
grid-size.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a --grab-fullscreen parameter which configures the key that
toggles fullscreen. This is handled in the theme widget as we consider it
the main window-handler.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
All keyboard-cbs have to return whether they handled a key now.
Furthermore, they get as parameter a flag that notifies them whether a
previous handled already handled the key.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add helper to make a window fullscreen. Also forward the flags to all
resize and redraw handlers so widgets can changed behavior while being
fullscreen.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>