path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
diff options
authorTor Arne Vestbø <>2020-08-19 23:09:55 +0200
committerTor Arne Vestbø <>2020-08-22 21:47:36 +0200
commit81e09ae404b632a92e1e4c27f5875bdf027c5401 (patch)
tree7e5edffa0b5616a85f8ee459f9e40506e819ee74 /src/plugins/platforms/xcb/qxcbbackingstore.cpp
parent16e546e32fec393bc3b126f280114bcbfa7151ff (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 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I1c9c8bc53c088cdc1ae8b892e17930f4a468ccad Reviewed-by: Gatis Paeglis <>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 7330c3c9a3..bfcd1b2320 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -710,9 +710,10 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
- 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) {
@@ -733,7 +734,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);