From 1b905b3fa4955e26b39aaa51b0ca47e9c05e680b Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 8 Nov 2016 16:02:01 +0100 Subject: Enable building EGLFS and MinimalEGL with QT_NO_OPENGL It is possible to have support for EGL without having support for OpenGL for example with OpenVG. Unfortanately many features of EGLFS require OpenGL (Cursor, MultiWindow, QEGLPlatformContext, QBackingStore), so the plugins become pretty useless on their own. This is necessary if you still want to use Qt as a method to provide an EGL surface to render to via QWindow. This is the method by which Qt Quick uses OpenVG to render its content when available. Change-Id: I34973b21bf1932865950ce6a78b71b3a29360d65 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qplatformscreen.h | 1 - src/plugins/platforms/eglfs/api/api.pri | 13 +++++-- .../eglfs/api/qeglfsdeviceintegration.cpp | 9 ++++- .../platforms/eglfs/api/qeglfsintegration.cpp | 43 +++++++++++++++++----- .../platforms/eglfs/api/qeglfsintegration_p.h | 5 ++- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 11 +++++- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 37 +++++++++++++++---- src/plugins/platforms/eglfs/api/qeglfswindow_p.h | 16 ++++++-- src/plugins/platforms/eglfs/eglfs-plugin.pro | 2 + .../platforms/eglfs/eglfsdeviceintegration.pro | 5 ++- src/plugins/platforms/minimalegl/minimalegl.pro | 7 +++- .../minimalegl/qminimaleglintegration.cpp | 12 ++++-- .../platforms/minimalegl/qminimaleglintegration.h | 3 +- .../platforms/minimalegl/qminimaleglscreen.cpp | 14 +++++-- .../platforms/minimalegl/qminimaleglscreen.h | 4 +- 15 files changed, 142 insertions(+), 40 deletions(-) diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h index 030edea880..2d3cbaf170 100644 --- a/src/gui/kernel/qplatformscreen.h +++ b/src/gui/kernel/qplatformscreen.h @@ -66,7 +66,6 @@ QT_BEGIN_NAMESPACE class QPlatformBackingStore; -class QPlatformOpenGLContext; class QPlatformScreenPrivate; class QPlatformWindow; class QPlatformCursor; 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/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 3e1e93f1e4..80093922f8 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(screen)); +#else + Q_UNUSED(screen); + return nullptr; +#endif } void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 733f0bd139..7f1da614eb 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -42,9 +42,11 @@ #include #include -#include #include -#include +#ifndef QT_NO_OPENGL +# include +# include +#endif #include #include #include @@ -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 -#include -#include +#ifndef QT_NO_OPENGL +# include +# include +#endif #include #include #include #include #include -#include +#ifndef QT_NO_OPENGL +# include +#endif #include @@ -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(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(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); } } @@ -340,6 +360,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 +395,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..3d4f331057 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -82,9 +82,10 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; - +#endif bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; @@ -93,7 +94,9 @@ public: 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; +#ifndef QT_NO_OPENGL void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; +#endif NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE; QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE; 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 #include #include -#include +#ifndef QT_NO_OPENGL +# include +#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 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 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/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index e79b377d40..1e202e4ff4 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -41,13 +41,17 @@ #include #include #include -#include -#include +#ifndef QT_NO_OPENGL +# include +# include +# include +#endif #include -#include #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(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 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 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..d280197aae 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 -#include +#ifndef QT_NO_OPENGL +# include +#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); @@ -97,16 +102,21 @@ public: virtual void invalidateSurface() Q_DECL_OVERRIDE; virtual void resetSurface(); +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; } void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; } +#endif bool isRaster() const; - +#ifndef QT_NO_OPENGL QWindow *sourceWindow() const Q_DECL_OVERRIDE; const QPlatformTextureList *textures() const Q_DECL_OVERRIDE; void endCompositing() Q_DECL_OVERRIDE; +#endif protected: +#ifndef QT_NO_OPENGL QOpenGLCompositorBackingStore *m_backingStore; +#endif bool m_raster; WId m_winId; diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index cf4863975a..3844328ee0 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -2,6 +2,8 @@ TARGET = qeglfs QT += eglfsdeviceintegration-private +CONFIG += egl + SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro index 35af3615bd..5c084b33fc 100644 --- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro +++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro @@ -12,11 +12,14 @@ QT += \ core-private gui-private \ devicediscovery_support-private eventdispatcher_support-private \ service_support-private theme_support-private fontdatabase_support-private \ - fb_support-private egl_support-private platformcompositor_support-private + fb_support-private egl_support-private qtHaveModule(input_support-private): \ QT += input_support-private +qtHaveModule(platformcompositor_support-private): \ + QT += platformcompositor_support-private + LIBS += $$QMAKE_LIBS_DYNLOAD # Avoid X11 header collision, use generic EGL native types diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index 88466e7f36..b7dde9069f 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -14,14 +14,17 @@ DEFINES += QT_EGL_NO_X11 SOURCES = main.cpp \ qminimaleglintegration.cpp \ qminimaleglwindow.cpp \ - qminimaleglbackingstore.cpp \ qminimaleglscreen.cpp HEADERS = qminimaleglintegration.h \ qminimaleglwindow.h \ - qminimaleglbackingstore.h \ qminimaleglscreen.h +qtConfig(opengl) { + SOURCES += qminimaleglbackingstore.cpp + HEADERS += qminimaleglbackingstore.h +} + CONFIG += egl OTHER_FILES += \ diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index c564e1e431..81512b1561 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -40,8 +40,9 @@ #include "qminimaleglintegration.h" #include "qminimaleglwindow.h" -#include "qminimaleglbackingstore.h" - +#ifndef QT_NO_OPENGL +# include "qminimaleglbackingstore.h" +#endif #include #if defined(Q_OS_UNIX) @@ -127,13 +128,18 @@ QPlatformBackingStore *QMinimalEglIntegration::createPlatformBackingStore(QWindo #ifdef QEGL_EXTRA_DEBUG qWarning("QMinimalEglIntegration::createWindowSurface %p\n", window); #endif +#ifndef QT_NO_OPENGL return new QMinimalEglBackingStore(window); +#else + return nullptr; +#endif } - +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { return static_cast(context->screen()->handle())->platformContext(); } +#endif QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const { diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.h b/src/plugins/platforms/minimalegl/qminimaleglintegration.h index 529e89f85a..d0ab75bd3c 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.h +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.h @@ -55,8 +55,9 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; - +#endif QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp index d3d091fab7..0175d2dbdd 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp @@ -41,7 +41,9 @@ #include "qminimaleglwindow.h" #include -#include +#ifndef QT_NO_OPENGL +# include +#endif #ifdef Q_OPENKODE #include @@ -52,6 +54,8 @@ QT_BEGIN_NAMESPACE // #define QEGL_EXTRA_DEBUG +#ifndef QT_NO_OPENGL + class QMinimalEglContext : public QEGLPlatformContext { public: @@ -68,6 +72,8 @@ public: } }; +#endif + QMinimalEglScreen::QMinimalEglScreen(EGLNativeDisplayType display) : m_depth(32) , m_format(QImage::Format_Invalid) @@ -161,9 +167,10 @@ void QMinimalEglScreen::createAndSetPlatformContext() } // qWarning("Created surface %dx%d\n", w, h); +#ifndef QT_NO_OPENGL QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, 0, m_dpy); m_platformContext = platformContext; - +#endif EGLint w,h; // screen size detection eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); @@ -191,6 +198,7 @@ QImage::Format QMinimalEglScreen::format() const createAndSetPlatformContext(); return m_format; } +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *QMinimalEglScreen::platformContext() const { if (!m_platformContext) { @@ -199,5 +207,5 @@ QPlatformOpenGLContext *QMinimalEglScreen::platformContext() const } return m_platformContext; } - +#endif QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h index ba605835a8..24098b8127 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h +++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h @@ -59,9 +59,9 @@ public: QRect geometry() const Q_DECL_OVERRIDE; int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; - +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *platformContext() const; - +#endif EGLSurface surface() const { return m_surface; } private: -- cgit v1.2.3