test_vt: use new uterm vt master

Use uterm vt master to allocate an VT on seat0 for testing purposes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm_vt: fix correctly passing vt data to callbacks

When emulating the VT layer we need to pass our own data to the internal
callbacks. We currently pass the user data which is really useless here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: use uterm_monitor objects

Create a global uterm_monitor object to monitor the system for new seats
and devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: listen for new seats

Allocate new seat objects when a new seat occurs and remove them when a
seat goes away.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: create vt master object

When running multiple sessions on multiple seats, we need to allocate
multiple VTs, too. Therefore, we now create a VT master connection in the
main application which we can later use to allocate new VTs for each
session.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: collect one DRM device per seat

We need a single graphics card on a seat to run kmscon. Therefore, wait
for the first DRM device that appears and make it the current graphics
device for the seat. We do not support multiple graphics cards per seat
but this may be added in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: add input device to each seat

Each seat now collects all input devices that are associated to that seat.
When multi-session support is added, then we can even share them between
the sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: poll video devices on hotplug

When the monitor notifies us about an hoptplug event, then we need to poll
the current video device. Otherwise, we might miss hotplugged monitors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
vt: fix calling wrong callbacks

If we allocate multiple VTs in a single process, then we share the same
signals which are used to acknowledge VT switches. Instead of blindly
calling the user-callbacks, we need to check first which VT is currently
active to forward the signal only if we are the active VT.
Otherwise, all VTs we allocate share a single logical VT.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: allocate one VT per seat

Each session needs a virtual terminal where it operates. Therefore,
allocate one VT per seat so we can react on events on that seat.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
main: remove old session code

We now run a session on each registered seat so we no longer need the old
session code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
monitor: fix small memory leak

The members of the array returned from get_all_seats are strdup'd as
well.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kbd: remove "dev" from kbd_dev_keysym_to_string

Both dumb and xkb don't actually need the kbd_dev for that. The dumb
backend already omits the "dev".

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Replace old input subsystem with new uterm input

Use the new subsystem now throughout the whole code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
input: remove old input subsystem

We are no longer using the old subsystem, so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
xkb: remove old xkb code and add stubs

The libxkbcommon API as been revamped completely, making all of the
current code redundant and non-working. This commit removes all of the
old xkb_desc handling before using the new API.

After this commit, kmscon will no longer link to against the old
lixkbcommon; please update to a new package or compile from the
"master" branch from:
git://anongit.freedesktop.org/xorg/lib/libxkbcommon

[ This commit also adds a missing kbd_desc_new, which was declared but
not copied over from the old files. ]

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
xkb: initialize the xkb objects

The new xkb types correspond quite closely to our own types, which now
become thin wrappers.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
xkb: produce key events

Use the new API in kbd_dev_process_key.
This introduces a regression whereby repeating key events are sent for
modifier keys. This is a currently a limitation in xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
xkb: add a TODO note to kbd_dev_reset stub

This is a small regression whereby starting kmscon with e.g. Caps Lock
already on, will not be reflected in the modifier mask. It's not
currently possible with xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm_input: fix increasing refcnt

We need to correctly increase the refcnt. We currently increase it only
when it was 0 before due to a very subtle bug as we missed the "return".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>