summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickitem.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-07 12:35:44 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:33 +0200
commitdfec7314fd3758375e96d4641d2d6b5bec595320 (patch)
tree22cfabe1662b3e45795cd66f80388157490d575f /src/compositor/compositor_api/qwaylandquickitem.cpp
parentfd9a8983832bbeb240097327ff9f8565f7356b08 (diff)
Remove output from QWaylandSurface
It is the views that belong to outputs. This leads to a couple of interesting cases with enter and leave events, but the implementation says you will get enter events for the first view of a surface entering an output, and for the last view being removed from an output. Also to throttle a surface, there has to be 1 surface which takes care of this. This is because if multiple views throttle, then the client might render to quick. Change-Id: If4bba380fd4d7f506fd769606cbdea4ce58b908d
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 4e357dea2..376ea0582 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -150,6 +150,7 @@ QWaylandQuickItem::QWaylandQuickItem(QQuickItem *parent)
setAcceptHoverEvents(true);
connect(this, &QQuickItem::windowChanged, this, &QWaylandQuickItem::updateWindow);
+ connect(this, &QQuickItem::windowChanged, this, &QWaylandQuickItem::outputHasChanged);
}
QWaylandQuickItem::~QWaylandQuickItem()
@@ -354,6 +355,10 @@ void QWaylandQuickItem::waylandSurfaceChanged(QWaylandSurface *newSurface, QWayl
m_origin = newSurface->origin();
emit originChanged();
}
+ if (window()) {
+ QWaylandOutput *output = newSurface->compositor()->output(window());
+ setOutput(output);
+ }
}
emit surfaceChanged();
@@ -531,6 +536,16 @@ void QWaylandQuickItem::beforeSync()
}
}
+void QWaylandQuickItem::outputHasChanged()
+{
+ if (!compositor())
+ return;
+ QWaylandOutput *output = Q_NULLPTR;
+ if (window())
+ output = compositor()->output(window());
+ setOutput(output);
+}
+
QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
bool mapped = (surface() && surface()->isMapped() && currentBuffer().hasBuffer())