From ea22b8f15dd7be19d0d6b3bbcc20d64e191dd379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 17 Aug 2016 08:35:15 +0200 Subject: [PATCH] Introduce env variable KWIN_XKB_DEFAULT_KEYMAP to force default layout creation Summary: The Xkb class loads keyboard layouts from the users configuration. This makes tests fail locally if the user has a layout which behaves differently to the one the test expects. E.g. on a German layout the right alt key is different to the one of US layout. In order to have a more stable test base the env variable KWIN_XKB_DEFAULT_KEYMAP forces the loading of the default keymap, thus tests have a common layout set. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2466 --- autotests/integration/modifier_only_shortcut_test.cpp | 1 + keyboard_input.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index 6199eed01e..b613276f8d 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -92,6 +92,7 @@ void ModifierOnlyShortcutTest::initTestCase() QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); + qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); kwinApp()->start(); QVERIFY(workspaceCreatedSpy.wait()); diff --git a/keyboard_input.cpp b/keyboard_input.cpp index 3c9ef7f97d..1ce949c2cc 100644 --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -118,7 +118,10 @@ void Xkb::reconfigure() return; } - xkb_keymap *keymap = loadKeymapFromConfig(); + xkb_keymap *keymap = nullptr; + if (!qEnvironmentVariableIsSet("KWIN_XKB_DEFAULT_KEYMAP")) { + keymap = loadKeymapFromConfig(); + } if (!keymap) { qCDebug(KWIN_XKB) << "Could not create xkb keymap from configuration"; keymap = loadDefaultKeymap();