diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-01-06 14:51:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-17 14:30:48 +0100 |
commit | 328f2f9c35f3cc5e7049a060a608c3f72876484a (patch) | |
tree | 984f0f52446b95da5d7240122dcfbec02b0933b5 /src/plugins/platforms/eglfs/qeglfswindow.cpp | |
parent | 93154216ca7c7a46836716150fe70987d28d6f3c (diff) |
eglfs: Move reusable functionality to eglconvenience
The cursor implementation is generic GL(ES) code that should be shared
by all the present and future egl-based embedded platform
plugins. Follow the pattern of QEGLPlatformContext and move this class
into eglconvenience as QEGLPlatformCursor.
Similarly, the common bits from the context implementation context are
moved back to EGLPlatformContext.
eglconvenience has now base classes for integration, screen, window,
etc. too. By using these, eglfs becomes much smaller and cleaner. This
also paves the way for creating new, separate EGL-based platform
plugins for Android, embedded Linux, etc.
Also added some documentation to each of the base classes.
devicediscovery is now fixed to be usable on any platform. The
implementation in this case is naturally a dummy one. This finally
allows using it from anywhere without myriads of ugly ifdefs.
Change-Id: I02946e360c04e02de7fe234a23a08320eff4ccf5
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfswindow.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfswindow.cpp | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index cc0e64a83b..279e7bbc91 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -41,13 +41,11 @@ #include "qeglfswindow.h" #include "qeglfshooks.h" -#include "qeglfscursor.h" -#include "qeglfsbackingstore.h" #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> #include <QtGui/QOpenGLContext> - +#include <QtPlatformSupport/private/qeglplatformcursor_p.h> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtDebug> @@ -55,11 +53,9 @@ QT_BEGIN_NAMESPACE QEglFSWindow::QEglFSWindow(QWindow *w) - : QPlatformWindow(w) + : QEGLPlatformWindow(w) , m_surface(0) , m_window(0) - , m_wid(0) - , m_backingStore(0) , m_flags(0) { #ifdef QEGL_EXTRA_DEBUG @@ -72,41 +68,24 @@ QEglFSWindow::~QEglFSWindow() destroy(); } -static WId newWId() -{ - static WId id = 0; - - if (id == std::numeric_limits<WId>::max()) - qWarning("EGLFS: Out of window IDs"); - - return ++id; -} - void QEglFSWindow::create() { if (m_flags.testFlag(Created)) return; + QEGLPlatformWindow::create(); + m_flags = Created; - m_wid = newWId(); - if (window()->type() == Qt::Desktop) { - QRect rect(QPoint(), QEglFSHooks::hooks()->screenSize()); - QPlatformWindow::setGeometry(rect); - QWindowSystemInterface::handleGeometryChange(window(), rect); + if (window()->type() == Qt::Desktop) return; - } - - // Save the original surface type before changing to OpenGLSurface. - if (window()->surfaceType() == QSurface::RasterSurface) - m_flags |= IsRaster; // Stop if there is already a window backed by a native window and surface. Additional // 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(); if (screen->primarySurface() != EGL_NO_SURFACE) { - if (m_flags.testFlag(IsRaster) && screen->rootWindow()->m_flags.testFlag(IsRaster)) + if (isRaster() && screen->compositingWindow()) return; #if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK) @@ -118,7 +97,6 @@ void QEglFSWindow::create() return; } - window()->setSurfaceType(QSurface::OpenGLSurface); m_flags |= HasNativeWindow; setGeometry(QRect()); // will become fullscreen QWindowSystemInterface::handleExposeEvent(window(), geometry()); @@ -132,12 +110,13 @@ void QEglFSWindow::create() screen->setPrimarySurface(m_surface); - if (m_flags.testFlag(IsRaster)) { + if (isRaster()) { QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance()); context->setFormat(window()->requestedFormat()); context->setScreen(window()->screen()); context->create(); screen->setRootContext(context); + screen->setRootWindow(this); } } @@ -145,7 +124,7 @@ void QEglFSWindow::destroy() { QEglFSScreen *screen = this->screen(); if (m_flags.testFlag(HasNativeWindow)) { - QEglFSCursor *cursor = static_cast<QEglFSCursor *>(screen->cursor()); + QEGLPlatformCursor *cursor = static_cast<QEGLPlatformCursor *>(screen->cursor()); if (cursor) cursor->resetResources(); @@ -188,7 +167,7 @@ void QEglFSWindow::resetSurface() void QEglFSWindow::setVisible(bool visible) { - QList<QEglFSWindow *> windows = screen()->windows(); + QList<QEGLPlatformWindow *> windows = screen()->windows(); if (window()->type() != Qt::Desktop) { if (visible) { @@ -234,11 +213,6 @@ QRect QEglFSWindow::geometry() const return QPlatformWindow::geometry(); } -WId QEglFSWindow::winId() const -{ - return m_wid; -} - void QEglFSWindow::requestActivateWindow() { if (window()->type() != Qt::Desktop) @@ -258,7 +232,7 @@ void QEglFSWindow::raise() void QEglFSWindow::lower() { - QList<QEglFSWindow *> windows = screen()->windows(); + QList<QEGLPlatformWindow *> windows = screen()->windows(); if (window()->type() != Qt::Desktop && windows.count() > 1) { int idx = windows.indexOf(this); if (idx > 0) { @@ -288,12 +262,4 @@ QEglFSScreen *QEglFSWindow::screen() const return static_cast<QEglFSScreen *>(QPlatformWindow::screen()); } -uint QEglFSWindow::texture() const -{ - if (m_backingStore) - return m_backingStore->texture(); - - return 0; -} - QT_END_NAMESPACE |