summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2014-12-09 16:27:55 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-01-05 15:55:02 +0100
commit13ec068ce278bdf003b26abe05658668e91afe09 (patch)
treeff56afc918cbb754a27b5579c8b82098ea3e956f
parent8a4099a0aa86969744d1258244abf2b8d3e8ed26 (diff)
Compile in evdev code to linuxfb
Make it compatible with eglfs. The behavior is the same: By default mouse, keyboard and touch will all be initialized and, when having libudev support, discovered automatically. The environment variables QT_QPA_FB_DISABLE_INPUT and QT_QPA_FB_TSLIB can be used to used to disable the built-in input handlers and to force tslib instead of evdev, respectively. This allows embedded systems and applications to easily fall back from eglfs to linuxfb on devices that are not rendering via OpenGL. Dynamic hiding/showing of the mouse cursor is to be done separately, here we provide the necessary device discovery hooks only. [ChangeLog][QtGui] The linuxfb platform plugin's input device handling is now compatible with eglfs. The evdev keyboard, mouse and touch code is compiled in by default. Change-Id: I44bc661c53ae78c39b0f30486a475b4e639ab2d6 Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@theqtcompany.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor.cpp5
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor_p.h5
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp33
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h5
4 files changed, 47 insertions, 1 deletions
diff --git a/src/platformsupport/fbconvenience/qfbcursor.cpp b/src/platformsupport/fbconvenience/qfbcursor.cpp
index 49bc88d854..806556b1e4 100644
--- a/src/platformsupport/fbconvenience/qfbcursor.cpp
+++ b/src/platformsupport/fbconvenience/qfbcursor.cpp
@@ -137,4 +137,9 @@ void QFbCursor::setDirty()
}
}
+void QFbCursor::setMouseDeviceDiscovery(QDeviceDiscovery *dd)
+{
+ Q_UNUSED(dd);
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/qfbcursor_p.h b/src/platformsupport/fbconvenience/qfbcursor_p.h
index 95632f177b..75501a0ff0 100644
--- a/src/platformsupport/fbconvenience/qfbcursor_p.h
+++ b/src/platformsupport/fbconvenience/qfbcursor_p.h
@@ -50,9 +50,12 @@
QT_BEGIN_NAMESPACE
class QFbScreen;
+class QDeviceDiscovery;
class QFbCursor : public QPlatformCursor
{
+ Q_OBJECT
+
public:
QFbCursor(QFbScreen *screen);
@@ -71,6 +74,8 @@ public:
virtual bool isOnScreen() const { return mOnScreen; }
virtual QRect lastPainted() const { return mPrevRect; }
+ void setMouseDeviceDiscovery(QDeviceDiscovery *dd);
+
private:
void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
void setCursor(Qt::CursorShape shape);
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index b0d99e80c1..1600ee3f2b 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -46,6 +46,16 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
+#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
+#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
+#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
+#include <QtPlatformSupport/private/qevdevtouch_p.h>
+#endif
+
+#if !defined(QT_NO_TSLIB) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
+#include <QtPlatformSupport/private/qtslib_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
@@ -70,6 +80,9 @@ void QLinuxFbIntegration::initialize()
m_inputContext = QPlatformInputContextFactory::create();
m_vtHandler.reset(new QFbVtHandler);
+
+ if (!qEnvironmentVariableIntValue("QT_QPA_FB_DISABLE_INPUT"))
+ createInputHandlers();
}
bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
@@ -113,4 +126,24 @@ QPlatformServices *QLinuxFbIntegration::services() const
return m_services.data();
}
+void QLinuxFbIntegration::createInputHandlers()
+{
+#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
+ new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this);
+ QEvdevMouseManager *mouseMgr = new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this);
+ Q_FOREACH (QScreen *screen, QGuiApplication::screens()) {
+ QFbCursor *cursor = qobject_cast<QFbCursor *>(screen->handle()->cursor());
+ if (cursor)
+ cursor->setMouseDeviceDiscovery(mouseMgr->deviceDiscovery());
+ }
+#ifndef QT_NO_TSLIB
+ const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
+ if (useTslib)
+ new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
+ else
+#endif // QT_NO_TSLIB
+ new QEvdevTouchScreenHandlerThread(QString(), this);
+#endif
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index cabd943921..3e7e1c57f4 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -35,6 +35,7 @@
#define QLINUXFBINTEGRATION_H
#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE
@@ -42,7 +43,7 @@ class QAbstractEventDispatcher;
class QLinuxFbScreen;
class QFbVtHandler;
-class QLinuxFbIntegration : public QPlatformIntegration
+class QLinuxFbIntegration : public QPlatformIntegration, public QPlatformNativeInterface
{
public:
QLinuxFbIntegration(const QStringList &paramList);
@@ -63,6 +64,8 @@ public:
QList<QPlatformScreen *> screens() const;
private:
+ void createInputHandlers();
+
QLinuxFbScreen *m_primaryScreen;
QPlatformInputContext *m_inputContext;
QScopedPointer<QPlatformFontDatabase> m_fontDb;