diff options
Diffstat (limited to 'src/plugins/platforms/eglfs/api')
-rw-r--r-- | src/plugins/platforms/eglfs/api/api.pri | 13 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfscontext_p.h | 10 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfscursor.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfscursor_p.h | 10 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 53 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsintegration_p.h | 45 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsscreen_p.h | 22 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 37 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfswindow_p.h | 50 |
12 files changed, 178 insertions, 92 deletions
diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri index 0ea65bd1ff..a6d81016b6 100644 --- a/src/plugins/platforms/eglfs/api/api.pri +++ b/src/plugins/platforms/eglfs/api/api.pri @@ -1,21 +1,26 @@ SOURCES += $$PWD/qeglfswindow.cpp \ $$PWD/qeglfsscreen.cpp \ - $$PWD/qeglfscursor.cpp \ $$PWD/qeglfshooks.cpp \ $$PWD/qeglfsdeviceintegration.cpp \ $$PWD/qeglfsintegration.cpp \ - $$PWD/qeglfscontext.cpp \ $$PWD/qeglfsoffscreenwindow.cpp HEADERS += $$PWD/qeglfswindow_p.h \ $$PWD/qeglfsscreen_p.h \ - $$PWD/qeglfscursor_p.h \ $$PWD/qeglfshooks_p.h \ $$PWD/qeglfsdeviceintegration_p.h \ $$PWD/qeglfsintegration_p.h \ - $$PWD/qeglfscontext_p.h \ $$PWD/qeglfsoffscreenwindow_p.h \ $$PWD/qeglfsglobal_p.h +qtConfig(opengl) { + SOURCES += \ + $$PWD/qeglfscursor.cpp \ + $$PWD/qeglfscontext.cpp + HEADERS += \ + $$PWD/qeglfscursor_p.h \ + $$PWD/qeglfscontext_p.h +} + INCLUDEPATH += $$PWD diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h index ab5bf99c3c..96f7f01381 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h @@ -62,11 +62,11 @@ class Q_EGLFS_EXPORT QEglFSContext : public QEGLPlatformContext public: QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig *config, const QVariant &nativeHandle); - EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) Q_DECL_OVERRIDE; - EGLSurface createTemporaryOffscreenSurface() Q_DECL_OVERRIDE; - void destroyTemporaryOffscreenSurface(EGLSurface surface) Q_DECL_OVERRIDE; - void runGLChecks() Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; + EGLSurface createTemporaryOffscreenSurface() override; + void destroyTemporaryOffscreenSurface(EGLSurface surface) override; + void runGLChecks() override; + void swapBuffers(QPlatformSurface *surface) override; private: EGLNativeWindowType m_tempWindow; diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 2b54251a06..19a0e03212 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -146,8 +146,8 @@ void QEglFSCursor::createShaderPrograms() GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); gfx.program = new QOpenGLShaderProgram; - gfx.program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); - gfx.program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); + gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); + gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); gfx.program->bindAttributeLocation("vertexCoordEntry", 0); gfx.program->bindAttributeLocation("textureCoordEntry", 1); gfx.program->link(); diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index bf6dbc8a21..942fb09aac 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -87,11 +87,11 @@ public: ~QEglFSCursor(); #ifndef QT_NO_CURSOR - void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE; + void changeCursor(QCursor *cursor, QWindow *widget) override; #endif - void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; - QPoint pos() const Q_DECL_OVERRIDE; - void setPos(const QPoint &pos) Q_DECL_OVERRIDE; + void pointerEvent(const QMouseEvent &event) override; + QPoint pos() const override; + void setPos(const QPoint &pos) override; QRect cursorRect() const; void paintOnScreen(); @@ -100,7 +100,7 @@ public: void updateMouseStatus(); private: - bool event(QEvent *e) Q_DECL_OVERRIDE; + bool event(QEvent *e) override; #ifndef QT_NO_CURSOR bool setCurrentCursor(QCursor *cursor); #endif diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 3e1e93f1e4..80708fd17a 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -39,7 +39,9 @@ #include "qeglfsdeviceintegration_p.h" #include "qeglfsintegration_p.h" -#include "qeglfscursor_p.h" +#ifndef QT_NO_OPENGL +# include "qeglfscursor_p.h" +#endif #include "qeglfswindow_p.h" #include "qeglfsscreen_p.h" #include "qeglfshooks_p.h" @@ -312,7 +314,12 @@ bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const { +#ifndef QT_NO_OPENGL return new QEglFSCursor(static_cast<QEglFSScreen *>(screen)); +#else + Q_UNUSED(screen); + return nullptr; +#endif } void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const @@ -355,7 +362,7 @@ EGLConfig QEglFSDeviceIntegration::chooseConfig(EGLDisplay display, const QSurfa public: Chooser(EGLDisplay display) : QEglConfigChooser(display) { } - bool filterConfig(EGLConfig config) const Q_DECL_OVERRIDE { + bool filterConfig(EGLConfig config) const override { return qt_egl_device_integration()->filterConfig(display(), config) && QEglConfigChooser::filterConfig(config); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 8cf6660c44..190f5a80d0 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -42,9 +42,11 @@ #include <qpa/qplatformwindow.h> #include <QtGui/QSurfaceFormat> -#include <QtGui/QOpenGLContext> #include <QtGui/QScreen> -#include <QtGui/QOffscreenSurface> +#ifndef QT_NO_OPENGL +# include <QtGui/QOpenGLContext> +# include <QtGui/QOffscreenSurface> +#endif #include <QtGui/QWindow> #include <QtCore/QLoggingCategory> #include <qpa/qwindowsysteminterface.h> @@ -53,20 +55,26 @@ #include "qeglfsintegration_p.h" #include "qeglfswindow_p.h" #include "qeglfshooks_p.h" -#include "qeglfscontext_p.h" +#ifndef QT_NO_OPENGL +# include "qeglfscontext_p.h" +# include "qeglfscursor_p.h" +#endif #include "qeglfsoffscreenwindow_p.h" -#include "qeglfscursor_p.h" #include <QtEglSupport/private/qeglconvenience_p.h> -#include <QtEglSupport/private/qeglplatformcontext_p.h> -#include <QtEglSupport/private/qeglpbuffer_p.h> +#ifndef QT_NO_OPENGL +# include <QtEglSupport/private/qeglplatformcontext_p.h> +# include <QtEglSupport/private/qeglpbuffer_p.h> +#endif #include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h> #include <QtServiceSupport/private/qgenericunixservices_p.h> #include <QtThemeSupport/private/qgenericunixthemes_p.h> #include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> #include <QtFbSupport/private/qfbvthandler_p.h> -#include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> +#ifndef QT_NO_OPENGL +# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> +#endif #include <QtPlatformHeaders/QEGLNativeContext> @@ -179,11 +187,15 @@ QPlatformTheme *QEglFSIntegration::createPlatformTheme(const QString &name) cons QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const { +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *bs = new QOpenGLCompositorBackingStore(window); if (!window->handle()) window->create(); static_cast<QEglFSWindow *>(window->handle())->setBackingStore(bs); return bs; +#else + return nullptr; +#endif } QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const @@ -196,6 +208,7 @@ QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const return w; } +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display(); @@ -230,6 +243,7 @@ QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOf } // Never return null. Multiple QWindows are not supported by this plugin. } +#endif // QT_NO_OPENGL bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { @@ -239,10 +253,16 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons switch (cap) { case ThreadedPixmaps: return true; +#ifndef QT_NO_OPENGL case OpenGL: return true; case ThreadedOpenGL: return true; - case WindowManagement: return false; case RasterGLSurface: return true; +#else + case OpenGL: return false; + case ThreadedOpenGL: return false; + case RasterGLSurface: return false; +#endif + case WindowManagement: return false; default: return QPlatformIntegration::hasCapability(cap); } } @@ -259,7 +279,8 @@ enum ResourceType { EglConfig, NativeDisplay, XlibDisplay, - WaylandDisplay + WaylandDisplay, + EglSurface }; static int resourceType(const QByteArray &key) @@ -271,7 +292,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("eglconfig"), QByteArrayLiteral("nativedisplay"), QByteArrayLiteral("display"), - QByteArrayLiteral("server_wl_display") + QByteArrayLiteral("server_wl_display"), + QByteArrayLiteral("eglsurface") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -333,6 +355,10 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi if (window && window->handle()) result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->eglWindow()); break; + case EglSurface: + if (window && window->handle()) + result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->surface()); + break; default: break; } @@ -340,6 +366,7 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi return result; } +#ifndef QT_NO_OPENGL void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { void *result = 0; @@ -374,13 +401,17 @@ static void *eglContextForContext(QOpenGLContext *context) return handle->eglContext(); } +#endif QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::nativeResourceFunctionForContext(const QByteArray &resource) { +#ifndef QT_NO_OPENGL QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "get_egl_context") return NativeResourceForContextFunction(eglContextForContext); - +#else + Q_UNUSED(resource); +#endif return 0; } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h index 1a3a44d441..080c8ed332 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -69,34 +69,37 @@ class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPl public: QEglFSIntegration(); - void initialize() Q_DECL_OVERRIDE; - void destroy() Q_DECL_OVERRIDE; + void initialize() override; + void destroy() override; EGLDisplay display() const { return m_display; } - 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; } - QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const override; + QPlatformFontDatabase *fontDatabase() const override; + QPlatformServices *services() const override; + QPlatformInputContext *inputContext() const override { return m_inputContext; } + QPlatformTheme *createPlatformTheme(const QString &name) const override; - QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; + QPlatformWindow *createPlatformWindow(QWindow *window) const override; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; +#ifndef QT_NO_OPENGL + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; +#endif + bool hasCapability(QPlatformIntegration::Capability cap) const override; - bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; - - QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface() const override; // QPlatformNativeInterface - void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; - void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE; - void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE; - void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; - NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE; - - QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE; + void *nativeResourceForIntegration(const QByteArray &resource) override; + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; +#ifndef QT_NO_OPENGL + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; +#endif + NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override; + + QFunctionPointer platformFunction(const QByteArray &function) const override; QFbVtHandler *vtHandler() { return m_vtHandler.data(); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h index ec483c64e2..9fdb81efdd 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h @@ -62,8 +62,8 @@ public: QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface); ~QEglFSOffscreenWindow(); - QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; } - bool isValid() const Q_DECL_OVERRIDE { return m_surface != EGL_NO_SURFACE; } + QSurfaceFormat format() const override { return m_format; } + bool isValid() const override { return m_surface != EGL_NO_SURFACE; } private: QSurfaceFormat m_format; diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 5613179041..d5c22b3d37 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -41,7 +41,9 @@ #include <QtGui/qwindow.h> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformcursor.h> -#include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +#ifndef QT_NO_OPENGL +# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +#endif #include "qeglfsscreen_p.h" #include "qeglfswindow_p.h" @@ -60,7 +62,9 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy) QEglFSScreen::~QEglFSScreen() { delete m_cursor; +#ifndef QT_NO_OPENGL QOpenGLCompositor::destroy(); +#endif } QRect QEglFSScreen::geometry() const @@ -145,6 +149,7 @@ void QEglFSScreen::setPrimarySurface(EGLSurface surface) void QEglFSScreen::handleCursorMove(const QPoint &pos) { +#ifndef QT_NO_OPENGL const QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); const QList<QOpenGLCompositorWindow *> windows = compositor->windows(); @@ -178,10 +183,12 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos) if (enter && leave) QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos); +#endif } QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) const { +#ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); const QList<QOpenGLCompositorWindow *> windows = compositor->windows(); Q_ASSERT(!windows.isEmpty()); @@ -224,7 +231,7 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c return QPixmap::fromImage(img).copy(rect); } } - +#endif // QT_NO_OPENGL return QPixmap(); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h index 131e619e06..bea7b4c8ef 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h @@ -67,22 +67,22 @@ public: QEglFSScreen(EGLDisplay display); ~QEglFSScreen(); - QRect geometry() const Q_DECL_OVERRIDE; + QRect geometry() const override; virtual QRect rawGeometry() const; - int depth() const Q_DECL_OVERRIDE; - QImage::Format format() const Q_DECL_OVERRIDE; + int depth() const override; + QImage::Format format() const override; - QSizeF physicalSize() const Q_DECL_OVERRIDE; - QDpi logicalDpi() const Q_DECL_OVERRIDE; - qreal pixelDensity() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const override; + QDpi logicalDpi() const override; + qreal pixelDensity() const override; + Qt::ScreenOrientation nativeOrientation() const override; + Qt::ScreenOrientation orientation() const override; - QPlatformCursor *cursor() const Q_DECL_OVERRIDE; + QPlatformCursor *cursor() const override; - qreal refreshRate() const Q_DECL_OVERRIDE; + qreal refreshRate() const override; - QPixmap grabWindow(WId wid, int x, int y, int width, int height) const Q_DECL_OVERRIDE; + QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override; EGLSurface primarySurface() const { return m_surface; } diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 639fc56d2b..12108fd1c4 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -41,13 +41,17 @@ #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> -#include <QtGui/private/qopenglcontext_p.h> -#include <QtGui/QOpenGLContext> +#ifndef QT_NO_OPENGL +# include <QtGui/private/qopenglcontext_p.h> +# include <QtGui/QOpenGLContext> +# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> +#endif #include <QtEglSupport/private/qeglconvenience_p.h> -#include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> #include "qeglfswindow_p.h" -#include "qeglfscursor_p.h" +#ifndef QT_NO_OPENGL +# include "qeglfscursor_p.h" +#endif #include "qeglfshooks_p.h" #include "qeglfsdeviceintegration_p.h" @@ -55,7 +59,9 @@ QT_BEGIN_NAMESPACE QEglFSWindow::QEglFSWindow(QWindow *w) : QPlatformWindow(w), +#ifndef QT_NO_OPENGL m_backingStore(0), +#endif m_raster(false), m_winId(0), m_surface(EGL_NO_SURFACE), @@ -107,6 +113,7 @@ void QEglFSWindow::create() // raster windows will not have their own native window, surface and context. Instead, // they will be composited onto the root window's surface. QEglFSScreen *screen = this->screen(); +#ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); if (screen->primarySurface() != EGL_NO_SURFACE) { if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) { @@ -120,6 +127,7 @@ void QEglFSWindow::create() m_format = compositor->targetWindow()->format(); return; } +#endif // QT_NO_OPENGL m_flags |= HasNativeWindow; setGeometry(QRect()); // will become fullscreen @@ -135,6 +143,7 @@ void QEglFSWindow::create() screen->setPrimarySurface(m_surface); +#ifndef QT_NO_OPENGL if (isRaster()) { QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance()); context->setShareContext(qt_gl_global_share_context()); @@ -153,16 +162,18 @@ void QEglFSWindow::create() QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); } } +#endif // QT_NO_OPENGL } void QEglFSWindow::destroy() { QEglFSScreen *screen = this->screen(); if (m_flags.testFlag(HasNativeWindow)) { +#ifndef QT_NO_OPENGL QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(screen->cursor()); if (cursor) cursor->resetResources(); - +#endif if (screen->primarySurface() == m_surface) screen->setPrimarySurface(EGL_NO_SURFACE); @@ -170,7 +181,9 @@ void QEglFSWindow::destroy() } m_flags = 0; +#ifndef QT_NO_OPENGL QOpenGLCompositor::instance()->removeWindow(this); +#endif } void QEglFSWindow::invalidateSurface() @@ -197,6 +210,7 @@ void QEglFSWindow::resetSurface() void QEglFSWindow::setVisible(bool visible) { +#ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); QList<QOpenGLCompositorWindow *> windows = compositor->windows(); QWindow *wnd = window(); @@ -211,7 +225,9 @@ void QEglFSWindow::setVisible(bool visible) windows.last()->sourceWindow()->requestActivate(); } } - +#else + QWindow *wnd = window(); +#endif QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); if (visible) @@ -247,9 +263,10 @@ QRect QEglFSWindow::geometry() const void QEglFSWindow::requestActivateWindow() { +#ifndef QT_NO_OPENGL if (window()->type() != Qt::Desktop) QOpenGLCompositor::instance()->moveToTop(this); - +#endif QWindow *wnd = window(); QWindowSystemInterface::handleWindowActivated(wnd); QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); @@ -259,13 +276,16 @@ void QEglFSWindow::raise() { QWindow *wnd = window(); if (wnd->type() != Qt::Desktop) { +#ifndef QT_NO_OPENGL QOpenGLCompositor::instance()->moveToTop(this); +#endif QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); } } void QEglFSWindow::lower() { +#ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); QList<QOpenGLCompositorWindow *> windows = compositor->windows(); if (window()->type() != Qt::Desktop && windows.count() > 1) { @@ -276,6 +296,7 @@ void QEglFSWindow::lower() QRect(QPoint(0, 0), windows.last()->sourceWindow()->geometry().size())); } } +#endif } EGLSurface QEglFSWindow::surface() const @@ -303,6 +324,7 @@ bool QEglFSWindow::isRaster() const return m_raster || window()->surfaceType() == QSurface::RasterGLSurface; } +#ifndef QT_NO_OPENGL QWindow *QEglFSWindow::sourceWindow() const { return window(); @@ -321,6 +343,7 @@ void QEglFSWindow::endCompositing() if (m_backingStore) m_backingStore->notifyComposited(); } +#endif WId QEglFSWindow::winId() const { diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index 0889f27ae3..6bda262523 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -56,14 +56,19 @@ #include "qeglfsscreen_p.h" #include <qpa/qplatformwindow.h> -#include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +#ifndef QT_NO_OPENGL +# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +#endif QT_BEGIN_NAMESPACE class QOpenGLCompositorBackingStore; class QPlatformTextureList; - +#ifndef QT_NO_OPENGL class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow +#else +class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow +#endif { public: QEglFSWindow(QWindow *w); @@ -72,21 +77,21 @@ public: void create(); void destroy(); - void setGeometry(const QRect &) Q_DECL_OVERRIDE; - QRect geometry() const Q_DECL_OVERRIDE; - void setVisible(bool visible) Q_DECL_OVERRIDE; - void requestActivateWindow() Q_DECL_OVERRIDE; - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; + void setGeometry(const QRect &) override; + QRect geometry() const override; + void setVisible(bool visible) override; + void requestActivateWindow() override; + void raise() override; + void lower() override; - void propagateSizeHints() Q_DECL_OVERRIDE { } - void setMask(const QRegion &) Q_DECL_OVERRIDE { } - bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } - bool setMouseGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } - void setOpacity(qreal) Q_DECL_OVERRIDE; - WId winId() const Q_DECL_OVERRIDE; + void propagateSizeHints() override { } + void setMask(const QRegion &) override { } + bool setKeyboardGrabEnabled(bool) override { return false; } + bool setMouseGrabEnabled(bool) override { return false; } + void setOpacity(qreal) override; + WId winId() const override; - QSurfaceFormat format() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; EGLNativeWindowType eglWindow() const; EGLSurface surface() const; @@ -94,19 +99,24 @@ public: bool hasNativeWindow() const { return m_flags.testFlag(HasNativeWindow); } - virtual void invalidateSurface() Q_DECL_OVERRIDE; + void invalidateSurface() override; virtual void resetSurface(); +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; } void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; } +#endif bool isRaster() const; - - QWindow *sourceWindow() const Q_DECL_OVERRIDE; - const QPlatformTextureList *textures() const Q_DECL_OVERRIDE; - void endCompositing() Q_DECL_OVERRIDE; +#ifndef QT_NO_OPENGL + QWindow *sourceWindow() const override; + const QPlatformTextureList *textures() const override; + void endCompositing() override; +#endif protected: +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *m_backingStore; +#endif bool m_raster; WId m_winId; |