Bug 407720

Summary: Task switcher doesn’t show if win key is mapped to alt
Product: [Plasma] kwin Reporter: ariasuni <aria>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, nate, zuxio0iezici7oov
Priority: NOR Flags: vlad.zahorodnii: Wayland-
vlad.zahorodnii: X11+
vlad.zahorodnii: ReviewRequest+
Version: 5.15.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://phabricator.kde.org/D21302
Latest Commit: Version Fixed In: 5.16.3
Sentry Crash Report:

Description ariasuni 2019-05-19 11:26:18 UTC
SUMMARY
Task switcher doesn’t appear when shortcut contains a remapped key.

STEPS TO REPRODUCE
1. Go to System Settings -> Input devices -> Keyboard -> Advanced
2. Enable “Configure keyboard options” and Alt/Win key behavior -> Alt is mapped to Win and the usual Alt
3. Hit Win+Tab

OBSERVED RESULT
Windows are switched but you can only switch between the two last used windows because the task switcher doesn’t appear.

EXPECTED RESULT
Using win+tab is the same as using alt+tab when win is mapped to alt

SOFTWARE/OS VERSIONS
Arch Linux
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.58.0
Qt Version: 5.12.3
Comment 1 Patrick Silva 2019-05-19 23:03:40 UTC
it seems related to bug 404115
Comment 2 Vlad Zahorodnii 2019-05-20 09:39:02 UTC
Given that kwin switches one window forward, it seems like the shortcut works correctly. Most likely kwin thinks that modifiers are not depressed.
Comment 3 Vlad Zahorodnii 2019-05-20 10:17:45 UTC
I wonder why we need areKeySymXsDepressed.
Comment 4 Vlad Zahorodnii 2019-05-20 11:21:10 UTC
Aha! areKeySymXsDepressed makes some false assumptions about xcb_key_symbols_get_keycode. A keysym can be mapped to several keycodes, so we need to iterate over returned values and check if any modifier is depressed, though I would prefer to share areModKeysDepressedWayland on both Wayland session and X11 session.
Comment 5 ariasuni 2019-05-21 01:17:28 UTC
You’re right, it seems related to bug 404115.
Comment 6 Vlad Zahorodnii 2019-05-21 06:45:08 UTC
No, not really.
Comment 7 Vlad Zahorodnii 2019-05-21 12:43:32 UTC
Git commit 2cff5cb70a9e680f7c14fbd60b00e31143373399 by Vlad Zagorodniy.
Committed on 21/05/2019 at 12:43.
Pushed by vladz into branch 'master'.

[tabbox] Properly determine depressed modifiers on X11

Summary:
A keysym can be assigned to several keycodes, so more proper way to
determine whether given modifier is depressed is to iterate over all
returned keycodes and see if any is pressed.

If we check only the first keycode, then alternative mappings may not
work, e.g. alt key mapped to win, etc.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21302

M  +23   -29   tabbox/tabbox.cpp

https://commits.kde.org/kwin/2cff5cb70a9e680f7c14fbd60b00e31143373399
Comment 8 ariasuni 2019-05-22 00:21:37 UTC
Thanks a lot!!
Comment 9 zuxio0iezici7oov 2019-06-30 12:16:08 UTC
This is not fixed in my experience. I'm running with  Plasma/KWin 5.16.2, Frameworks 5.59.0 and Qt 5.12.4 and I'm still observing this behaviour.
Comment 10 Vlad Zahorodnii 2019-06-30 12:39:16 UTC
Can you post your .config/kxkbrc?
Comment 11 Vlad Zahorodnii 2019-06-30 12:41:40 UTC
Heh, yeah, that's right. I forgot to backport the patch to 5.16 branch.
Comment 12 Vlad Zahorodnii 2019-06-30 12:48:25 UTC
Git commit 499eccb1c8d75f596bc736cef5ce53aa0eb16e16 by Vlad Zagorodniy.
Committed on 30/06/2019 at 12:46.
Pushed by vladz into branch 'Plasma/5.16'.

[tabbox] Properly determine depressed modifiers on X11

Summary:
A keysym can be assigned to several keycodes, so more proper way to
determine whether given modifier is depressed is to iterate over all
returned keycodes and see if any is pressed.

If we check only the first keycode, then alternative mappings may not
work, e.g. alt key mapped to win, etc.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21302

M  +23   -29   tabbox/tabbox.cpp

https://commits.kde.org/kwin/499eccb1c8d75f596bc736cef5ce53aa0eb16e16