summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-19 23:09:55 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-08-25 08:31:38 +0000
commit224f91fb29440b8e0385bc5302ffabcb8f6cfc63 (patch)
tree25721a90f0faf7b950e2e134db700754ae3de722
parentf0cf48d81e491ddf4fd6b5fb0ade45b50117b036 (diff)
xcb: Fix flushing of native subwindows when not using shared memory
When using X-forwarding we're not using shared memory for the backing store image, and end up in a code path where we first copy the updated parts of the backing store from our client side image over to the server, and then flush those parts from the server-side image to the window. The problem was that this code path didn't account for the possibility that we'd flush a sub-window at an offset, and would end up uploading the sub-window local region directly, without applying the offset. This problem was revealed when 79bf1b7e348d started being smarter about what regions we flush and to what windows when we have sub windows. Fixes: QTBUG-81723 Change-Id: I1c9c8bc53c088cdc1ae8b892e17930f4a468ccad Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> (cherry picked from commit 81e09ae404b632a92e1e4c27f5875bdf027c5401) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index f9240a45cc..32739b3572 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -709,9 +709,10 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
Q_ASSERT(!m_clientSideScroll);
ensureGC(dst);
- setClip(region);
if (hasShm()) {
+ setClip(region); // Clip in window local coordinates
+
// Copy scrolled area on server-side from pixmap to window
const QRegion scrolledRegion = m_scrolledRegion.translated(-offset);
for (const QRect &rect : scrolledRegion) {
@@ -732,7 +733,15 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
const QRect bounds = region.boundingRect();
const QPoint target = bounds.topLeft();
const QRect source = bounds.translated(offset);
- flushPixmap(region);
+
+ // First clip in backingstore-local coordinates, and upload
+ // the changed parts of the backingstore to the server.
+ setClip(source);
+ flushPixmap(source);
+
+ // Then clip in window local coordinates, and copy the updated
+ // parts of the backingstore image server-side to the window.
+ setClip(region);
xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
dst,