From deed419755f3ed8409ba0cf784695ca7a3a6063a Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Wed, 30 Oct 2019 10:33:34 -0400 Subject: 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 Reviewed-by: Johan Helsing --- src/compositor/compositor_api/qwaylandcompositor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- cgit v1.2.3