1019 Commits

Author SHA1 Message Date
David Herrmann
92386e24dd terminal: reopen terminal on HUP if no callback is given
If the caller didn't pass a callback to be called on HUP, we now
automatically reopen the terminal as default behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-10 21:24:35 +02:00
David Herrmann
e2266c9986 kmscon: move kmscon_main.h to kmscon_conf.h
Everything in this header is solely related to configuration parsing so we
should name it properly. We will also move the configuration-handling from
kmscon_main.c to kmscon_conf.c in some of the next commits to clean up
kmscon-main.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-10 21:23:38 +02:00
Detlef Riekenberg
774d22711f build: do not list xkbcommon as optional
The variable xkbcommon_enabled was no longer nedded
after removing xkbcommon from the build configuration notice.

Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-10 17:35:15 +02:00
David Herrmann
990881fa87 uterm: input: fix passing the correct keycode to get_ascii()
We need to pass the +8 shifted codes instead of the real hardware codes as
XKB needs these for X11 legacy reasons.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 16:17:12 +02:00
David Herrmann
6648029d5f test_input: fix using XKB directly
We removed a lot of helpers from uterm-input because XKB is now a
mandatory dependency. So use it directly from test_input to avoid all the
uterm helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:56:30 +02:00
David Herrmann
1709c64ee6 Prefix kmscon sources with kmscon_*
We will be adding more applications to this repository, so to keep better
overview, we prefix kmscon sources with kmscon_*.

The only sources that have no prefix are either shared between
applications (i.e., statically linked) or they were not cleaned up, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:53:55 +02:00
David Herrmann
a17aa99ff9 kmscon: add --xkb-repeat-rate/delay command-line arguments
These new arguments allow changing the xkb-repeat settings for kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:23:09 +02:00
David Herrmann
cbff71f6e2 uterm: input: implement software key-repeat
To allow users to specify key-repeat rates/delays, we now implement
software key-repeat. This is mostly copied from wlt_toolkit.c which
already does this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:12:02 +02:00
David Herrmann
998a43455b uterm: vt: reset KBMODE to K_UNICODE if it was K_OFF
If we switch to a VT that has KBMODE set to K_OFF, we do not set it back
to K_OFF when leaving, instead, we set it to K_UNICODE. This allows
recovering when kmscon died by simply restarting kmscon.

There is really no need to let a VT stay in K_OFF! This causes the user to
be stuck at this VT and use the sysrq (if enabled) keys to recover.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 13:10:02 +02:00
David Herrmann
d2f8089ecb shl: misc: add shl_dup() helper
shl_dup() duplicates a memory region similar to strdup() but without
reading the data length via strlen().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 12:51:27 +02:00
David Herrmann
33ebc01441 tsm: vte: use ASCII keysyms for ctrl+<XY> shortcuts
If a user has multiple active XKB layouts but only one of them has ASCII
keysyms on the base level, then ctrl+<XY> might actually never work,
because these keys aren't available in the current layout. This patch
tries to find a layout of the user that actually _has_ ascii keysyms on
the base level and passes this information along with the normal keysym
information.

The TSM layer can now use this ascii keysym instead of the normal unicode
keysym to handle ctrl+<XY> shortcuts. This is the same way xterm et. al.
handle this, so it seems to be a good idea to do this in TSM, too.

Reported (and mainly written) by Ran Benita.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 12:30:40 +02:00
David Herrmann
0a03785ffc uterm: input: add support for multiple keysyms
xkbcommon supports reporting multiple keysyms per key-event. There is no
keymap which uses this, yet. However, this feature is not meant to enhance
performance by reducing the number of calls into xkb, but instead multiple
keysyms are to be handled as one big keysym.
But there are no examples, yet, so we cannot actually perform any
conversions on them. But we can add the infrastructure for it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 11:19:30 +02:00
David Herrmann
fba4b9104b uterm: input: use uxkb directly
This changes the uterm-input infrastructure to use XKB directly instead of
using a modularized infrastructure. There is no need to use something else
anymore.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-09 10:56:00 +02:00
David Herrmann
fa566972e5 uterm: input: remove plain backend
We made xkbcommon mandatory some time ago and there is no reason to keep
this plain backend around anymore. It isn't tested at all and provides no
real advantage over xkb.
Even for debugging it is easier to use XKB.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 18:11:17 +02:00
David Herrmann
c9564108bd uterm: input: add flag to input-events marking them as handled
If multiple handlers are called on the same input-event, we must notify
handlers whether the event was already handled by a previous callback. We
push this decision to the handlers by allowing them to modify the
"handled" flag for an input event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:52:00 +02:00
David Herrmann
b2dd933cff build: inverse get_pitch/stride logic
We should use get_stride() if this check fails as this is the new
function. We use this check only for backwards-compatibility reasons but
should not require it to pass for new builds.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:36:36 +02:00
Detlef Riekenberg
4ed3e08dfe build: handle AM_PROG_AR not present in autoconf 1.11
AM_PROG_AR is a new feature since autoconf 1.12.
autogen.sh failed on Ubuntu 11.10 without this patch with:

configure.ac:30: error: possibly undefined macro: AM_PROG_AR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

AM_PROG_AR is required only for autoconf-1.12 so we can just skip it if
using an autoconf version that does not include it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:32:14 +02:00
Detlef Riekenberg
f92a445957 genunifont: avoid format-security compiler warning
Current warning without the patch:
src/genunifont.c: In function 'print_data_row':
src/genunifont.c:85:3: warning: format not a string literal and no format arguments [-Wformat-security]
src/genunifont.c:88:3: warning: format not a string literal and no format arguments [-Wformat-security]

We use fputs() to avoid any format-string parsing and instead directly
write the string into the file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:30:36 +02:00
David Herrmann
158b5fcbac shl: hook: link elements in reverse order
When adding new elements, we should add them at the tail, not at the
front. And when removing elements, we should remove them from the tail,
too.

We also convert the whole stuff to the shl_dlist API so we do not have to
manage the linked-list ourself.

Note that this silently breaks the idea of having multiple listeners with
the same function+data in the hook. This is because removing the listener
may now change order of two identical entries, as we don't know which of
them to remove. That means, when adding two identical entries, you cannot
rely on them to retain their position in regard to each other.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:26:48 +02:00
David Herrmann
f1c972f7d9 shl: dlist: add macros for iterating lists in reverse order
These macros do the same as the already available macros but in reversed
order. This is useful when list-order is important.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 17:15:42 +02:00
David Herrmann
b1e91d8f65 uterm: vt: handle VT switches without kernel input
We now set KBMODE to K_OFF so we are totally independent of kernel input.
Instead, we handle VT switches with uterm-input now. This also allows us
to have full control of which keyboard input is parsed by us and which is
parsed by the kernel.

We still need to set a flag for uterm-input events that they were handled
to avoid having the TSM layer handle these events again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 16:57:02 +02:00
David Herrmann
32335abdc7 uterm: vt: register input-cb for all VTs
This modifies the generic VT layer to register input-cbs for all VT types
and dispatch the event to the correct handler.
This will allow us to handle VT-switches for real VTs ourself instead of
relying on VT input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 16:40:26 +02:00
David Herrmann
470c643ce8 uterm: vt: remove fake-VT SIGUSR1/2 (de)activation
This whole concept was broken from the beginning. With hotkey based
activation we have a much better debugging tool. This is still very
fragile, but better than nothing. And we are doing pretty well in error
recovery during hijacked VT switches so that's not as problematic as one
might think.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 16:22:51 +02:00
David Herrmann
c44c262617 uterm: vt: add a lot more verbose error messages
This adds a lot more verbose error messages to the whole real-VT handling
so we can debug this fragile system way better than before.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-08 16:10:53 +02:00
David Herrmann
1356e72f9b terminal: pass seat-name to PTY
This passes the current seat-name from kmscon_app through ui and terminal
into kmscon_pty.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 17:54:58 +02:00
David Herrmann
593a4992b4 pty: set XDG_SEAT for childs
Recent systemd was updated to parse XDG_SEAT in PAM so we can assign
logins to the correct seat.
This patch allows pty users to specify what seat they run on so the PTY
can correctly set the seat variable. If no seat is specified, then
XDG_SEAT is not set so we still allow non-seated logins.
Note that if kmscon_pty is run with XDG_SEAT set, this will also be set
for the client PTY so unset it if you don't want the environment to be
copied to the client (like any environment variable).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 17:24:52 +02:00
Dave Reisner
0aa54a0a98 build: sanitize environment for AC_CHECK_LIB
Compiling with -Wl,--as-needed can cause the check for
gbm_bo_get_stride() to wrongly fail. Sanitize the environment further,
assuring that unneeded compiler flags are not involved in the conftest.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 17:17:49 +02:00
David Herrmann
7e4e25fcd2 wlt: add command-line options for xkb-repeat settings
You can now use --xkb-repeat-rate/delay to configure the Xkb key-repeat
settings instead of using the default 25/250.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 15:31:53 +02:00
David Herrmann
7f1bff5cc6 wlt: terminal: implement copy/paste support
This implements copy/paste support for the terminal widgets via the
recently introduced helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 15:26:22 +02:00
David Herrmann
166dcc5a09 wlt: toolkit: add helpers to create/manage selections
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>
2012-10-07 15:08:03 +02:00
David Herrmann
3ecd09ddd3 tsm: screen: implement selection extraction
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>
2012-10-07 15:07:47 +02:00
David Herrmann
742acfa093 wlt: toolkit: add input_offer support
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>
2012-10-07 13:13:03 +02:00
David Herrmann
1c813d1d1d wlt: toolkit: add wlt_window_get_display() helper
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>
2012-10-07 13:11:30 +02:00
David Herrmann
70bfc314e0 eloop: fix leaving dead FDs pollable
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>
2012-10-07 13:09:27 +02:00
David Herrmann
0996ed38a0 wlt: terminal: clear selection on short click
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>
2012-10-05 14:04:54 +02:00
David Herrmann
47d6bb7417 tsm: screen: fix including final character in selection
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>
2012-10-05 13:55:29 +02:00
David Herrmann
83d36af4a1 wlt: toolkit: fix wlt_rect_contains() calculations
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>
2012-10-05 13:47:15 +02:00
David Herrmann
202fa3b766 wlt: terminal: implement mouse-selection
This hooks up the mouse-selection with the tsm-screen selection support.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-05 13:41:52 +02:00
David Herrmann
6ff8d809c5 tsm: screen: implement selection support
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>
2012-10-05 13:28:13 +02:00
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