diff --git a/autotests/test_xkb.cpp b/autotests/test_xkb.cpp
index d71f05f8ee..eeb548f32b 100644
--- a/autotests/test_xkb.cpp
+++ b/autotests/test_xkb.cpp
@@ -484,36 +484,6 @@ void XkbTest::testToQtKey()
{
Xkb xkb;
QFETCH(xkb_keysym_t, keySym);
- QEXPECT_FAIL("e0", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e1", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e2", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e3", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e4", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e5", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e6", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e7", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e8", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("e9", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("ea", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("eb", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("ec", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("ed", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("ee", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("ef", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f0", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f1", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f2", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f3", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f4", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f5", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f6", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f8", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("f9", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("fa", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("fb", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("fc", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("fd", "Incorrectly mapped by KKeyServer", Continue);
- QEXPECT_FAIL("fe", "Incorrectly mapped by KKeyServer", Continue);
QTEST(xkb.toQtKey(keySym), "qt");
}
diff --git a/xkb.cpp b/xkb.cpp
index c8b2fe0b03..9612930c5d 100644
--- a/xkb.cpp
+++ b/xkb.cpp
@@ -18,10 +18,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
#include "xkb.h"
+#include "xkb_qt_mapping.h"
#include "utils.h"
// frameworks
#include
-#include
// KWayland
#include
// Qt
@@ -442,12 +442,7 @@ QString Xkb::toString(xkb_keysym_t keysym)
Qt::Key Xkb::toQtKey(xkb_keysym_t keysym) const
{
- int key = Qt::Key_unknown;
- KKeyServer::symXToKeyQt(keysym, &key);
- if (key & Qt::KeyboardModifierMask) {
- key &= ~Qt::KeyboardModifierMask;
- }
- return static_cast(key);
+ return xkbToQtKey(keysym);
}
bool Xkb::shouldKeyRepeat(quint32 key) const
diff --git a/xkb_qt_mapping.h b/xkb_qt_mapping.h
new file mode 100644
index 0000000000..17f0197934
--- /dev/null
+++ b/xkb_qt_mapping.h
@@ -0,0 +1,278 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Martin Flöser
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+#ifndef KWIN_XKB_QT_MAPPING_H
+#define KWIN_XKB_QT_MAPPING_H
+
+#include
+
+#include