48 Commits

Author SHA1 Message Date
David Herrmann
0249b2cb0b shl: move log.[ch] to shl_log.[ch]
We want to avoid any static files that are shared between multiple
programs but are not part of SHL. These make the build-process just more
complex.
Move log.[ch] to SHL so we have a known context.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-03-04 14:40:36 +01:00
David Herrmann
8a2413d76a conf: remove unused CONF_DONE
This flag was never used and is mostly useless, so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 12:40:03 +01:00
David Herrmann
8a00e39854 conf: fix include-protection name
We use CONF, not CONFIG as prefix so fix the include-protection to use
this, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 12:38:45 +01:00
David Herrmann
6a674402ea conf: perform aftercheck on ctx-copy
Afterchecks should be always performed when reading data into a config
context. So perform them after copy operations, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-02-05 11:45:33 +01:00
David Herrmann
b9743bb75c 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>
2012-10-24 15:46:19 +02:00
David Herrmann
069e467913 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>
2012-10-24 15:25:23 +02:00
David Herrmann
8923fe2123 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>
2012-10-23 11:45:43 +02:00
David Herrmann
6aeae8be93 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>
2012-10-23 11:41:34 +02:00
David Herrmann
d40b23d789 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>
2012-10-19 16:51:01 +02:00
David Herrmann
78cf66f087 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>
2012-10-19 16:19:26 +02:00
David Herrmann
06c6e56d4c 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>
2012-10-19 16:15:34 +02:00
David Herrmann
613abadb4b 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>
2012-10-18 14:48:09 +02:00
David Herrmann
5cd14efb80 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>
2012-10-18 14:22:55 +02:00
David Herrmann
52edafe08c 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>
2012-10-15 17:30:27 +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
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
a6165a03c7 conf: add INT datatype
This is very similar to the UINT datatype but allows signed values. This
will be required for the coming --vt option as default value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-29 11:47:42 +02:00
David Herrmann
f2081c84ee conf: remove uterm depedency
We move the GRAB type into kmscon-main.c to avoid any uterm dependency in
the conf subsystem. It is still open how we can better handle the
key-parser without a valid uterm_input object, but when there will be a
xkbcommon release, we can hopefully add a hard depedency to it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-24 21:57:23 +02:00
David Herrmann
2d3166a847 conf: add "grab" config data-type
Grabs are used to specify keyboard shortcuts so they do not have to be
hardcoded into the binary.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-05 14:07:03 +02:00
David Herrmann
572bc3e195 conf: add UINT as new datatype
The "uint" type parses an unsigned integer as argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 16:23:03 +02:00
David Herrmann
3d2165a4ba conf: add string-list type
The string-list type parses an argument as a list of strings separated
with commas. Empty arguments are accepted and correctly parsed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 23:41:36 +02:00
David Herrmann
c9ccc70fcb main: move conf_global to kmscon_conf in new header main.h
The main configuration is now limited to kmscon and thus should not use
the conf_* prefix. Move all code to use the new name and introduce the new
main.h header mainly for kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 22:02:46 +02:00
David Herrmann
39be24697a conf: make config functions take conf-options as arguments
This replaces the global conf-options array with a parameter so we can use
the config parsers with different argument-lists.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:50:41 +02:00
David Herrmann
09e2c17336 conf: make important symbols global
In order to make the conf subsystem more open we need to make all
important symbols visible so others can include them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:37:32 +02:00
David Herrmann
c52df82033 conf: add aftercheck logic
The aftercheck logic allows each argument to make adjustments after the
argument-list has been parsed. It is also used to consume remaining
arguments.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:32:15 +02:00
David Herrmann
ac6078445f conf: be more verbose about wrong arguments
We didn't handle the case that an argument has a parameter but doesn't
need one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:11:41 +02:00
David Herrmann
28be382019 conf: make missing arguments or wrong arguments fatal
It is not acceptable to start the applications with wrong parameters. A
typo must be corrected before starting the application so simply fail
loudly on errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 21:00:03 +02:00
David Herrmann
5c13be3f1d conf: move CONF_HAS_ARG flag to config-types
Whether an option takes an argument or not is definitely a property of the
type and not of the option. Therefore, move the flag to the type structure
and remove it from the option structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 20:52:17 +02:00
David Herrmann
c65ac64aa5 conf: make config types constant
Config types are shared so they should never be modified. Hence, make them
constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 20:51:30 +02:00
David Herrmann
e80a39b5be conf: make types generic
This abstracts the type system of the config parser so other types can be
added without changing the parser itself. This will also be required to
make the conf-subsystem exportable to other users.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 20:16:38 +02:00
David Herrmann
d00f61305f conf: prefix helpers with CONF_*
This is part of an effort to make the conf-subsystem more friendly for
external users like the tests/* binaries.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-11 19:52:11 +02:00
David Herrmann
c52ecdfa6b conf: add "font-engine" option
This option allows to select the font-engine during run-time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-06 14:45:03 +02:00
David Herrmann
52fa0f80d9 conf: fix invalid memory access in strip_spaces()
We must not assume that the string is longer than 0 characters. Therefore,
check whether we would access invalid memory before the string when
removing trailing whitespaces.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-21 20:12:00 +02:00
David Herrmann
dd68e97016 conf: add config-file parser
This again refactors the whole config subsystem but this should be the
last time. We now have generic parsers for booleans and strings and don't
leak any memory, anymore. Furthermore, this adds a config-file parser so
common options can now be placed into /etc/kmscon.conf or ~/.kmscon.conf.

The config files parse the same arguments as the command-line and the
command-line always has precedence even though it is parsed first.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-17 22:47:15 +02:00
David Herrmann
3cadb1d349 conf: add generic argument array
We want to be able to parse our argument-list from other sources, too, so
put them into a separate array so we are not dependent of getopt() and
others.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-16 19:35:05 +02:00
David Herrmann
4fb2f85f67 main: use --fbdev options to switch between DRM/fbdev
The new --fbdev option allows runtime switching between the two backends.
That is, we only use fbdev devices when --fbdev is given. Otherwise, DRM
is used.

Technically, it would also be possible to use both. However, almost every
DRM device does also register an fbdev device for backwards compatibility.
Therefore, we must avoid using both, the DRM and fbdev device of the same
display at the same time. As this would also mean dealing with failures in
one backend and then switching to the other, we avoid this for complexity
reasons. Who needs fbdev and drm simultaneously, anyway?

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-24 11:01:25 +02:00
David Herrmann
c6f2573499 conf: set TERM by default to vt220
vt220 seems to be the best alternative to "xterm" and should work with
every application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:29:29 +02:00
David Herrmann
668052401e conf: add --seat parameter
The --seat parameter specifies which seat is used for drm and input
devices. Default is seat0.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 18:04:39 +02:00
David Herrmann
262a0e98a0 conf: fix negative getopt_long parameters
I don't know the reason but negative values don't work here. We simply use
big integers now to avoid clashes with valid getopt() values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 18:03:21 +02:00
David Herrmann
c0030f47c2 conf: fix local storage of default argv
We assigned stack-storage to a global pointer and therefore we got
seg-faults when using the default. Fix that.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-25 16:22:27 +02:00
David Herrmann
8773331331 pty: introduce --term
Allow setting TERM to different values than the default with a
command-line switch.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 18:15:50 +01:00
David Herrmann
ec2dfaa244 pty: add --login option
Allow to specify a separate login-program that is executed instead of the
default. All arguments specified after --login are considered argv[] of
the new process and not parsed by the library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 18:10:55 +01:00
David Herrmann
f8dc74c297 conf: add --xkb-XY options
Allow setting XKB options on the command line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:02:48 +01:00
David Herrmann
e35ca87a95 conf: add --silent
Suppress debug, info, notice and warning messages if --silent is given.
This is overwritten by --debug and --verbose.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:38:24 +01:00
David Herrmann
6d63b55d6f conf: add --switchvt
--switchvt enables kmscon to automatically switch to the new VT that was
opened by kmscon. If this is the current VT, then this has obviously no
effect.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:42:39 +01:00
David Herrmann
c8b247785c conf: fix --help handling
Handle --help same way as -h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:41:52 +01:00
David Herrmann
a4bd71cd0c conf: remove unneeded global initialization
Global variables are initialized to 0 automatically. So remove the
initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:40:56 +01:00
David Herrmann
d19f7ec2f1 conf: add configuration subsystem
The conf-subsystem is used throughout the whole source and provides a
global static read-only configuration. The configuration is read on
startup from the command-line and filesystem and then provided to the
other subsystems.

This is no database, that is, the data is not written to a file on
shutdown!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:13:50 +01:00