From 81e09ae404b632a92e1e4c27f5875bdf027c5401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 19 Aug 2020 23:09:55 +0200 Subject: 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 --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp') 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 ®ion, 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) { @@ -733,7 +734,15 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion ®ion, 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, -- cgit v1.2.3