Skip to content

fix global shortcuts for non-Latin symbols

Andrey Butirsky requested to merge (removed):global_shortcuts into master

Re-use Qt's implementation of handling non-Latin layouts here.

For full ASCII range support (Alt+`, etc.) Qt needs to be patched still:
QTBUG-90611, fix: https://codereview.qt-project.org/c/qt/qtbase/+/339895.
Without patched Qt, only alphabetical key shortcuts (on any layout) brought back to work.

QTBUG-62102 and some others Qt bugs currently workarounded in code here.

BUG: 375518

Without patched Qt, testNonLatinLayout detects Alt+` shortcut failure (this combination is currently disabled in the test for Qt 5):

$ dbus-run-session ~/kde/build/kde/workspace/kwin/bin/testGlobalShortcuts 
********* Start testing of GlobalShortcutsTest *********
Config: Using QtTest library 5.15.2, Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.1 20201016 (Red Hat 10.2.1-6)), fedora 33
QWARN  : GlobalShortcutsTest::initTestCase() kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5127:46: this compose sequence is a duplicate of another; skipping line
...
QWARN  : GlobalShortcutsTest::initTestCase() kwin_decorations: Could not locate decoration plugin
QWARN  : GlobalShortcutsTest::initTestCase() kwin_xwl: /tmp/.X11-unix is not owned by root. Your system might be compromised!
QWARN  : GlobalShortcutsTest::initTestCase() kwin_xwl: Failed to create Xwayland connection sockets
PASS   : GlobalShortcutsTest::initTestCase()
FAIL!  : GlobalShortcutsTest::testNonLatinLayout() 'triggeredSpy.count() == 1' returned FALSE. (Alt+`)
   Loc: [/home/bam/kde/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp(125)]
PASS   : GlobalShortcutsTest::testConsumedShift()
PASS   : GlobalShortcutsTest::testRepeatedTrigger()
QWARN  : GlobalShortcutsTest::testUserActionsMenu() This plugin does not support raise()
QWARN  : GlobalShortcutsTest::testUserActionsMenu() This plugin does not support grabbing the keyboard
PASS   : GlobalShortcutsTest::testUserActionsMenu()
FAIL!  : GlobalShortcutsTest::testMetaShiftW() Compared values are not the same
   Actual   (((triggeredSpy.count()))): 0
   Expected (1)                       : 1
   Loc: [/home/bam/kde/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp(234)]
PASS   : GlobalShortcutsTest::testComponseKey()
FAIL!  : GlobalShortcutsTest::testX11ClientShortcut() 'windowCreatedSpy.wait()' returned FALSE. ()
   Loc: [/home/bam/kde/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp(298)]
PASS   : GlobalShortcutsTest::testWaylandClientShortcut()
QWARN  : GlobalShortcutsTest::testSetupWindowShortcut() This plugin does not support propagateSizeHints()
QWARN  : GlobalShortcutsTest::testSetupWindowShortcut() This plugin does not support raise()
QWARN  : GlobalShortcutsTest::testSetupWindowShortcut() This plugin does not support grabbing the keyboard
XFAIL  : GlobalShortcutsTest::testSetupWindowShortcut() Edit does not have focus
   Loc: [/home/bam/kde/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp(396)]
FAIL!  : GlobalShortcutsTest::testSetupWindowShortcut() Compared values are not the same
   Loc: [/home/bam/kde/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp(413)]
PASS   : GlobalShortcutsTest::cleanupTestCase()
Totals: 7 passed, 4 failed, 0 skipped, 0 blacklisted, 40456ms
********* Finished testing of GlobalShortcutsTest *********

The tests currently are still somewhat depend on each other, so expect some false positive after testNonLatinLayout() fail.

Edited by Andrey Butirsky

Merge request reports