summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-09-24 13:04:51 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-10-26 11:05:00 +0000
commit88a0246a46c30e08e9730d16cf8739773447d058 (patch)
treef9d20ff21e77031b7ddcb33394aa0e35de491933 /src/client/qwaylandwindow.cpp
parentba53384387dcfd2606a513b114eff488d3fdb940 (diff)
Client: Don't attach buffers to unexposed windows
QBackingStore::flush is sometimes called with an unxeposed window, in that case, don't attach the buffer to the wl_surface immediately, as that causes protocol errors with xdg_shell. Flushed buffers are instead stored until we get the first configure event. [ChangeLog][QPA plugin][xdg-shell] Fixed a bug where buffers were sometimes attached and committed before the first configure event, causing protocol errors. Fixes: QTBUG-71345 Change-Id: If9409d97bd25f6b13940c56141920a664c349c8e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 52bee6ae3..1801c2a4b 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -248,6 +248,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
}
mMask = QRegion();
+ mQueuedBuffer = nullptr;
}
QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -566,8 +567,29 @@ void QWaylandWindow::damage(const QRect &rect)
damage(rect.x(), rect.y(), rect.width(), rect.height());
}
+void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
+{
+ if (isExposed()) {
+ commit(buffer, damage);
+ } else {
+ mQueuedBuffer = buffer;
+ mQueuedBufferDamage = damage;
+ }
+}
+
+void QWaylandWindow::handleExpose(const QRegion &region)
+{
+ QWindowSystemInterface::handleExposeEvent(window(), region);
+ if (mQueuedBuffer) {
+ commit(mQueuedBuffer, mQueuedBufferDamage);
+ mQueuedBuffer = nullptr;
+ mQueuedBufferDamage = QRegion();
+ }
+}
+
void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
{
+ Q_ASSERT(isExposed());
if (buffer->committed()) {
qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring.";
return;