summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2014-01-24 13:50:26 +0100
committerThe Qt Project <[email protected]>2014-01-24 15:31:51 +0100
commita9f59f981d852d14f7f2b9226b1f2345b36e2e6f (patch)
treeed93989af5f123e5b642fe28b1394f7ad85fe9ed
parente02bda210539ec3f2fda266e7f707cbedd19f3ba (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 <[email protected]>
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration.cpp12
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration_p.h6
-rw-r--r--src/platformsupport/fbconvenience/fbconvenience.pri7
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp (renamed from src/plugins/platforms/kms/qkmsvthandler.cpp)37
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler_p.h (renamed from src/plugins/platforms/kms/qkmsvthandler.h)14
-rw-r--r--src/plugins/platforms/kms/kms.pro7
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.cpp5
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.h4
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp24
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h14
10 files changed, 80 insertions, 50 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
index 28cd1a236f5..343375a14a5 100644
--- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
@@ -43,9 +43,11 @@
#include <QtGui/QOpenGLContext>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatforminputcontextfactory_p.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 "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 ea667e7d6fb..a5b131ced68 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<QPlatformFontDatabase> mFontDb;
- QScopedPointer<QPlatformServices> mServices;
+ QScopedPointer<QPlatformFontDatabase> m_fontDb;
+ QScopedPointer<QPlatformServices> m_services;
+ QScopedPointer<QFbVtHandler> m_vtHandler;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/fbconvenience.pri b/src/platformsupport/fbconvenience/fbconvenience.pri
index 6ccaa50af5a..4634f57fb40 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
index 5e5afd3161e..edfd13d9bfd 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 <qkmsvthandler.h>
+#include "qfbvthandler_p.h"
#include <QtCore/private/qcrashhandler_p.h>
#include <QtGui/private/qguiapplication_p.h>
+
+#if defined(Q_OS_LINUX) && !defined(QT_NO_EVDEV)
+#define HAS_VT
+#endif
+
+#ifdef HAS_VT
+
#include <sys/ioctl.h>
-#include <linux/vt.h>
#include <linux/kd.h>
#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
index 8c4f511bc81..d98cd5a9d1f 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 <QObject>
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 612a8787360..1b3678f13ab 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 80c5887a28c..63c6d08bdc4 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 0a626e6bd2e..bba4f53d7cc 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/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 53f48d54803..fdec574bce5 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 &paramList)
- : 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 965a6e46423..67742ecab99 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
-