Workaround xkbcommon behavior concerning consumed modifiers

Authored by graesslin on Oct 5 2016, 1:41 PM.



If a key could be turned into a keysym with a modifier xkbcommon
considers the modifier as consumed even if not pressed.
E.g. Alt+F3 considers alt as consumed as there is a keysym gnerated with
Ctrl+Alt+F3 (vt switching).

This change tries to workaround the problem by ignoring the consumed
modifiers if there are more modifiers consumed than active. It's
possible that this will create regressions for other shortcuts - we need
to test it in the wild. Although this might cause regressions I'm aiming
for Plasma/5.8 branch with the change. It only affects Wayland and fixes
quite important shortcuts from window manager perspective (desktop
switching (ctrl+f1 to ctrl+f4), desktop grid (ctrl+f8), present windows
(ctrl+f9, ctrl+10), cube (ctrl+f11), user actions (alt+f3), close window
(alt+f4)). If it causes regressions they need to be fixed as well in the
Plasma/5.8 branch.

A new API entry point for xkbcommon was proposed, but is not yet merged
and there is no release with it yet. Once that is available the
workaround should get removed and replaced by the new API call.

BUG: 368989
FIXED-IN: 5.8.1

Test Plan

Going to restart session now with the change

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 7116.Oct 5 2016, 1:41 PM
graesslin retitled this revision from to Workaround xkbcommon behavior concerning consumed modifiers.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: KWin, Plasma on Wayland.
Restricted Application added projects: Plasma on Wayland, KWin. · View Herald TranscriptOct 5 2016, 1:41 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
sebas accepted this revision.Oct 6 2016, 10:21 AM
sebas added a reviewer: sebas.
This revision is now accepted and ready to land.Oct 6 2016, 10:21 AM
luebking added inline comments.

Possible pitfalls:

What if eg. Ctrl+Alt+Foo creates a keysym, but Ctrl+Alt+Shift+Foo does not?

If however Ctrl+Alt+Foo and Ctrl+Alt+Shift+Foo create keysyms, Ctrl+Alt+Shift would be consumed but Ctrl+Alt should be considered consumed as well (so this test fails), right?

-> should one test for equality to rule out at least case one?

graesslin added inline comments.Oct 6 2016, 11:04 AM

Equality doesn't work: Alt+F3 consumes ctrl+Alt, but only alt is pressed.

This revision was automatically updated to reflect the committed changes.