summaryrefslogtreecommitdiffstats
path: root/examples/wayland/qwindow-compositor
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-05-21 16:02:09 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:32 +0200
commite4e9dba8b0f8f08293e2923d82dba9f49f7c9ffb (patch)
tree3c5460d1dc70d24452b400f633d82a9f5d3ada36 /examples/wayland/qwindow-compositor
parente0f3d22925857e654d400d0878e2dec192a1d2d7 (diff)
Enable shell surface on qwindow compositor
Diffstat (limited to 'examples/wayland/qwindow-compositor')
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.cpp15
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.h6
2 files changed, 16 insertions, 5 deletions
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
index bba560341..0f8462211 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
@@ -116,6 +116,9 @@ QWindowCompositor::QWindowCompositor(CompositorWindow *window)
QOpenGLFunctions *functions = m_window->context()->functions();
functions->glGenFramebuffers(1, &m_surface_fbo);
+
+ QtWayland::Shell *shell = new QtWayland::Shell(this);
+ connect(shell, &QtWayland::Shell::shellSurfaceCreated, this, &QWindowCompositor::onShellSurfaceCreated);
}
QWindowCompositor::~QWindowCompositor()
@@ -218,11 +221,6 @@ void QWindowCompositor::surfaceUnmapped()
m_renderScheduler.start(0);
}
-QWaylandView *QWindowCompositor::createView()
-{
- return new SurfaceView();
-}
-
void QWindowCompositor::surfaceCommitted()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
@@ -247,6 +245,13 @@ void QWindowCompositor::onSurfaceCreated(QWaylandSurface *surface)
connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped()));
connect(surface, SIGNAL(redraw()), this, SLOT(surfaceCommitted()));
connect(surface, SIGNAL(extendedSurfaceReady()), this, SLOT(sendExpose()));
+}
+
+void QWindowCompositor::onShellSurfaceCreated(QWaylandSurface *surface, QtWayland::ShellSurface *shellSurface)
+{
+ SurfaceView *newView = new SurfaceView();
+ newView->setSurface(surface);
+ shellSurface->setView(newView);
m_renderScheduler.start(0);
}
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.h b/examples/wayland/qwindow-compositor/qwindowcompositor.h
index db7f9129a..7534b57b0 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.h
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.h
@@ -53,6 +53,11 @@
QT_BEGIN_NAMESPACE
+namespace QtWayland {
+ class Shell;
+ class ShellSurface;
+}
+
class QWaylandView;
class QOpenGLTexture;
@@ -73,6 +78,7 @@ private slots:
void render();
void onSurfaceCreated(QWaylandSurface *surface);
+ void onShellSurfaceCreated(QWaylandSurface *surface, QtWayland::ShellSurface *shellSurface);
protected:
QWaylandView *createView() Q_DECL_OVERRIDE;
void surfaceCommitted(QWaylandSurface *surface);