summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McDonnell <jmcdonnell@blackberry.com>2019-10-30 10:33:34 -0400
committerJames McDonnell <jmcdonnell@blackberry.com>2020-01-31 17:45:33 -0500
commitdeed419755f3ed8409ba0cf784695ca7a3a6063a (patch)
tree39dff40fd377e6e07b5efa9a9fc118c481f7cb34
parent35dfb5a5d4a3758f48406c0b6d871000c9c59799 (diff)
Turn QNX key codes into xkbcommon key codes
This just requires adding 8 to the key code when the platform plugin is qnx. Inherited from evdev which inherited it from XKB. It's easier to conform to the requirement than remove it. Change-Id: Icd32ebf27256f29405821c7c8b7b8d93ff7f8fe0 Reviewed-by: Dan Cape <dcape@qnx.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index e6402007e..83833991f 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -114,6 +114,15 @@ public:
QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(seat->keyboard());
+#if defined(Q_OS_QNX)
+ // The QNX platform plugin delivers scan codes that haven't been adjusted to be
+ // xkbcommon compatible. xkbcommon requires that the scan codes be bumped up by
+ // 8 because that's how evdev/XKB deliver scan codes. You might think that it
+ // would've been better to remove this (odd) requirement from xkbcommon on QNX
+ // but it turns out that conforming to it has much less impact.
+ static int offset = QGuiApplication::platformName() == QStringLiteral("qnx") ? 8 : 0;
+ ke->nativeScanCode += offset;
+#endif
uint32_t code = ke->nativeScanCode;
bool isDown = ke->keyType == QEvent::KeyPress;