diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp index 28cd1a236f..343375a14a 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp @@ -43,9 +43,11 @@ #include #include #include + #include #include #include +#include #include "qeglplatformintegration_p.h" #include "qeglplatformcontext_p.h" @@ -82,8 +84,8 @@ QEGLPlatformIntegration::QEGLPlatformIntegration() : m_screen(0), m_display(EGL_NO_DISPLAY), m_inputContext(0), - mFontDb(new QGenericUnixFontDatabase), - mServices(new QGenericUnixServices) + m_fontDb(new QGenericUnixFontDatabase), + m_services(new QGenericUnixServices) { } @@ -111,6 +113,8 @@ void QEGLPlatformIntegration::initialize() screenAdded(m_screen); m_inputContext = QPlatformInputContextFactory::create(); + + m_vtHandler.reset(new QFbVtHandler); } QAbstractEventDispatcher *QEGLPlatformIntegration::createEventDispatcher() const @@ -120,12 +124,12 @@ QAbstractEventDispatcher *QEGLPlatformIntegration::createEventDispatcher() const QPlatformServices *QEGLPlatformIntegration::services() const { - return mServices.data(); + return m_services.data(); } QPlatformFontDatabase *QEGLPlatformIntegration::fontDatabase() const { - return mFontDb.data(); + return m_fontDb.data(); } QPlatformBackingStore *QEGLPlatformIntegration::createPlatformBackingStore(QWindow *window) const diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index ea667e7d6f..a5b131ced6 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QEGLPlatformScreen; class QEGLPlatformWindow; +class QFbVtHandler; class QEGLPlatformIntegration : public QPlatformIntegration, public QPlatformNativeInterface { @@ -88,8 +89,9 @@ private: QEGLPlatformScreen *m_screen; EGLDisplay m_display; QPlatformInputContext *m_inputContext; - QScopedPointer mFontDb; - QScopedPointer mServices; + QScopedPointer m_fontDb; + QScopedPointer m_services; + QScopedPointer m_vtHandler; }; QT_END_NAMESPACE diff --git a/src/platformsupport/fbconvenience/fbconvenience.pri b/src/platformsupport/fbconvenience/fbconvenience.pri index 6ccaa50af5..4634f57fb4 100644 --- a/src/platformsupport/fbconvenience/fbconvenience.pri +++ b/src/platformsupport/fbconvenience/fbconvenience.pri @@ -1,10 +1,11 @@ SOURCES += $$PWD/qfbscreen.cpp \ $$PWD/qfbbackingstore.cpp \ $$PWD/qfbwindow.cpp \ - $$PWD/qfbcursor.cpp + $$PWD/qfbcursor.cpp \ + $$PWD/qfbvthandler.cpp HEADERS += $$PWD/qfbscreen_p.h \ $$PWD/qfbbackingstore_p.h \ $$PWD/qfbwindow_p.h \ - $$PWD/qfbcursor_p.h - + $$PWD/qfbcursor_p.h \ + $$PWD/qfbvthandler_p.h diff --git a/src/plugins/platforms/kms/qkmsvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp similarity index 81% rename from src/plugins/platforms/kms/qkmsvthandler.cpp rename to src/platformsupport/fbconvenience/qfbvthandler.cpp index 5e5afd3161..edfd13d9bf 100644 --- a/src/plugins/platforms/kms/qkmsvthandler.cpp +++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -39,11 +39,17 @@ ** ****************************************************************************/ -#include +#include "qfbvthandler_p.h" #include #include + +#if defined(Q_OS_LINUX) && !defined(QT_NO_EVDEV) +#define HAS_VT +#endif + +#ifdef HAS_VT + #include -#include #include #ifdef K_OFF @@ -52,46 +58,51 @@ #define KBD_OFF_MODE K_RAW #endif +#endif // HAS_VT + QT_BEGIN_NAMESPACE -QKmsVTHandler *QKmsVTHandler::self = 0; +QFbVtHandler *QFbVtHandler::self = 0; -QKmsVTHandler::QKmsVTHandler(QObject *parent) +QFbVtHandler::QFbVtHandler(QObject *parent) : QObject(parent), m_tty(-1) { Q_ASSERT(!self); self = this; +#ifdef HAS_VT if (!isatty(0)) return; m_tty = 0; - - ioctl(m_tty, KDGKBMODE, &m_oldKbdMode); - if (!qgetenv("QT_KMS_TTYKBD").toInt()) { - ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE); + ::ioctl(m_tty, KDGKBMODE, &m_oldKbdMode); + if (!qgetenv("QT_QPA_ENABLE_TERMINAL_KEYBOARD").toInt()) { + ::ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE); QGuiApplicationPrivate *appd = QGuiApplicationPrivate::instance(); Q_ASSERT(appd); QSegfaultHandler::initialize(appd->argv, appd->argc); QSegfaultHandler::installCrashHandler(crashHandler); } +#endif } -QKmsVTHandler::~QKmsVTHandler() +QFbVtHandler::~QFbVtHandler() { self->cleanup(); self = 0; } -void QKmsVTHandler::cleanup() +void QFbVtHandler::cleanup() { if (m_tty == -1) return; - ioctl(m_tty, KDSKBMODE, m_oldKbdMode); +#ifdef HAS_VT + ::ioctl(m_tty, KDSKBMODE, m_oldKbdMode); +#endif } -void QKmsVTHandler::crashHandler() +void QFbVtHandler::crashHandler() { Q_ASSERT(self); self->cleanup(); diff --git a/src/plugins/platforms/kms/qkmsvthandler.h b/src/platformsupport/fbconvenience/qfbvthandler_p.h similarity index 89% rename from src/plugins/platforms/kms/qkmsvthandler.h rename to src/platformsupport/fbconvenience/qfbvthandler_p.h index 8c4f511bc8..d98cd5a9d1 100644 --- a/src/plugins/platforms/kms/qkmsvthandler.h +++ b/src/platformsupport/fbconvenience/qfbvthandler_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -39,26 +39,26 @@ ** ****************************************************************************/ -#ifndef QKMSVTHANDLER_H -#define QKMSVTHANDLER_H +#ifndef QFBVTHANDLER_H +#define QFBVTHANDLER_H #include QT_BEGIN_NAMESPACE -class QKmsVTHandler : public QObject +class QFbVtHandler : public QObject { Q_OBJECT public: - QKmsVTHandler(QObject *parent = 0); - ~QKmsVTHandler(); + QFbVtHandler(QObject *parent = 0); + ~QFbVtHandler(); private: void cleanup(); static void crashHandler(); - static QKmsVTHandler *self; + static QFbVtHandler *self; int m_tty; int m_oldKbdMode; }; diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro index 612a878736..1b3678f13a 100644 --- a/src/plugins/platforms/kms/kms.pro +++ b/src/plugins/platforms/kms/kms.pro @@ -21,8 +21,8 @@ SOURCES = main.cpp \ qkmscursor.cpp \ qkmsdevice.cpp \ qkmsbackingstore.cpp \ - qkmsnativeinterface.cpp \ - qkmsvthandler.cpp + qkmsnativeinterface.cpp + HEADERS = qkmsintegration.h \ qkmsscreen.h \ qkmscontext.h \ @@ -30,8 +30,7 @@ HEADERS = qkmsintegration.h \ qkmscursor.h \ qkmsdevice.h \ qkmsbackingstore.h \ - qkmsnativeinterface.h \ - qkmsvthandler.h + qkmsnativeinterface.h OTHER_FILES += \ kms.json diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp index 80c5887a28..63c6d08bdc 100644 --- a/src/plugins/platforms/kms/qkmsintegration.cpp +++ b/src/plugins/platforms/kms/qkmsintegration.cpp @@ -46,7 +46,6 @@ #include "qkmsbackingstore.h" #include "qkmscontext.h" #include "qkmsnativeinterface.h" -#include "qkmsvthandler.h" #if !defined(QT_NO_EVDEV) #include @@ -56,6 +55,8 @@ #include #include +#include + #include #include #include @@ -68,7 +69,7 @@ QKmsIntegration::QKmsIntegration() m_nativeInterface(new QKmsNativeInterface) { setenv("EGL_PLATFORM", "drm",1); - m_vtHandler = new QKmsVTHandler; + m_vtHandler = new QFbVtHandler; m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0); if (m_deviceDiscovery) { diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h index 0a626e6bd2..bba4f53d7c 100644 --- a/src/plugins/platforms/kms/qkmsintegration.h +++ b/src/plugins/platforms/kms/qkmsintegration.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE class QKmsScreen; class QKmsDevice; -class QKmsVTHandler; +class QFbVtHandler; class QKmsIntegration : public QObject, public QPlatformIntegration { @@ -85,7 +85,7 @@ private: QList m_devices; QPlatformFontDatabase *m_fontDatabase; QPlatformNativeInterface *m_nativeInterface; - QKmsVTHandler *m_vtHandler; + QFbVtHandler *m_vtHandler; QDeviceDiscovery *m_deviceDiscovery; }; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 53f48d5480..fdec574bce 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -43,18 +43,22 @@ #include "qlinuxfbscreen.h" #include +#include #include + +#include #include #include #include #include -#include +#include QT_BEGIN_NAMESPACE QLinuxFbIntegration::QLinuxFbIntegration(const QStringList ¶mList) - : m_fontDb(new QGenericUnixFontDatabase()) + : m_fontDb(new QGenericUnixFontDatabase), + m_services(new QGenericUnixServices) { m_primaryScreen = new QLinuxFbScreen(paramList); } @@ -70,6 +74,10 @@ void QLinuxFbIntegration::initialize() screenAdded(m_primaryScreen); else qWarning("linuxfb: Failed to initialize screen"); + + m_inputContext = QPlatformInputContextFactory::create(); + + m_vtHandler.reset(new QFbVtHandler); } bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const @@ -80,11 +88,6 @@ bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } -QPlatformPixmap *QLinuxFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const -{ - return new QRasterPlatformPixmap(type); -} - QPlatformBackingStore *QLinuxFbIntegration::createPlatformBackingStore(QWindow *window) const { return new QFbBackingStore(window); @@ -109,7 +112,12 @@ QList QLinuxFbIntegration::screens() const QPlatformFontDatabase *QLinuxFbIntegration::fontDatabase() const { - return m_fontDb; + return m_fontDb.data(); +} + +QPlatformServices *QLinuxFbIntegration::services() const +{ + return m_services.data(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index 965a6e4642..67742ecab9 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -46,9 +46,9 @@ QT_BEGIN_NAMESPACE -class QLinuxFbIntegrationPrivate; class QAbstractEventDispatcher; class QLinuxFbScreen; +class QFbVtHandler; class QLinuxFbIntegration : public QPlatformIntegration { @@ -59,21 +59,25 @@ public: void initialize() Q_DECL_OVERRIDE; bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; - QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE; QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformServices *services() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; } QList screens() const; private: QLinuxFbScreen *m_primaryScreen; - QPlatformFontDatabase *m_fontDb; - + QPlatformInputContext *m_inputContext; + QScopedPointer m_fontDb; + QScopedPointer m_services; + QScopedPointer m_vtHandler; }; QT_END_NAMESPACE #endif // QLINUXFBINTEGRATION_H -