summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/qeglfsintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfsintegration.cpp')
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index fbdd1d4c4d..a13a334433 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -45,6 +45,7 @@
#include "qeglfswindow.h"
#include "qeglfshooks.h"
#include "qeglfscontext.h"
+#include "qeglfsoffscreenwindow.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
@@ -62,43 +63,55 @@ QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
{
- mDisableInputHandlers = qgetenv("QT_QPA_EGLFS_DISABLE_INPUT").toInt();
+ mDisableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT");
initResources();
}
-QEglFSIntegration::~QEglFSIntegration()
-{
- QEglFSHooks::hooks()->platformDestroy();
-}
-
bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
// We assume that devices will have more and not less capabilities
- if (QEglFSHooks::hooks() && QEglFSHooks::hooks()->hasCapability(cap))
+ if (qt_egl_device_integration()->hasCapability(cap))
return true;
return QEGLPlatformIntegration::hasCapability(cap);
}
+void QEglFSIntegration::addScreen(QPlatformScreen *screen)
+{
+ screenAdded(screen);
+}
+
+void QEglFSIntegration::removeScreen(QPlatformScreen *screen)
+{
+ destroyScreen(screen);
+}
+
void QEglFSIntegration::initialize()
{
- QEglFSHooks::hooks()->platformInit();
+ qt_egl_device_integration()->platformInit();
QEGLPlatformIntegration::initialize();
if (!mDisableInputHandlers)
createInputHandlers();
+
+ if (qt_egl_device_integration()->usesDefaultScreen())
+ addScreen(new QEglFSScreen(display()));
+ else
+ qt_egl_device_integration()->screenInit();
}
-EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const
+void QEglFSIntegration::destroy()
{
- return QEglFSHooks::hooks()->platformDisplay();
+ qt_egl_device_integration()->screenDestroy();
+ QEGLPlatformIntegration::destroy();
+ qt_egl_device_integration()->platformDestroy();
}
-QEGLPlatformScreen *QEglFSIntegration::createScreen() const
+EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const
{
- return new QEglFSScreen(display());
+ return qt_egl_device_integration()->platformDisplay();
}
QEGLPlatformWindow *QEglFSIntegration::createWindow(QWindow *window) const
@@ -112,12 +125,12 @@ QEGLPlatformContext *QEglFSIntegration::createContext(const QSurfaceFormat &form
QVariant *nativeHandle) const
{
QEglFSContext *ctx;
- QSurfaceFormat adjustedFormat = QEglFSHooks::hooks()->surfaceFormatFor(format);
+ QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(format);
if (!nativeHandle || nativeHandle->isNull()) {
EGLConfig config = QEglFSIntegration::chooseConfig(display, adjustedFormat);
- ctx = new QEglFSContext(adjustedFormat, shareContext, display, &config, QVariant());
+ ctx = new QEglFSContext(adjustedFormat, shareContext, display, &config, QVariant());
} else {
- ctx = new QEglFSContext(adjustedFormat, shareContext, display, 0, *nativeHandle);
+ ctx = new QEglFSContext(adjustedFormat, shareContext, display, 0, *nativeHandle);
}
*nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), display));
return ctx;
@@ -127,41 +140,28 @@ QPlatformOffscreenSurface *QEglFSIntegration::createOffscreenSurface(EGLDisplay
const QSurfaceFormat &format,
QOffscreenSurface *surface) const
{
- return new QEGLPbuffer(display, QEglFSHooks::hooks()->surfaceFormatFor(format), surface);
-}
+ QSurfaceFormat fmt = qt_egl_device_integration()->surfaceFormatFor(format);
+ if (qt_egl_device_integration()->supportsPBuffers())
+ return new QEGLPbuffer(display, fmt, surface);
+ else
+ return new QEglFSOffscreenWindow(display, fmt, surface);
-QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
-{
- switch (hint)
- {
- case QPlatformIntegration::ShowIsFullScreen:
- return screen()->compositingWindow() == 0;
- default:
- return QPlatformIntegration::styleHint(hint);
- }
+ // Never return null. Multiple QWindows are not supported by this plugin.
}
EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
{
class Chooser : public QEglConfigChooser {
public:
- Chooser(EGLDisplay display, QEglFSHooks *hooks)
- : QEglConfigChooser(display)
- , m_hooks(hooks)
- {
- }
-
- protected:
- bool filterConfig(EGLConfig config) const
- {
- return m_hooks->filterConfig(display(), config) && QEglConfigChooser::filterConfig(config);
+ Chooser(EGLDisplay display)
+ : QEglConfigChooser(display) { }
+ bool filterConfig(EGLConfig config) const Q_DECL_OVERRIDE {
+ return qt_egl_device_integration()->filterConfig(display(), config)
+ && QEglConfigChooser::filterConfig(config);
}
-
- private:
- QEglFSHooks *m_hooks;
};
- Chooser chooser(display, QEglFSHooks::hooks());
+ Chooser chooser(display);
chooser.setSurfaceFormat(format);
return chooser.chooseConfig();
}