summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-07 11:08:29 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-10 08:20:22 +0000
commit762d384b806deb84072a5c7eb6b91afa1e150c1f (patch)
tree97affde5f9e57f4159edb903e2d84faa54d1f7ba /examples
parentc0d77f8bb31d50b73543ef41875cdb4737aebb92 (diff)
Move the createDefaultSurface function to QWaylandCompositorPrivate
Its really not meant to be reimplemented by other classes than QWaylandCompositor or QWaylandQuickCompositor because of the createSurface signal. If someone really wants to use the virtual function then they can subclass the private Change-Id: Iad88fde3fc999ac18bdc57bd37864884865a962a Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.cpp15
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.h1
2 files changed, 9 insertions, 7 deletions
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
index fe2738f05..9f9a8e060 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
@@ -67,8 +67,8 @@ QT_BEGIN_NAMESPACE
class Surface : public QWaylandSurface
{
public:
- Surface()
- : QWaylandSurface()
+ Surface(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)
+ : QWaylandSurface(compositor, client, id, version)
, shellSurface(Q_NULLPTR)
, extSurface(Q_NULLPTR)
, hasSentOnScreen(false)
@@ -151,6 +151,7 @@ void QWindowCompositor::create()
m_renderScheduler.setSingleShot(true);
connect(&m_renderScheduler, &QTimer::timeout, this, &QWindowCompositor::render);
+ connect(this, &QWaylandCompositor::createSurface, this, &QWindowCompositor::onCreateSurface);
connect(this, &QWaylandCompositor::surfaceCreated, this, &QWindowCompositor::onSurfaceCreated);
connect(defaultInputDevice(), &QWaylandInputDevice::cursorSurfaceRequest, this, &QWindowCompositor::adjustCursorSurface);
@@ -255,6 +256,11 @@ void QWindowCompositor::surfaceCommitted(QWaylandSurface *surface)
m_renderScheduler.start(0);
}
+void QWindowCompositor::onCreateSurface(QWaylandClient *client, uint id, int version)
+{
+ new Surface(this, client, id, version);
+}
+
void QWindowCompositor::onSurfaceCreated(QWaylandSurface *surface)
{
connect(surface, &QWaylandSurface::surfaceDestroyed, this, &QWindowCompositor::surfaceDestroyed);
@@ -319,11 +325,6 @@ void QWindowCompositor::adjustCursorSurface(QWaylandSurface *surface, int hotspo
m_cursorHotspotY = hotspotY;
}
-QWaylandSurface *QWindowCompositor::createDefaultSurfaceType()
-{
- return new Surface();
-}
-
QWaylandView *QWindowCompositor::viewAt(const QPointF &point, QPointF *local)
{
for (int i = m_visibleSurfaces.size() - 1; i >= 0; --i) {
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.h b/examples/wayland/qwindow-compositor/qwindowcompositor.h
index 15ff30476..9e1eb0801 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.h
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.h
@@ -76,6 +76,7 @@ private slots:
void surfacePosChanged();
void render();
+ void onCreateSurface(QWaylandClient *client, uint id, int version);
void onSurfaceCreated(QWaylandSurface *surface);
void onCreateShellSurface(QWaylandSurface *s, QWaylandClient *client, uint id);