diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2012-01-04 08:33:28 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-01-04 10:34:40 +0100 |
commit | d5ea033df8cf0a2dec49fce639d84e7dd0a2fced (patch) | |
tree | 15d92a4990b612e73450d110a6cc820df8cdee2e /src/plugins/platforms/wayland/qwaylandwindow.cpp | |
parent | 62bba49c83849ca5904357de45c888f9fab3106a (diff) |
Implement subsurfaces extension
This allows you to have subwindows in the compositor.
We tried to experiment with composing subsurfaces client side, but the
architecture did not feel very lean. This however, requires the
compositor to compose each surface before drawing the surface. The
example compositors render the subsurfaces into the wl_surfaces texture.
This might not be a good idea.
Change-Id: I6e186b62d7b490de7f4e6c6f22fcf6c1e0a70df3
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/wayland/qwaylandwindow.cpp')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandwindow.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 73ed85096..9e45831b2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -55,18 +55,18 @@ #endif #include "qwaylandextendedsurface.h" +#include "qwaylandsubsurface.h" #include <QCoreApplication> #include <QtGui/QWindowSystemInterface> -#include <QDebug> - QWaylandWindow::QWaylandWindow(QWindow *window) : QPlatformWindow(window) , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) , mSurface(mDisplay->createSurface(this)) , mShellSurface(mDisplay->shell()->createShellSurface(this)) , mExtendedWindow(0) + , mSubSurfaceWindow(0) , mBuffer(0) , mWaitingForFrameSync(false) , mFrameCallback(0) @@ -76,14 +76,19 @@ QWaylandWindow::QWaylandWindow(QWindow *window) if (mDisplay->windowExtension()) mExtendedWindow = mDisplay->windowExtension()->getExtendedWindow(this); + if (mDisplay->subSurfaceExtension()) + mSubSurfaceWindow = mDisplay->subSurfaceExtension()->getSubSurfaceAwareWindow(this); #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid()); mDisplay->windowManagerIntegration()->authenticateWithToken(); #endif - //all surfaces are toplevel surfaces for now - wl_shell_surface_set_toplevel(mShellSurface->handle()); + if (parent() && mSubSurfaceWindow) { + mSubSurfaceWindow->setParent(static_cast<const QWaylandWindow *>(parent())); + } else { + wl_shell_surface_set_toplevel(mShellSurface->handle()); + } } QWaylandWindow::~QWaylandWindow() @@ -106,8 +111,10 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { - Q_UNUSED(parent); - qWarning("Sub window is not supported"); + const QWaylandWindow *parentWaylandWindow = static_cast<const QWaylandWindow *>(parent); + if (subSurfaceWindow()) { + subSurfaceWindow()->setParent(parentWaylandWindow); + } } void QWaylandWindow::setVisible(bool visible) @@ -192,3 +199,8 @@ QWaylandExtendedSurface *QWaylandWindow::extendedWindow() const { return mExtendedWindow; } + +QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const +{ + return mSubSurfaceWindow; +} |