From 09af4d9e8eb4ba3e640634da484fee3e2b3ce9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 16 Nov 2021 21:34:56 +0100 Subject: [PATCH] xcb: Don't mark scrolled area as flushed when doing client side scroll The m_pendingFlush variable is used to track what is missing in the server side backingstore. If we're doing a client side scroll the pending area is still the same. If we were to always discard the scrolled area from m_pendingFlush we would get in trouble on the next non-client side scroll, as we think the content exists server-side. Change-Id: Ie50a99a8e5d8a83d1299c53534a1c83c6bfb47bd Reviewed-by: Laszlo Agocs (cherry picked from commit 71f75bf6c5140920227f6019716c05fe7bfb0b20) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index b4993bfd179..796ca24265b 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -493,10 +493,13 @@ bool QXcbBackingStoreImage::scroll(const QRegion &area, int dx, int dy) } else { ensureGC(m_xcb_pixmap); - if (hasShm()) - shmPutImage(m_xcb_pixmap, m_pendingFlush.intersected(scrollArea)); - else + if (hasShm()) { + QRegion partialFlushRegion = m_pendingFlush.intersected(scrollArea); + shmPutImage(m_xcb_pixmap, partialFlushRegion); + m_pendingFlush -= partialFlushRegion; + } else { flushPixmap(scrollArea); + } for (const QRect &src : scrollArea) { const QRect dst = src.translated(delta).intersected(bounds); @@ -508,15 +511,13 @@ bool QXcbBackingStoreImage::scroll(const QRegion &area, int dx, int dy) dst.x(), dst.y(), dst.width(), dst.height()); } + + if (hasShm()) + m_pendingFlush -= destinationRegion; } m_scrolledRegion |= destinationRegion; - if (hasShm()) { - m_pendingFlush -= scrollArea; - m_pendingFlush -= m_scrolledRegion; - } - return true; }