Commit graph

6 commits

Author SHA1 Message Date
Martin Flöser
7c3a851b04 Support enabling numlock on startup
Summary:
This change brings improved num lock support to KWin. The modifier state
is read and also mapped to Qt::KeyboardModifiers. Furthermore the input
config is read and the NumLock key is evaluated. If the requested state
does not match the current num lock state the state is swapped.

BUG: 375708
FIXED-IN: 5.15

Test Plan: New unit test added, no manual test due to lack of hardware

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16428
2018-11-01 17:49:58 +01:00
Martin Flöser
a17c85a9ea Support mapping QKeyEvent to xkb_keysym_t
Summary:
This is needed in virtual keyboard and also used KKeyServer so far. With
this change it is moved to new API provided in Xkb. The new translation
map is now also used for the direction from Qt::Key +
Qt::KeyboardModifier to xkb_keysym_t.

New implementation is supported by a new test case covering the same
combinations as in the existing direction.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7356
2017-09-19 19:09:17 +02:00
Martin Flöser
dbb951b4e2 Dependency inject KWayland::Server::SeatInterface into Xkb
No need to depend on WaylandServer from within Xkb.
2017-08-16 19:22:53 +02:00
Martin Flöser
08ae17e265 Turn Xkb into a QObject
Reduced dependencies on other classes and allows to emit signal directly
instead of emitting a signal on another class.
2017-08-16 19:22:53 +02:00
Martin Gräßlin
a039c2760f Handle modifier updates in the same sequence as Wayland does
Summary:
Consider the case that capslock gets pressed and released.
In the case of Weston we have a sequence of:
 1. Key press event
 2. Modifier changed event
 3. Key release event
 4. Modifier changed event

KWin however used to send the events in the following sequence:
 1. Modifier changed event (on key press)
 2. Key press event
 3. Modifier changed event (on key release)
 4. Key release event

It looks like Xwayland is not able to properly process the sequence
sent by KWin. And in fact KWin's sequence is wrong as it sends a state
which does not match. We report that the caps lock is pressed in the
modifiers prior to the application getting informed about the key press
of caps lock.

This change aligns KWin's implementation to the behavior of Weston. The
main difference is that when modifiers change Xkb internally caches the
serialized modifier states. And KeyboardInputRedirection just forwards
the modifiers to KWayland::Server::SeatInterface once the processing has
finished. SeatInterface ignores the forwarding if no states changes, so
it is fine to do it that way.

BUG: 377155

Test Plan:
Not yet tested with an affected Xwayland as I only have 1.18 and the
problem started with 1.19. But verified the sequence of events with WAYLAND_DEBUG
and caps lock stil working in QtWayland clients and Xwayland 1.18

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5452
2017-04-24 21:00:30 +02:00
Martin Gräßlin
58f26b8f55 Split KWin::Xkb into a dedicated .h and .cpp
Summary: Closes T5221

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Maniphest Tasks: T5221

Differential Revision: https://phabricator.kde.org/D4623
2017-02-15 17:48:55 +01:00