From 5b1befa31a9851397d56363f058568094d11f5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 17 Jul 2020 23:31:41 +0200 Subject: Add QEvdevKeyMapper platform interface Task-number: QTBUG-84220 Change-Id: I4f3a54415c5509b4bde486b54c56b0e05976bac6 Reviewed-by: Friedemann Kleint --- .../platforms/eglfs/api/qeglfsintegration.cpp | 29 ++++++---------------- .../platforms/eglfs/api/qeglfsintegration_p.h | 13 +++++++--- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'src/plugins/platforms/eglfs') diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 3ce78623fa..befab97baa 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -432,39 +432,26 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const { -#if QT_CONFIG(evdev) - if (function == QEglFSFunctions::loadKeymapTypeIdentifier()) - return QFunctionPointer(loadKeymapStatic); - else if (function == QEglFSFunctions::switchLangTypeIdentifier()) - return QFunctionPointer(switchLangStatic); -#endif - return qt_egl_device_integration()->platformFunction(function); } -void QEglFSIntegration::loadKeymapStatic(const QString &filename) -{ #if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->loadKeymap(filename); +void QEglFSIntegration::loadKeymap(const QString &filename) +{ + if (m_kbdMgr) + m_kbdMgr->loadKeymap(filename); else qWarning("QEglFSIntegration: Cannot load keymap, no keyboard handler found"); -#else - Q_UNUSED(filename); -#endif } -void QEglFSIntegration::switchLangStatic() +void QEglFSIntegration::switchLang() { -#if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->switchLang(); + if (m_kbdMgr) + m_kbdMgr->switchLang(); else qWarning("QEglFSIntegration: Cannot switch language, no keyboard handler found"); -#endif } +#endif void QEglFSIntegration::createInputHandlers() { diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h index babcbfaaa4..9bc24f36f9 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -59,6 +59,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -68,8 +69,11 @@ class QFbVtHandler; class QEvdevKeyboardManager; class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface +#if QT_CONFIG(evdev) + , public QPlatformInterface::Private::QEvdevKeyMapper +#endif #ifndef QT_NO_OPENGL - , public QPlatformInterface::Private::QEGLIntegration + , public QPlatformInterface::Private::QEGLIntegration #endif { public: @@ -116,11 +120,14 @@ public: QPointer pointerWindow() { return m_pointerWindow; } void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; } +#if QT_CONFIG(evdev) + void loadKeymap(const QString &filename) override; + void switchLang() override; +#endif + private: EGLNativeDisplayType nativeDisplay() const; void createInputHandlers(); - static void loadKeymapStatic(const QString &filename); - static void switchLangStatic(); EGLDisplay m_display; QPlatformInputContext *m_inputContext; -- cgit v1.2.3