diff options
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglplatformintegration.cpp')
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformintegration.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp index 7d05b54c15..fea2ae2369 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp @@ -50,6 +50,10 @@ #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 + #include <QtPlatformHeaders/qeglfsfunctions.h> #include "qeglplatformintegration_p.h" @@ -84,8 +88,7 @@ QT_BEGIN_NAMESPACE */ QEGLPlatformIntegration::QEGLPlatformIntegration() - : m_screen(0), - m_display(EGL_NO_DISPLAY), + : m_display(EGL_NO_DISPLAY), m_inputContext(0), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), @@ -95,9 +98,6 @@ QEGLPlatformIntegration::QEGLPlatformIntegration() QEGLPlatformIntegration::~QEGLPlatformIntegration() { - delete m_screen; - if (m_display != EGL_NO_DISPLAY) - eglTerminate(m_display); } void QEGLPlatformIntegration::initialize() @@ -110,14 +110,20 @@ void QEGLPlatformIntegration::initialize() if (!eglInitialize(m_display, &major, &minor)) qFatal("Could not initialize egl display"); - m_screen = createScreen(); - screenAdded(m_screen); - m_inputContext = QPlatformInputContextFactory::create(); m_vtHandler.reset(new QFbVtHandler); } +void QEGLPlatformIntegration::destroy() +{ + foreach (QWindow *w, qGuiApp->topLevelWindows()) + w->destroy(); + + if (m_display != EGL_NO_DISPLAY) + eglTerminate(m_display); +} + QAbstractEventDispatcher *QEGLPlatformIntegration::createEventDispatcher() const { return createUnixEventDispatcher(); @@ -219,7 +225,7 @@ void *QEGLPlatformIntegration::nativeResourceForIntegration(const QByteArray &re switch (resourceType(resource)) { case EglDisplay: - result = m_screen->display(); + result = display(); break; case NativeDisplay: result = reinterpret_cast<void*>(nativeDisplay()); @@ -257,7 +263,7 @@ void *QEGLPlatformIntegration::nativeResourceForWindow(const QByteArray &resourc if (window && window->handle()) result = static_cast<QEGLPlatformScreen *>(window->handle()->screen())->display(); else - result = m_screen->display(); + result = display(); break; case EglWindow: if (window && window->handle()) @@ -345,11 +351,17 @@ void QEGLPlatformIntegration::createInputHandlers() m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); QEvdevMouseManager *mouseMgr = new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); Q_FOREACH (QScreen *screen, QGuiApplication::screens()) { - QEGLPlatformCursor *cursor = static_cast<QEGLPlatformCursor *>(screen->handle()->cursor()); + QEGLPlatformCursor *cursor = qobject_cast<QEGLPlatformCursor *>(screen->handle()->cursor()); if (cursor) cursor->setMouseDeviceDiscovery(mouseMgr->deviceDiscovery()); } - new QEvdevTouchScreenHandlerThread(QString() /* spec */, this); +#ifndef QT_NO_TSLIB + const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); + if (useTslib) + new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); + else +#endif // QT_NO_TSLIB + new QEvdevTouchScreenHandlerThread(QString() /* spec */, this); #endif } |