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