summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r--src/plugins/platforms/eglfs/api/api.pri13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp9
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp43
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h5
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp11
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp37
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h16
-rw-r--r--src/plugins/platforms/eglfs/eglfs-plugin.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro5
9 files changed, 113 insertions, 28 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/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<QEglFSScreen *>(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 <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);
}
}
@@ -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 <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/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 <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..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 <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);
@@ -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