summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-04 14:35:19 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-04 16:12:47 +0200
commit6358b0ede93c6633802126bf8bf0a44860e66917 (patch)
tree17c8a90565b3aa4f0d3c0cb36a642c0da53bf229 /examples
parentb666aa58d7a168fe4ddb694caba099343421aa65 (diff)
Make it possible to connect to a createSurface signal
Remove the QWaylandSurface factory function from QWaylandCompositor. Add a default constructor to QWaylandSurface and a initialize function. Add som housekeeping code in debug builds that ensures the user calls initialize. Add a fallback factory function on the compositor if the user is fine with getting the default implementation of QWaylandSurface or QWaylandQuickSurface Change-Id: Ib9289c323b6723f0d1119a484cf9e0c26c95b549
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/pure-qml/qml/main.qml13
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.cpp8
-rw-r--r--examples/wayland/qwindow-compositor/qwindowcompositor.h2
3 files changed, 18 insertions, 5 deletions
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
index 0fe92668a..12f6063b4 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -56,6 +56,13 @@ WaylandCompositor {
Chrome { }
}
+ Component {
+ id: surfaceComponent
+ WaylandSurface {
+ property QtObject shellSurface: null
+ }
+ }
+
extensions: [
DefaultShell {
id: defaultShell
@@ -69,6 +76,7 @@ WaylandCompositor {
var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "surface": surface } );
var shellSurface = shellSurfaceComponent.createObject();
shellSurface.initialize(defaultShell, surface, item.view, client, id);
+ surface.shellSurface = shellSurface;
}
Component.onCompleted: {
@@ -77,6 +85,11 @@ WaylandCompositor {
}
]
+ onCreateSurface: {
+ var surface = surfaceComponent.createObject(0, { } );
+ surface.initialize(compositor, client, id, version);
+ }
+
Component.onCompleted: {
screenComponent.createObject(0, { "outputSpace" : defaultOutputSpace } );
}
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp
index e89ec3aec..fe2738f05 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(QWaylandClient *client, quint32 id, int version, QWaylandCompositor *compositor)
- : QWaylandSurface(client, id, version, compositor)
+ Surface()
+ : QWaylandSurface()
, shellSurface(Q_NULLPTR)
, extSurface(Q_NULLPTR)
, hasSentOnScreen(false)
@@ -319,9 +319,9 @@ void QWindowCompositor::adjustCursorSurface(QWaylandSurface *surface, int hotspo
m_cursorHotspotY = hotspotY;
}
-QWaylandSurface *QWindowCompositor::createSurface(QWaylandClient *client, quint32 id, int version)
+QWaylandSurface *QWindowCompositor::createDefaultSurfaceType()
{
- return new Surface(client, id, version, this);
+ return new Surface();
}
QWaylandView *QWindowCompositor::viewAt(const QPointF &point, QPointF *local)
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.h b/examples/wayland/qwindow-compositor/qwindowcompositor.h
index e4c4cbe66..15ff30476 100644
--- a/examples/wayland/qwindow-compositor/qwindowcompositor.h
+++ b/examples/wayland/qwindow-compositor/qwindowcompositor.h
@@ -80,7 +80,7 @@ private slots:
void onCreateShellSurface(QWaylandSurface *s, QWaylandClient *client, uint id);
protected:
- QWaylandSurface *createSurface(QWaylandClient *client, quint32 id, int version) Q_DECL_OVERRIDE;
+ QWaylandSurface *createDefaultSurfaceType() Q_DECL_OVERRIDE;
void surfaceCommitted(QWaylandSurface *surface);
QWaylandView* viewAt(const QPointF &point, QPointF *local = 0);