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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>