summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-19 10:18:24 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:33 +0200
commit1b77def8b1b083372786c5b0d0d00e4a62eece45 (patch)
tree05b681b90055668dbc18dfb34a8e06d63d31fcf0 /examples
parente713952c87e2e7b653acc3463481ec885212daca (diff)
Update QWindowCompositor to use the shell view directly
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
index 999d92865..b7fb08222 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
@@ -70,10 +70,12 @@ class Surface : public QWaylandSurface
public:
Surface(QWaylandClient *client, quint32 id, int version, QWaylandCompositor *compositor)
: QWaylandSurface(client, id, version, compositor)
+ , shellSurface(Q_NULLPTR)
, extSurface(Q_NULLPTR)
, hasSentOnScreen(false)
{ }
+ QtWayland::ShellSurface *shellSurface;
QtWayland::ExtendedSurface *extSurface;
bool hasSentOnScreen;
};
@@ -264,12 +266,14 @@ void QWindowCompositor::onSurfaceCreated(QWaylandSurface *surface)
connect(surface, &QWaylandSurface::redraw, this, &QWindowCompositor::surfaceCommittedSlot);
}
-void QWindowCompositor::onShellSurfaceCreated(QWaylandSurface *surface, QtWayland::ShellSurface *shellSurface)
+void QWindowCompositor::onShellSurfaceCreated(QWaylandSurface *s, QtWayland::ShellSurface *shellSurface)
{
+ Surface *surface = static_cast<Surface *>(s);
SurfaceView *newView = new SurfaceView();
newView->setSurface(surface);
newView->setOutput(output(m_window));
shellSurface->setView(newView);
+ surface->shellSurface = shellSurface;
m_renderScheduler.start(0);
}
@@ -373,7 +377,15 @@ void QWindowCompositor::render()
void QWindowCompositor::drawSubSurface(const QPoint &offset, QWaylandSurface *s)
{
Surface *surface = static_cast<Surface *>(s);
- SurfaceView *view = static_cast<SurfaceView *>(surface->views().first());
+ SurfaceView *view = Q_NULLPTR;
+ if (surface->shellSurface && surface->shellSurface->view())
+ view = static_cast<SurfaceView *>(surface->shellSurface->view());
+ else if (surface->views().size())
+ view = static_cast<SurfaceView *>(surface->views().first());
+
+ if (!view)
+ return;
+
GLuint texture = view->updateTextureToCurrentBuffer();
bool invert_y = view->currentBuffer().origin() == QWaylandSurface::OriginTopLeft;
QPoint pos = view->pos().toPoint() + offset;