summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-12-14 21:07:08 +0100
committerGatis Paeglis <gatis.paeglis@qt.io>2019-04-25 07:00:09 +0000
commit23453c30084d09d7325e113bbc3d0637c51cb3e7 (patch)
tree6fe61eaeb57f0b6c928325af433439113fded158 /src/compositor
parent88c47136d57edc45bddd0bec4ce7953b191f4a42 (diff)
drop qwaylandxkb and share the logic with X11
QtWayland can benefit from sharing code with X11. This will fix issues that have been reported and fixed on XCB a long time ago. Task-number: QTBUG-65503 Fixes: QTBUG-71301 Fixes: QTBUG-66497 Change-Id: I09cbf8e1c9cf29e8d7f46b97bc2f11d6e91b61a5 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp11
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp3
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp11
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri6
4 files changed, 17 insertions, 14 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 856417fb4..8ff9e0905 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -72,7 +72,6 @@
#include "extensions/qwaylandqtwindowmanager.h"
-#include "qwaylandxkb_p.h"
#include "qwaylandsharedmemoryformathelper_p.h"
#include <QtCore/QCoreApplication>
@@ -129,12 +128,12 @@ public:
bool isDown = ke->keyType == QEvent::KeyPress;
#if QT_CONFIG(xkbcommon)
- QString text;
- Qt::KeyboardModifiers modifiers = QWaylandXkb::modifiers(keyb->xkbState());
+ xkb_state *xkbState = keyb->xkbState();
+ Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(xkbState);
- const xkb_keysym_t sym = xkb_state_key_get_one_sym(keyb->xkbState(), code);
- int qtkey;
- std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers);
+ const xkb_keysym_t sym = xkb_state_key_get_one_sym(xkbState, code);
+ int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, xkbState, code);
+ QString text = QXkbCommon::lookupString(xkbState, code);
ke->key = qtkey;
ke->modifiers = modifiers;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index f66fe3263..ffe536ce3 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -54,7 +54,6 @@
#if QT_CONFIG(xkbcommon)
#include <sys/mman.h>
#include <sys/types.h>
-#include <qwaylandxkb_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -206,7 +205,7 @@ void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable()
continue;
Qt::KeyboardModifiers mods = {};
- int qtKey = QWaylandXkb::keysymToQtKey(syms[0], mods).first;
+ int qtKey = QXkbCommon::keysymToQtKey(syms[0], mods);
if (qtKey != 0)
scanCodesByQtKey->insert({layout, qtKey}, keycode);
}
diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp
index 6cf33d18d..f60a32a14 100644
--- a/src/compositor/extensions/qwaylandtextinput.cpp
+++ b/src/compositor/extensions/qwaylandtextinput.cpp
@@ -45,12 +45,15 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
-#include "qwaylandxkb_p.h"
#include "qwaylandinputmethodeventbuilder_p.h"
#include <QGuiApplication>
#include <QInputMethodEvent>
+#if QT_CONFIG(xkbcommon)
+#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
QWaylandTextInputClientState::QWaylandTextInputClientState()
@@ -203,11 +206,15 @@ void QWaylandTextInputPrivate::sendKeyEvent(QKeyEvent *event)
// TODO add support for modifiers
- foreach (xkb_keysym_t keysym, QWaylandXkb::toKeysym(event)) {
+#if QT_CONFIG(xkbcommon)
+ for (xkb_keysym_t keysym : QXkbCommon::toKeysym(event)) {
send_keysym(focusResource->handle, event->timestamp(), keysym,
event->type() == QEvent::KeyPress ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED,
0);
}
+#else
+ Q_UNUSED(event);
+#endif
}
void QWaylandTextInputPrivate::sendInputPanelState()
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index b0c8371f4..08dd38e82 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -5,14 +5,12 @@ WAYLANDSERVERSOURCES += \
HEADERS += \
wayland_wrapper/qwlbuffermanager_p.h \
wayland_wrapper/qwlclientbuffer_p.h \
- wayland_wrapper/qwlregion_p.h \
- ../shared/qwaylandxkb_p.h \
+ wayland_wrapper/qwlregion_p.h
SOURCES += \
wayland_wrapper/qwlbuffermanager.cpp \
wayland_wrapper/qwlclientbuffer.cpp \
- wayland_wrapper/qwlregion.cpp \
- ../shared/qwaylandxkb.cpp \
+ wayland_wrapper/qwlregion.cpp
qtConfig(wayland-datadevice) {
HEADERS += \