980 Commits

Author SHA1 Message Date
David Herrmann
1f11f8c961 tsm: screen: introduce scrollback-buffer line IDs
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>
2012-10-05 13:24:58 +02:00
David Herrmann
e2f614ab1a tsm: screen: remove unused get_from_scrollback()
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>
2012-10-05 13:22:43 +02:00
David Herrmann
5f53f2576a wlt: theme: fix bug in pointer-location computation
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>
2012-10-05 13:21:12 +02:00
David Herrmann
5f1af984d7 build: print (GEN) during genshader/unifont creation
Use the automake silent-rules feature to suppress unused messages.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-05 13:20:24 +02:00
David Herrmann
ed66487a4b wlt: add --grab-zoom-in/out command-line options
These options allow to modify the hard-coded shortcuts for font zooming.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-02 13:46:47 +02:00
David Herrmann
1072b8cb76 wlt: terminal: zoom font on ctrl+plus/minus
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>
2012-10-02 13:39:33 +02:00
David Herrmann
a610e02057 wlt: toolkit: allow zero values as new size
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>
2012-10-02 13:24:18 +02:00
David Herrmann
6bf4723b04 terminal: perform hard-reset on exit
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>
2012-10-02 13:02:44 +02:00
Zbigniew Jędrzejewski-Szmek
bf3415c5b4 build: fix linking for kmscon_font_*
We need to link text-font to kmscon-core as we use it heavily in the
terminal layers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-02 12:55:18 +02:00
Zbigniew Jędrzejewski-Szmek
df52ae27f5 build: actually make use of pkg-config info about xbkcommon
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>
2012-10-02 12:54:21 +02:00
David Herrmann
4679bde07e wlt: toolkit: make fullscreen overwrite maximized mode
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>
2012-10-01 17:45:46 +02:00
David Herrmann
911ae1af88 wlt: theme: do not draw decorations in fullscreen mode
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>
2012-10-01 17:38:07 +02:00
David Herrmann
6a8ab57e48 wlt: terminal: do not snap to grid-size on fullscreen-mode
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>
2012-10-01 17:21:27 +02:00
David Herrmann
ead84b9dca wlt: toggle fullscreen on F11
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>
2012-10-01 17:09:14 +02:00
David Herrmann
c28ea5c974 wlt: toolkit: notify keyboard-cbs whether a key was handled
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>
2012-10-01 17:00:58 +02:00
David Herrmann
394ee75f38 wlt: toolkit: add fullscreen helpers
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>
2012-10-01 16:55:49 +02:00
David Herrmann
0cc83df84a wlt: terminal: reset scrollback-position on user-input
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>
2012-10-01 16:42:08 +02:00
David Herrmann
c7b458df3d wlt: terminal: draw background-margin when maximized
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>
2012-10-01 15:02:54 +02:00
David Herrmann
bcb058134f wlt: terminal: use whole size when maximized
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>
2012-10-01 14:26:04 +02:00
David Herrmann
1b1ff11355 wlt: toolkit: pass flags to resize and redraw callbacks
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>
2012-10-01 14:14:28 +02:00
David Herrmann
c77e3d8c0c test_input: fix compilation with changed input API
We dropped unused modifiers so we have to fix test_input not to print them
out.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 14:07:23 +02:00
David Herrmann
639da5337b kmscon: make --switchvt work again
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>
2012-10-01 13:56:46 +02:00
David Herrmann
3b07517b13 uterm: vt: add helpers to (de)activate all VTs at once
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>
2012-10-01 13:56:06 +02:00
David Herrmann
a24b2e5478 uterm: vt: fix skipping real_activate() when being inactive
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>
2012-10-01 13:54:08 +02:00
David Herrmann
45c51695d9 uterm: vt: do not automatically activate fake-VTs
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>
2012-10-01 13:29:49 +02:00
David Herrmann
f672c98905 uterm: vt: add fake_activate() and fake_deactivate() hooks
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>
2012-10-01 13:26:51 +02:00
David Herrmann
79d2c47860 uterm: vt: return error in real_deactivate() if VT is dead
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>
2012-10-01 13:24:41 +02:00
David Herrmann
2c6a34deb9 uterm: vt: make real_activate() behave like real_deactivate()
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>
2012-10-01 13:23:38 +02:00
David Herrmann
79692f655a tsm: screen: fix out-of-bounds access when drawing sb
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>
2012-10-01 12:46:09 +02:00
David Herrmann
038aac7fd5 wlt: add --term, --login, --palette and --sb-size
These terminal options are simply copied from kmscon and behave the same
way.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 12:41:06 +02:00
David Herrmann
e5e81a0b4c wlt: add scrollback-buffer grabs
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>
2012-10-01 12:24:03 +02:00
David Herrmann
de2c0e1d85 build: add shl_misc to all its users
Even though it's just a header, we want to be safe so add it to all users.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-01 12:23:15 +02:00
David Herrmann
5b35f08aa0 uterm: input: plain: remove unused array
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>
2012-10-01 12:22:34 +02:00
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