diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2018-09-12 12:34:01 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-09-12 12:34:01 +0000 |
commit | 1fb9c318f8233781eb80599195f67a75ff2a2e3b (patch) | |
tree | 37db01b5fc4d095556efcf950b223a7d18063dfc /src | |
parent | f669fc9749fce770420e1efece893bb2724a003c (diff) | |
parent | ffcfa1cae06ce5dc8cd5c3e8cbb585b8fe62b32c (diff) |
Merge "Merge remote-tracking branch 'qt/5.11' into 5.12" into refs/staging/5.12
Diffstat (limited to 'src')
-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; |