platform/upstream/kmscon.git
11 years agokmscon: remove deprecated /etc/kmscon.conf support
David Herrmann [Sun, 28 Oct 2012 14:23:09 +0000 (15:23 +0100)]
kmscon: remove deprecated /etc/kmscon.conf support

This was supported for backwards-compatibility, but is no longer
supported. Use the new /etc/kmscon/kmscon.conf files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: replace --fbdev/--dumb with --drm/--hwaccel
David Herrmann [Sun, 28 Oct 2012 14:20:20 +0000 (15:20 +0100)]
kmscon: replace --fbdev/--dumb with --drm/--hwaccel

The old options were quite stupid and low-level. It doesn't make sense to
require users to understand "--dumb" (besides, it sounds wrong).

Therefore, two new options replace the old options:
 --drm: Enabled by default. If true, kmscon uses primary DRM devices and
        avoids primary fbdev devices. If false, kmscon uses no DRM devices
        at all but uses primary fbdev devices now.
 --hwaccel: Disabled by default. If true, kmscon tries to
            hardware-accelerate any rendering if available. This can also
            affect fbdev or other devices in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: add uterm_video_available() helper
David Herrmann [Sun, 28 Oct 2012 13:29:59 +0000 (14:29 +0100)]
uterm: add uterm_video_available() helper

This helper provides information whether a given backend is available and
even whether kernel-runtime support is available for this backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: enable DRM helpers with UTERM_VIDEO_DUMB
David Herrmann [Sun, 28 Oct 2012 13:22:19 +0000 (14:22 +0100)]
uterm: enable DRM helpers with UTERM_VIDEO_DUMB

The DRM helpers can actually also be used with dumb-displays so provide it
in both cases.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoNEWS: add kmscon-6 entries
David Herrmann [Sat, 27 Oct 2012 17:22:56 +0000 (19:22 +0200)]
NEWS: add kmscon-6 entries

Add entries for all main features since kmscon-5.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: fix --fbdev implying --all-gpus
David Herrmann [Sat, 27 Oct 2012 17:21:56 +0000 (19:21 +0200)]
kmscon: fix --fbdev implying --all-gpus

We currently have no code that sets PRIMARY flags for fbdev devices so
this logic does not make sense with --fbdev. Hence, imply --all-gpus when
--fbdev is set.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --xkb-model option
David Herrmann [Sat, 27 Oct 2012 17:00:43 +0000 (19:00 +0200)]
kmscon: add --xkb-model option

This option now allows the user to change the XkbModel from the command
line or configuration file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: allow passing "model" for keyboard descs
David Herrmann [Sat, 27 Oct 2012 16:55:21 +0000 (18:55 +0200)]
uterm: input: allow passing "model" for keyboard descs

We set the model to a system-default, which means, we are hosed if the
system-default is not what the user expects. Therefore, allow setting the
model via internal APIs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: turn --switchvt on by default
David Herrmann [Sat, 27 Oct 2012 16:50:50 +0000 (18:50 +0200)]
kmscon: turn --switchvt on by default

We really _want_ this so turn it on by default. Especially for fake-VTs,
this really should be turned on all the time.
Use --no-switchvt to disable it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix CONF_OPTION_BOOL warnings
David Herrmann [Sat, 27 Oct 2012 16:50:03 +0000 (18:50 +0200)]
conf: fix CONF_OPTION_BOOL warnings

We need to cast the boolean to void* to avoid warnings when using "true"
as default value instead of "false" (which evaluates to 0 => NULL).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix "make check" build failures
David Herrmann [Sat, 27 Oct 2012 16:32:43 +0000 (18:32 +0200)]
build: fix "make check" build failures

I forgot again to keep these up to date. The conf-layer updates broke them
horribly. However, we now build them correctly without kmscon-core by
including all required layers directly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: don't interpret Pause, it hangs the VTE
Ran Benita [Sat, 27 Oct 2012 10:11:23 +0000 (12:11 +0200)]
tsm_vte: don't interpret Pause, it hangs the VTE

Pressing the 'Pause/Break' key causes the VTE to hang with no apparent
way to recover (from within kmscon). It must turn on some software flow
control, XON/XOFF or whatever.
We might want to do something with this key, but certainly not *that*.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: don't send sequence for Scroll_Lock
Ran Benita [Sat, 27 Oct 2012 09:50:52 +0000 (11:50 +0200)]
tsm_vte: don't send sequence for Scroll_Lock

This value should not be sent to the application; currently pressing
Scroll Lock does some weird character transposing, which I believe to be
completely accidental.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm_vte: bind non-numlock'ed keypad keys correctly
Ran Benita [Fri, 26 Oct 2012 16:40:05 +0000 (18:40 +0200)]
tsm_vte: bind non-numlock'ed keypad keys correctly

When a user presses on the 4 key on the keypad with NumLock off, the
expected behavior is to move left. This commit fixes all of the main
keypad keys to act like their counterparts (though KP_Begin is not
bound to anything).
This is also what xterm does, as far as I can tell:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/app/xterm.git;a=blob;f=input.c;h=f049078ed672c1da5adc169e85dc458b0fffc100;hb=HEAD#l984

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input_uxkb: update leds to match keyboard state
Ran Benita [Fri, 26 Oct 2012 16:14:32 +0000 (18:14 +0200)]
uterm_input_uxkb: update leds to match keyboard state

Upon device wakeup or led state changes, we update the keyboard LEDs to
match the new xkb state.

This means that every kmscon instance retains its own LED state, in the
users eyes. In other words, if you had Num Lock set on one kmscon, switched
to an X VT where it's off, and come back, then Num Lock will be set as
when you left. This is what X server, linux VT, etc. do.

Note that since we need to write the LED events to the evdev devices, we
need to open them RDWR. But since we don't really care what happens to
that write(), that's fine.

Also note that this means NumLock is off by default, which might be
annoying. We need to think how to get some 'setleds' or 'numlockx'
equivalent functionality.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input: change device 'feature' to device 'capability'
Ran Benita [Fri, 26 Oct 2012 15:38:19 +0000 (17:38 +0200)]
uterm_input: change device 'feature' to device 'capability'

'capability' seems to be the common terminology for this, and it sounds
better - so use it.

We also move the enum definition to the header, because otherwise the
'capabilities' field there doesn't make sense.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm_input: remove supporting code for updating LED state
Ran Benita [Fri, 26 Oct 2012 15:08:01 +0000 (17:08 +0200)]
uterm_input: remove supporting code for updating LED state

Before we transitioned to xkbcommon, we had some code that, upon
returning from a VT-switch, looked at the evdev led state and updated
the keyboard modifier state accordingly. So if we returned and NumLock
was on, we adjusted ourselves to that. That was pretty cute.

xkbcommon however doesn't support updating the state by LEDs like that.
Normally, the state of the LEDs is derived from the modifiers; going the
other way is tricky, error-prone and not used much. What we should be
doing is updating the LEDs according to *our* state.

This commit does the part of removing the unused dead code.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoxkb: use system defaults instead of "us" for layout
Ran Benita [Tue, 23 Oct 2012 18:59:27 +0000 (20:59 +0200)]
xkb: use system defaults instead of "us" for layout

libxkbcommon has a configure option to set the default values for the
RMLVO's (if they are passed as NULL or "" - we use "" so it'd be safe to
print). If they are not specified there, it's just "us" like we currently
do have. But if they are specified, we should most likely defer to it.

We do the same for the model field, instead of hardcoding "evdev". The
rules field remains hardcoded to "evdev", because we rely on it when
doing the evdev scancode-to-keycode +8 mapping.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoxkb: don't use deprecated libxkbcommon symbols
Ran Benita [Tue, 23 Oct 2012 18:29:39 +0000 (20:29 +0200)]
xkb: don't use deprecated libxkbcommon symbols

Now that libxkbcommon had a release, that has some API breakage (in
particular to xkb_keysym_from_name), we should update our code against
it and advise users to just use the xkbcommon release.

This should not happen anymore, for the foreseeable future at least.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --primary-gpu-only and --all-gpus options
David Herrmann [Sat, 27 Oct 2012 16:00:27 +0000 (18:00 +0200)]
kmscon: add --primary-gpu-only and --all-gpus options

By default, kmscon now only uses primary und auxiliary displays. All
uncategorized displays are ignored. This fixes problems with dual-GPU
systems.

--primary-gpu-only makes kmscon not use any auxiliary displays. --all-gpus
makes kmscon also use uncategorized displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: mark auxiliary devices
David Herrmann [Sat, 27 Oct 2012 15:46:48 +0000 (17:46 +0200)]
uterm: monitor: mark auxiliary devices

We now mark auxiliary displays specially so applications know which
devices can be used independently. We currently only mark USB devices as
such but this can be extended in the future for more devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: report primary GPUs to caller
David Herrmann [Sat, 27 Oct 2012 11:55:54 +0000 (13:55 +0200)]
uterm: monitor: report primary GPUs to caller

We check every DRM GPU now whether it matches the primary PCI GPU. If it
does, we set a new UTERM_MONITOR_PRIMARY flag for the device.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: monitor: add "dev_flags" field to event-structure
David Herrmann [Sat, 27 Oct 2012 11:41:23 +0000 (13:41 +0200)]
uterm: monitor: add "dev_flags" field to event-structure

Instead of using different types we now use flags. This is more
appropriate and will allow us more easily to add new flags.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: add PCI primary GPU detection
David Herrmann [Sat, 27 Oct 2012 11:25:44 +0000 (13:25 +0200)]
uterm: add PCI primary GPU detection

We used to simply probe every GPU that is reported by the kernel. However,
if a system has multiple GPUs that share display controllers, we cannot
use both simultaneously. Unfortunately, the kernel currently does not
notify us about this. Hence, we use some heuristics to determine which GPU
is the boot-gpu/primary-gpu.

This only adds the detection logic, it does not modify any code to use
this detection at all.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add character-device session dummy
David Herrmann [Fri, 26 Oct 2012 16:08:35 +0000 (18:08 +0200)]
kmscon: add character-device session dummy

If libfuse is available then kmscon is built with a new session type: cdev
This session creates a fake TTY char-dev via CUSE (which itself uses FUSE)
which then can be used by user-space as if it were a real VT.

This is still incomplete and does only support basic I/O, yet. But it
shows in what direction this is going.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: ring: provide offset parameter for shl_ring_peek()
David Herrmann [Thu, 25 Oct 2012 12:47:32 +0000 (14:47 +0200)]
shl: ring: provide offset parameter for shl_ring_peek()

If we want to fill a whole buffer, we actually might have to read more
data than just the data from the beginning. Therefore, provide an offset
so we can read from multiple pages.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: fix session-include fallbacks
David Herrmann [Wed, 24 Oct 2012 16:52:54 +0000 (18:52 +0200)]
kmscon: fix session-include fallbacks

We must provide safe fallbacks if the register-functions are not provided
as they are not compiled into kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agowlt: toolkit: update to new wayland-0.99 API
David Herrmann [Wed, 24 Oct 2012 15:01:44 +0000 (17:01 +0200)]
wlt: toolkit: update to new wayland-0.99 API

The wayland-0.99 API changed some bits. This updates wlt-toolkit to work
with the new API.

There are still some bugs that need to be fixed, however, it builds fine
and runs perfectly well on weston. The last flickering/tearing bugs have a
low priority, currently. They can be fixed when kmscon-6 is done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoeloop: fix ev_fd_update() to do nothing if the mask does not change
David Herrmann [Wed, 24 Oct 2012 15:00:48 +0000 (17:00 +0200)]
eloop: fix ev_fd_update() to do nothing if the mask does not change

If the new mask is equal to the old mask, we shouldn't change anything.
This improves performance and avoids syscalls when they aren't needed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: try to give better hints if keysyms were mistyped
David Herrmann [Wed, 24 Oct 2012 13:46:19 +0000 (15:46 +0200)]
conf: try to give better hints if keysyms were mistyped

We can now check keysym names on case-insensitive basis. We can use this
to try to give hints to the user what they probably meant when mistyping a
keysym name.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoREADME: remove xkbcommon references
David Herrmann [Wed, 24 Oct 2012 13:45:21 +0000 (15:45 +0200)]
README: remove xkbcommon references

xkbcommon now has seen a public release (0.2.0) and we have a hard
dependency on it. No more config-fiddling. You must provide xkbcommon to
make kmscon work!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix using new xkbcommon-0.2.0 API
David Herrmann [Wed, 24 Oct 2012 13:25:23 +0000 (15:25 +0200)]
conf: fix using new xkbcommon-0.2.0 API

The xkbcommon API was changed for 0.2.0 release. But now it should be
stable so we hopefully fixed it for the last time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: rework --login handling
David Herrmann [Tue, 23 Oct 2012 11:22:06 +0000 (13:22 +0200)]
kmscon: rework --login handling

We implement --login as special type now. This allows us to correctly
parse it in configuration files.
We also replace the default value by /bin/login.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: simplify --vt handling
David Herrmann [Tue, 23 Oct 2012 11:21:27 +0000 (13:21 +0200)]
kmscon: simplify --vt handling

We can reuse all the conf_string.* functions and do not have to implement
them ourself.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix closing dummy sessions
David Herrmann [Tue, 23 Oct 2012 11:18:42 +0000 (13:18 +0200)]
seat: fix closing dummy sessions

We must reset the "dummy" pointer when unregistering dummy sessions,
otherwise, we will get NULL pointer derefs.
This also prevents keyboard-input from closing dummy sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: misc: add shl_dup_array_size() helper
David Herrmann [Tue, 23 Oct 2012 10:32:37 +0000 (12:32 +0200)]
shl: misc: add shl_dup_array_size() helper

This is the same as shl_dup_array() but the source might not be NULL
terminated so it takes a "size" argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: fix typo in wlterm dependency checking
David Herrmann [Tue, 23 Oct 2012 10:06:55 +0000 (12:06 +0200)]
build: fix typo in wlterm dependency checking

This is just two small typos/copy-paste-errors that didn't get checked
earlier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: simplify helper macros
David Herrmann [Tue, 23 Oct 2012 10:05:42 +0000 (12:05 +0200)]
conf: simplify helper macros

Instead of using "NULL, NULL, NULL, " in every macro, we now provide a
*_FULL variant which allows setting these. All other macros simply set
these to NULL by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: call aftercheck after config-file parsing is done
David Herrmann [Tue, 23 Oct 2012 09:45:43 +0000 (11:45 +0200)]
conf: call aftercheck after config-file parsing is done

We need to call afterchecks after any parsing we do. To signal that there
are no extra-arguments, we pass argv==NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add "file" callback
David Herrmann [Tue, 23 Oct 2012 09:41:34 +0000 (11:41 +0200)]
conf: add "file" callback

The "file" callback is used to parse configuration files. If it is not
given, the string is parsed via "parse".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoMerge branch 'github/master'
David Herrmann [Tue, 23 Oct 2012 09:39:24 +0000 (11:39 +0200)]
Merge branch 'github/master'

Merge upstream development into the config-rework.

11 years agobuild: add proper dependency checking to configure.ac
David Herrmann [Tue, 23 Oct 2012 09:35:49 +0000 (11:35 +0200)]
build: add proper dependency checking to configure.ac

We build several tools inside of this repository and we need to make sure
all dependencies are met. Furthermore, we must make sure that default
values are recognized even on dependencies.
Hence, this reworks the whole configure.ac handling and does some renaming
of the constants that are used all over the source.

We need to test this some more weeks, but it should finally be a proper
autotools handling that we can release with kmscon-6.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: dumb: clear buffer on allocation
David Herrmann [Mon, 22 Oct 2012 12:00:39 +0000 (14:00 +0200)]
uterm: dumb: clear buffer on allocation

DRM buffers are not guaranteed to be cleared after allocation. This is to
boost performance for small buffers that are allocated and freed often.
However, for render-buffers we can clear them without loosing any
performance as they are allocated once and then only freed on shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: use local configs instead of global kmscon_conf
David Herrmann [Fri, 19 Oct 2012 15:18:58 +0000 (17:18 +0200)]
kmscon: use local configs instead of global kmscon_conf

We now have the ability to pass on local configurations so we no longer
need the global kmscon_conf.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: add option-copy callback
David Herrmann [Fri, 19 Oct 2012 14:40:34 +0000 (16:40 +0200)]
conf: add option-copy callback

We allow options to specify "aftercheck" callbacks but do not call them
during a copy. Therefore, we need a way to copy side-effects. As we cannot
do that generically, we now allow each option to specify such a callback.

We use it for the "all_seats" and "argv" parameters in kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: fix overwriting locked options during copy
David Herrmann [Fri, 19 Oct 2012 14:19:26 +0000 (16:19 +0200)]
conf: fix overwriting locked options during copy

If we copy entries into another context, we must not overwrite locked
entries. Furthermore, if we copy a locked entry, we must also copy that
lock.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: implement per-seat configuration
David Herrmann [Fri, 19 Oct 2012 14:15:34 +0000 (16:15 +0200)]
kmscon: implement per-seat configuration

Sorry for the huge commit, but this reworks the whole configuration
handler. We now provide conf_ctx contexts which contain a pointer to the
backing storage and the config-options that are used.

It is also possible to copy config-options now. So we can use the
main-config as default value for seat-configurations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: drm: do not set EGL_DISPLAY
David Herrmann [Thu, 18 Oct 2012 16:57:47 +0000 (18:57 +0200)]
uterm: video: drm: do not set EGL_DISPLAY

EGL_DISPLAY is a no-op and we probably want to set EGL_PLATFORM. However,
it doesn't make any sense to set it, because EGL should be able to
properly detect the platform.
If this doesn't work on your machine, you should really try fixing your
environment before forcing this. If there are corner cases where this
doesn't work, you should file a bug against mesa.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: make configuration-parser modular
David Herrmann [Thu, 18 Oct 2012 13:58:34 +0000 (15:58 +0200)]
kmscon: make configuration-parser modular

This allows changing the backing-memory of a kmscon-config object. This
way, we can parse the same options into a per-seat config object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add helpers to access kmscon_conf
David Herrmann [Thu, 18 Oct 2012 13:10:42 +0000 (15:10 +0200)]
kmscon: add helpers to access kmscon_conf

We are about to introduce per-seat-configuration so we need some helper
macros that will later select the right configuration that we read from.

These helpers simply hook into the kmscon-config and return the correct
value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: drop all configs and use new /etc/kmscon/kmscon.conf
David Herrmann [Thu, 18 Oct 2012 12:48:09 +0000 (14:48 +0200)]
kmscon: drop all configs and use new /etc/kmscon/kmscon.conf

This drops all config-file support except for the new
/etc/kmscon/kmscon.conf. For backwards-compatibility, we still parse
/etc/kmscon.conf but this will be removed soon.

We want to add one kmscon-config for each seat so you can have different
configurations per seat. These will all be put into /etc/kmscon/ so we
need this directory.

We also drop ~/.kmscon.conf. This was never really useful as kmscon is a
system daemon and should not be used with user-configuration files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: introduce conf_parse_file_f()
David Herrmann [Thu, 18 Oct 2012 12:10:48 +0000 (14:10 +0200)]
conf: introduce conf_parse_file_f()

This new helper allows easily parsing arbitrary filenames. It does the
same as conf_parse_file() but allows giving filenames in printf format.

The other parsers are slightly adjusted so they can be more easily reused
by other projects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: reorganize configuration items
David Herrmann [Thu, 18 Oct 2012 11:45:49 +0000 (13:45 +0200)]
kmscon: reorganize configuration items

This just rearranges all options so they are logically grouped and in the
same order at all places. It also changes the internal variable for
"--fbdev" from "use_fbdev" to "fbdev" so all variables have the same name
as the option-names.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add --session-max parameter
David Herrmann [Thu, 18 Oct 2012 11:28:10 +0000 (13:28 +0200)]
kmscon: add --session-max parameter

This parameter allows to limit the maximum number of sessions to a sane
limit. Otherwise, a user could DOS a systemd by opening as many session as
they want.
This can be set to 0 to drop that limit, however, this is not recommended.
Instead, if you want an ability to add more sessions than that limit, you
should implement a flag to register_session() that overwrites the limit.
This can then be used by a safe way to register new sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: use dummy session
David Herrmann [Thu, 18 Oct 2012 11:15:41 +0000 (13:15 +0200)]
seat: use dummy session

This makes the seat implementation register one dummy session as fallback.
This session isn't switched to except if no other session is available.
Furthermore, if the dummy is active and a new session is registered, it is
automatically activated.

External applications should never know of this dummy session. It's a
kmscon internal fallback so we can draw the screen even if there is no
other session available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add dummy session type
David Herrmann [Thu, 18 Oct 2012 11:14:16 +0000 (13:14 +0200)]
kmscon: add dummy session type

The dummy session is a very simply session implementation that simply
draws a black background. It will be used by each seat as fallback if no
other session is available. If we didn't do that, we wouldn't be able to
guarantee that the screen is cleared after a session is unregistered.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: add keyboard grabs to close sessions and start new terminals
David Herrmann [Thu, 18 Oct 2012 09:50:57 +0000 (11:50 +0200)]
seat: add keyboard grabs to close sessions and start new terminals

You can now use ctrl+alt+w to close the current session and
ctrl+alt+Return to start a new terminal (if it is built-in).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix sending all displays to newly created sessions
David Herrmann [Thu, 18 Oct 2012 09:48:30 +0000 (11:48 +0200)]
seat: fix sending all displays to newly created sessions

We used to create all sessions that listen to displays during startup.
Therefore, all displays were kind of "hotplugged". However, we must also
send already existing displays to new sessions so we can create them
during runtime just fine.

This simply calls the session-callback during session-registration so you
must be fine getting the session callback when calling
kmscon_session_register().

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: fix resetting key-repeat timer during key-press
David Herrmann [Mon, 15 Oct 2012 20:59:31 +0000 (22:59 +0200)]
uterm: input: fix resetting key-repeat timer during key-press

We currently do not reset the key-repeat-delay when key-presses are
changed fast enough to fall into the repeat-rate range. Therefore, we
might get spurios key-repeats, even though the key itself wasn't held for
repeat-delay milliseconds.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix staying alive if compositor-registration fails
David Herrmann [Mon, 15 Oct 2012 20:53:55 +0000 (22:53 +0200)]
seat: fix staying alive if compositor-registration fails

If the compositor cannot be created, we now still stay alive and allow
other sessions to work. However, the terminal session is still required as
it is considered to be crucial.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoCOPYING: remove no longer relevent sections
Ran Benita [Mon, 15 Oct 2012 18:26:27 +0000 (20:26 +0200)]
COPYING: remove no longer relevent sections

All of the (xkb) keyboard handling code was written by David and me;
even the old code was not based on xlib but written against the
specification (not entirely correct, too). All of this logic was moved
to libxkbcommon, which we merely link against.

We also no longer carry our own uterm_keysyms.h file, so that section is
not relevant either.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoexternal: remove unused imKStoUCS files
Ran Benita [Mon, 15 Oct 2012 18:21:14 +0000 (20:21 +0200)]
external: remove unused imKStoUCS files

We needed these files before libxkbcommon had a function to convert
keysyms to unicode, and then for the 'plain' keyboard backend, which
didn't use libxkbcommon. Since this backend was removed, these files are
no longer needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: add wayland-session support
David Herrmann [Mon, 15 Oct 2012 16:05:06 +0000 (18:05 +0200)]
kmscon: add wayland-session support

This adds a wayland compositor which registers sessions for each top-level
window within kmscon. This means, you can run any arbitrary
wayland-application on kmscon. Each top-level window that is registered by
the applications is put into a separate session and you can switch between
the sessions with the previously introduced session-shortcuts.

The compositor is still very basic. It doesn't support input devices at
all (not even talking about DnD). The only thing it does is surface
management (and even that is not fully implemented).

However, this shows the direction that kmscon will go. You can run the
Wayland "simple-shm" and "simple-egl" demos on kmscon to see how it works.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: allow session-switching with keyboard
David Herrmann [Mon, 15 Oct 2012 16:02:12 +0000 (18:02 +0200)]
seat: allow session-switching with keyboard

This adds two new grabs to switch sessions within kmscon. They are set to
ctrl+alt+Left/Right by default.

To improve debugging, we also add some log-messages to session management.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: dlist: add *_but_one() loops
David Herrmann [Mon, 15 Oct 2012 15:56:44 +0000 (17:56 +0200)]
shl: dlist: add *_but_one() loops

The *_but_one() variants of dlist-loops start from within a loop instead
of at the head and iterate over all elements except the start-element. The
start element is skipped as we would need a temporary variable to include
it and in most times you want to skip the start-element, anyway.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoconf: allow multiple grabs and keysyms per grab-option
David Herrmann [Mon, 15 Oct 2012 15:01:13 +0000 (17:01 +0200)]
conf: allow multiple grabs and keysyms per grab-option

We allow users to specify grabs on the command-line or in config-options.
We sometimes want multiple grabs to do the same. Therefore, this changes
the grab-parser and handlers to allow this.

Furthermore, this adds support for keysyms that are assembled of multiple
syms. This isn't needed by any keymap, yet, but might be used in the
future.

Last but not least, you can also specify modifiers only now. This might be
used by subsystems to use the default keysyms but let the user specify
what modifiers should be used.
However, be careful when specifying modifiers-only for normal grabs as
this means the grab is executed everytime the modifier is reported with
_any_ key.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: fbdev: fix setting current-mode on activation
David Herrmann [Mon, 15 Oct 2012 12:25:59 +0000 (14:25 +0200)]
uterm: video: fbdev: fix setting current-mode on activation

We must not recreate a video-mode if we re-activate an fbdev display after
wake-up. Otherwise, the "current" pointer changes and users might get
confused. We guarantee that the "current" pointer stays the same during
operation as we currently do not support changing display size without
reactiating the display.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: use generic timer if vblank events are not available
David Herrmann [Mon, 15 Oct 2012 11:22:42 +0000 (13:22 +0200)]
uterm: video: use generic timer if vblank events are not available

fbdev does not provide any vertical-blanks so this introduces a generic
framework for uterm-videos as replacement. We simply schedule a timer
event that fires after a fixed timeout. This allows other subsystems to
rely on the page-flip event to occur either at the next real page-flip or
at a fixed timeout. As this is what we want in most places, we just
implement it inside of uterm. So relying on page-flips no longer hogs the
CPU because swap() generates the right away.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add display callbacks
David Herrmann [Mon, 15 Oct 2012 10:26:03 +0000 (12:26 +0200)]
uterm: video: add display callbacks

Users might be interested in vertical-blank events so we now allow them to
register event-callbacks on displays. The only event that we currently
pass is a page-flip event that is always sent as reaction to a swap. If
there is no hardware support for such events, we simply throw it from
within the swap() function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: add display_fill/blit helpers
David Herrmann [Sat, 13 Oct 2012 14:48:09 +0000 (16:48 +0200)]
uterm: video: add display_fill/blit helpers

Instead of requiring to create uterm-screens, it is now possible to blit
and fill displays directly similar to fake-blends.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: fix activating only enabled seats during session-switch
David Herrmann [Fri, 12 Oct 2012 13:56:18 +0000 (15:56 +0200)]
seat: fix activating only enabled seats during session-switch

If we deactivate a session, we must not activate the next session we find
but we need to look for an enabled session instead.
This also changes the session_deactivate() helper to allow deactivating
disabled sessions. This shouldn't be relyed on, but it is a safe fallback
if some session turns out to be disabled but still active.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: rename WAKE_UP/SLEEP to ACTIVATE/DEACTIVATE
David Herrmann [Fri, 12 Oct 2012 13:46:30 +0000 (15:46 +0200)]
seat: rename WAKE_UP/SLEEP to ACTIVATE/DEACTIVATE

We use this naming-scheme for all the session-helpers so we should also
use it for the callback notifications.
Also rename all the callback-helpers to *_call_* so we have no
name-clashes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: add enable/disable logic to sessions
David Herrmann [Fri, 12 Oct 2012 13:30:13 +0000 (15:30 +0200)]
seat: add enable/disable logic to sessions

If we want to allow dummy sessions, we need some way to disable these so
they are never activated on a seat. This patch disables every session by
default and you need to explicitely enable them to be available for
activation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: add kmscon_session_is_active() helper
David Herrmann [Fri, 12 Oct 2012 13:26:07 +0000 (15:26 +0200)]
seat: add kmscon_session_is_active() helper

This helper allows to check whether a given session is currently the
active session on its registered seat.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoseat: add kmscon_seat_is_registered() helper
David Herrmann [Fri, 12 Oct 2012 13:24:45 +0000 (15:24 +0200)]
seat: add kmscon_seat_is_registered() helper

This helper allows API users to check whether a session object is still
registered to a seat.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: fix key-repeat handling
David Herrmann [Thu, 11 Oct 2012 23:22:47 +0000 (01:22 +0200)]
uterm: input: fix key-repeat handling

We currently do not handle modifier-changes during key-repeats. This is
odd as pressing shift should change a repeating key.

To avoid duplicating a lot of code, this patch puts most of the
key-handling into helper functions and cleans it up. We now handle all
kinds of key-repeat specialties and everything should work fine.

Reported-by: Ran Benity <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: input: fix stopping key-repeats on key-up
David Herrmann [Thu, 11 Oct 2012 22:30:58 +0000 (00:30 +0200)]
uterm: input: fix stopping key-repeats on key-up

A key-repeat is about keycodes, not keysyms. We repeat the keycode and the
events that are generated by it, so we must also stop repeating if the
given keycode is released.

This fixes a bug where a key would still be repeated if we press:
<a-down> - <Shift-down> - <a-up> - <Shift-up>

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoshl: misc: fix XKB modifier collector to check for errors
David Herrmann [Thu, 11 Oct 2012 14:45:30 +0000 (16:45 +0200)]
shl: misc: fix XKB modifier collector to check for errors

The XKB functions actually return <0 if the modifier is invalid. This
cannot happen for the hard-coded modifiers that we use, but it is still
safer to check correctly whether the returned value is >0.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agowlterm/kmscon: change default repeat-rate to 50
David Herrmann [Thu, 11 Oct 2012 10:39:58 +0000 (12:39 +0200)]
wlterm/kmscon: change default repeat-rate to 50

Even though I really like the high repeat-rates, it might not be the best
default option. Hence, change it to some sane default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: vte: fix clearing alternate screen on DECSET 1047
David Herrmann [Thu, 11 Oct 2012 10:33:34 +0000 (12:33 +0200)]
tsm: vte: fix clearing alternate screen on DECSET 1047

It isn't clear from the xterm documentation which buffer to clear when
resetting private mode 1047. However, testing showed that the
alternate-screen is cleared, not the main-screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: do not link alternate-screen lines to scrollback
David Herrmann [Thu, 11 Oct 2012 10:26:18 +0000 (12:26 +0200)]
tsm: screen: do not link alternate-screen lines to scrollback

The alternate screen is mainly used to avoid linking lines to the
scrollback buffer. This implements this feature so only main-screen lines
end up in the scrollback buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: remove obsolete comment
David Herrmann [Thu, 11 Oct 2012 10:22:53 +0000 (12:22 +0200)]
tsm: screen: remove obsolete comment

We correctly free all new space and this is really needed due to rotations
in the active screen and scrollback buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: fix cell-initialization on line resize
David Herrmann [Thu, 11 Oct 2012 10:20:08 +0000 (12:20 +0200)]
tsm: screen: fix cell-initialization on line resize

We didn't correctly initialize new lines on resize. In fact, we didn't
initialize new cells at all. This was all covered by a nasty-fix in the
screen-resize handler.
This fixes the line-resize handler to initialize all new cells correctly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: fix freeing alternate screen buffers on shutdown
David Herrmann [Thu, 11 Oct 2012 10:19:35 +0000 (12:19 +0200)]
tsm: screen: fix freeing alternate screen buffers on shutdown

We have to free both, main and alternate buffers on shutdown. We only used
to free the currently active buffer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: vte: implement alternate-screen modes
David Herrmann [Thu, 11 Oct 2012 10:17:20 +0000 (12:17 +0200)]
tsm: vte: implement alternate-screen modes

On DECSET 47, 1047-1049 we switch between normal screen mode and alternate
screen mode. xterm and friends support a titeInhibit resource that
disables this feature, so we add a flag to set this, too. However, there
is currently no way to set this on the command-line. If someone needs
that, we can easily add that.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: add flag to select alternate screen buffer
David Herrmann [Thu, 11 Oct 2012 09:31:14 +0000 (11:31 +0200)]
tsm: screen: add flag to select alternate screen buffer

The VTE layer can now set the TSM_SCREEN_ALTERNATE flag to switch to the
alternate screen-buffer and back.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agotsm: screen: allocate alternate screen buffer
David Herrmann [Thu, 11 Oct 2012 09:16:30 +0000 (11:16 +0200)]
tsm: screen: allocate alternate screen buffer

This changes the line-allocation helpers of TSM-screen to allocate an
alternate buffer along with the main-buffer. We still keep the "lines"
pointer to the main-buffer all the time, but this will allow to implement
alternate-xterm-screens later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoIntroduce session management
David Herrmann [Thu, 11 Oct 2012 08:54:01 +0000 (10:54 +0200)]
Introduce session management

On seats other than seat0 we do not have any session-management, because
VTs are not available. Furthermore, if we want to get rid of CONFIG_VT
entirely, we also need to provide session-management for seat0.

This commit introduces sessions. Every seat (seats are now managed in
kmscon_seat.c) can have registered sessions. One of the sessions is active
and gets control over all displays. Session switching is entirely handled
inside of kmscon so there is always an active session (except if no
session is registered at all).

This also reworks the seat-management. kmscon_main.c now only manages the
seat allocation/deallocation and video-objects. The seat itself is handled
inside of kmscon_seat.c and does not know of uterm_video objects. Instead,
it is assigned a list of displays that it can use. Everything is still
hotplugging capable so user-experience should be the same as before.

The kmscon_terminal layer is reworked to be session based. So every
terminal is now a single session. By default, a single terminal-session is
created for each seat. This may be changed, though.

There is currently no input-control to change between session with
keyboard hotkeys. However, this will be added when we have more than one
session.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agobuild: run ./configure in ./autogen.sh only if NOCONFIGURE is not set
David Herrmann [Thu, 11 Oct 2012 08:38:21 +0000 (10:38 +0200)]
build: run ./configure in ./autogen.sh only if NOCONFIGURE is not set

In some circumstances it might not be desirable to run ./configure
together with ./autogen.sh. You can now set NOCONFIGURE=1 to avoid this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agouterm: video: fbdev: send UTERM_NEW/GONE events for fbdev devices
David Herrmann [Wed, 10 Oct 2012 20:26:01 +0000 (22:26 +0200)]
uterm: video: fbdev: send UTERM_NEW/GONE events for fbdev devices

We didn't send these events as the fake-display for fbdev video-objects
was created during video-creation and thus no listener could have been
registered so far.
However, this caused every video listener to iterate over all displays on
wake-up. This is really ugly and we want to avoid that. Therefore, we now
send the UTERM_NEW event in an idle-handler and the GONE event on
shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agokmscon: move config-handling to kmscon_conf.c
David Herrmann [Wed, 10 Oct 2012 19:30:54 +0000 (21:30 +0200)]
kmscon: move config-handling to kmscon_conf.c

Configuration handling is totally independent from kmscon_main.c so we
move it into a separate file to avoid cluttering up kmscon_main.c.

This also does some basic initialization in kmscon_conf.c which is solely
related to configuration handling and logging.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agoterminal: reopen terminal on HUP if no callback is given
David Herrmann [Wed, 10 Oct 2012 19:24:35 +0000 (21:24 +0200)]
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>
11 years agokmscon: move kmscon_main.h to kmscon_conf.h
David Herrmann [Wed, 10 Oct 2012 19:23:38 +0000 (21:23 +0200)]
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>
11 years agobuild: do not list xkbcommon as optional
Detlef Riekenberg [Tue, 9 Oct 2012 14:50:43 +0000 (16:50 +0200)]
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>
11 years agouterm: input: fix passing the correct keycode to get_ascii()
David Herrmann [Tue, 9 Oct 2012 13:29:31 +0000 (15:29 +0200)]
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>
11 years agotest_input: fix using XKB directly
David Herrmann [Tue, 9 Oct 2012 11:56:30 +0000 (13:56 +0200)]
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>
11 years agoPrefix kmscon sources with kmscon_*
David Herrmann [Tue, 9 Oct 2012 11:53:55 +0000 (13:53 +0200)]
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>
11 years agokmscon: add --xkb-repeat-rate/delay command-line arguments
David Herrmann [Tue, 9 Oct 2012 11:23:09 +0000 (13:23 +0200)]
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>
11 years agouterm: input: implement software key-repeat
David Herrmann [Tue, 9 Oct 2012 11:12:02 +0000 (13:12 +0200)]
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>
11 years agouterm: vt: reset KBMODE to K_UNICODE if it was K_OFF
David Herrmann [Tue, 9 Oct 2012 11:10:02 +0000 (13:10 +0200)]
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>