diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2018-09-12 11:19:53 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2018-09-12 11:19:53 +0200 |
commit | ffcfa1cae06ce5dc8cd5c3e8cbb585b8fe62b32c (patch) | |
tree | 380cef9a970b4a65a36eb8d3f00d88ff72e95b2e /src/compositor | |
parent | 122123bfa4a65b04884f1d930900cb342fb7741c (diff) | |
parent | 297bcd005c4205f69e1bf9e9dc565ab757cf0bac (diff) |
Merge remote-tracking branch 'qt/5.11' into 5.12
Change-Id: I703c03c4c92889f82a1c8d16eb906bad9fa10461
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/compositor_api/qwaylandview.cpp | 57 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandview_p.h | 2 |
2 files changed, 35 insertions, 24 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 477b45897..127593770 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -55,8 +55,9 @@ void QWaylandViewPrivate::markSurfaceAsDestroyed(QWaylandSurface *surface) Q_Q(QWaylandView); Q_ASSERT(surface == this->surface); - q->setSurface(nullptr); + setSurface(nullptr); emit q->surfaceDestroyed(); + clearFrontBuffer(); } /*! @@ -132,38 +133,46 @@ QWaylandSurface *QWaylandView::surface() const return d->surface; } -void QWaylandView::setSurface(QWaylandSurface *newSurface) -{ - Q_D(QWaylandView); - if (d->surface == newSurface) - return; - - if (d->surface) { - QWaylandSurfacePrivate::get(d->surface)->derefView(this); - if (d->output) - QWaylandOutputPrivate::get(d->output)->removeView(this, d->surface); +void QWaylandViewPrivate::setSurface(QWaylandSurface *newSurface) +{ + Q_Q(QWaylandView); + if (surface) { + QWaylandSurfacePrivate::get(surface)->derefView(q); + if (output) + QWaylandOutputPrivate::get(output)->removeView(q, surface); } - d->surface = newSurface; + surface = newSurface; - if (!d->bufferLocked) { - d->currentBuffer = QWaylandBufferRef(); - d->currentDamage = QRegion(); - } + nextBuffer = QWaylandBufferRef(); + nextBufferCommitted = false; + nextDamage = QRegion(); - d->nextBuffer = QWaylandBufferRef(); - d->nextBufferCommitted = false; - d->nextDamage = QRegion(); + if (surface) { + QWaylandSurfacePrivate::get(surface)->refView(q); + if (output) + QWaylandOutputPrivate::get(output)->addView(q, surface); + } +} - if (d->surface) { - QWaylandSurfacePrivate::get(d->surface)->refView(this); - if (d->output) - QWaylandOutputPrivate::get(d->output)->addView(this, d->surface); +void QWaylandViewPrivate::clearFrontBuffer() +{ + if (!bufferLocked) { + currentBuffer = QWaylandBufferRef(); + currentDamage = QRegion(); } +} - emit surfaceChanged(); +void QWaylandView::setSurface(QWaylandSurface *newSurface) +{ + Q_D(QWaylandView); + if (d->surface == newSurface) + return; + d->setSurface(newSurface); + d->clearFrontBuffer(); + emit surfaceChanged(); } /*! diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h index b9cb0d07b..e7f521afe 100644 --- a/src/compositor/compositor_api/qwaylandview_p.h +++ b/src/compositor/compositor_api/qwaylandview_p.h @@ -74,6 +74,8 @@ public: { } void markSurfaceAsDestroyed(QWaylandSurface *surface); + void setSurface(QWaylandSurface *newSurface); + void clearFrontBuffer(); QObject *renderObject = nullptr; QWaylandSurface *surface = nullptr; |