diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-01-24 13:50:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-24 15:31:51 +0100 |
commit | a9f59f981d852d14f7f2b9226b1f2345b36e2e6f (patch) | |
tree | ed93989af5f123e5b642fe28b1394f7ad85fe9ed /src/plugins | |
parent | e02bda210539ec3f2fda266e7f707cbedd19f3ba (diff) |
Disable terminal keyboard on eglfs and linuxfb
Unify the behavior for eglfs, linuxfb and kms. The relevant code is
now moved from kms into fbconvenience.
From now on, on all three platforms, terminal keyboard input is turned
off by default. This feature can be disabled by setting
QT_QPA_ENABLE_TERMINAL_KEYBOARD to 1. This is similar to what the
evdev-based keyboard handler did in QWS in Qt4.
[ChangeLog][QtGui] The main Embedded Linux platform plugins (eglfs,
linuxfb, kms) are changed to behave identically with regards to
terminal keyboard input: it is turned off by default on all of these
platforms. If this feature is not desired, it can be disabled by
setting the environment variable QT_QPA_ENABLE_TERMINAL_KEYBOARD.
Task-number: QTBUG-36394
Change-Id: I69e47ed7580464dc5e703e9a0e23891c7c8b7790
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/kms/kms.pro | 7 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsintegration.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsintegration.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsvthandler.cpp | 100 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsvthandler.h | 68 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 24 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 14 |
7 files changed, 33 insertions, 189 deletions
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 <QtPlatformSupport/private/qevdevmousemanager_p.h> @@ -56,6 +55,8 @@ #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> +#include <QtPlatformSupport/private/qfbvthandler_p.h> + #include <QtGui/private/qguiapplication_p.h> #include <QtGui/QOpenGLContext> #include <QtGui/QScreen> @@ -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<QKmsDevice *> m_devices; QPlatformFontDatabase *m_fontDatabase; QPlatformNativeInterface *m_nativeInterface; - QKmsVTHandler *m_vtHandler; + QFbVtHandler *m_vtHandler; QDeviceDiscovery *m_deviceDiscovery; }; diff --git a/src/plugins/platforms/kms/qkmsvthandler.cpp b/src/plugins/platforms/kms/qkmsvthandler.cpp deleted file mode 100644 index 5e5afd3161..0000000000 --- a/src/plugins/platforms/kms/qkmsvthandler.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qkmsvthandler.h> -#include <QtCore/private/qcrashhandler_p.h> -#include <QtGui/private/qguiapplication_p.h> -#include <sys/ioctl.h> -#include <linux/vt.h> -#include <linux/kd.h> - -#ifdef K_OFF -#define KBD_OFF_MODE K_OFF -#else -#define KBD_OFF_MODE K_RAW -#endif - -QT_BEGIN_NAMESPACE - -QKmsVTHandler *QKmsVTHandler::self = 0; - -QKmsVTHandler::QKmsVTHandler(QObject *parent) - : QObject(parent), m_tty(-1) -{ - Q_ASSERT(!self); - self = this; - - 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); - QGuiApplicationPrivate *appd = QGuiApplicationPrivate::instance(); - Q_ASSERT(appd); - QSegfaultHandler::initialize(appd->argv, appd->argc); - QSegfaultHandler::installCrashHandler(crashHandler); - } -} - -QKmsVTHandler::~QKmsVTHandler() -{ - self->cleanup(); - self = 0; -} - -void QKmsVTHandler::cleanup() -{ - if (m_tty == -1) - return; - - ioctl(m_tty, KDSKBMODE, m_oldKbdMode); -} - -void QKmsVTHandler::crashHandler() -{ - Q_ASSERT(self); - self->cleanup(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsvthandler.h b/src/plugins/platforms/kms/qkmsvthandler.h deleted file mode 100644 index 8c4f511bc8..0000000000 --- a/src/plugins/platforms/kms/qkmsvthandler.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QKMSVTHANDLER_H -#define QKMSVTHANDLER_H - -#include <QObject> - -QT_BEGIN_NAMESPACE - -class QKmsVTHandler : public QObject -{ - Q_OBJECT - -public: - QKmsVTHandler(QObject *parent = 0); - ~QKmsVTHandler(); - -private: - void cleanup(); - static void crashHandler(); - - static QKmsVTHandler *self; - int m_tty; - int m_oldKbdMode; -}; - -QT_END_NAMESPACE - -#endif 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 <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> +#include <QtPlatformSupport/private/qgenericunixservices_p.h> #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> + +#include <QtPlatformSupport/private/qfbvthandler_p.h> #include <QtPlatformSupport/private/qfbbackingstore_p.h> #include <QtPlatformSupport/private/qfbwindow_p.h> #include <QtPlatformSupport/private/qfbcursor_p.h> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/private/qpixmap_raster_p.h> +#include <qpa/qplatforminputcontextfactory_p.h> 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<QPlatformScreen *> 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<QPlatformScreen *> screens() const; private: QLinuxFbScreen *m_primaryScreen; - QPlatformFontDatabase *m_fontDb; - + QPlatformInputContext *m_inputContext; + QScopedPointer<QPlatformFontDatabase> m_fontDb; + QScopedPointer<QPlatformServices> m_services; + QScopedPointer<QFbVtHandler> m_vtHandler; }; QT_END_NAMESPACE #endif // QLINUXFBINTEGRATION_H - |