summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJaeyoon Jung <jaeyoon.jung@lge.com>2021-03-25 07:50:25 +0900
committerJaeyoon Jung <jaeyoon.jung@lge.com>2021-04-13 15:44:18 +0900
commitbefa2e11a87876cd3da8336370ae8f7f2fed004c (patch)
tree30fba592e9c5d7334462acf2fb0dad0b241f6f46 /src
parent7e11da314c3d4678274ae7e4f58721e3e729e501 (diff)
Client: Allow inheritance of key translation
Use a virtual method keysymToQtKey for Qt key code translation, so that it can be customized by a descendant class if needed. Change-Id: I3b48346a63e2c6f134230fe15279faa95abe11a0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandinputdevice.cpp2
-rw-r--r--src/client/qwaylandinputdevice_p.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 4a046a134..3304b9118 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -1268,7 +1268,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
Qt::KeyboardModifiers modifiers = mParent->modifiers();
- int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, mXkbState.get(), code);
+ int qtkey = keysymToQtKey(sym, modifiers, mXkbState.get(), code);
QString text = QXkbCommon::lookupString(mXkbState.get(), code);
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index b23de1f42..4a216bc43 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -263,6 +263,12 @@ public:
struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); }
+#if QT_CONFIG(xkbcommon)
+ virtual int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers, xkb_state *state, xkb_keycode_t code) {
+ return QXkbCommon::keysymToQtKey(keysym, modifiers, state, code);
+ }
+#endif
+
private slots:
void handleFocusDestroyed();
void handleFocusLost();