Do not redraw decorations everytime

This commit is contained in:
Jan Grulich 2019-07-30 15:39:18 +02:00
parent c80b3c9f07
commit eaa6d49367
2 changed files with 38 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Summary: Qt5 - Wayland platform support and QtCompositor module
Name: qt5-%{qt_module}
Version: 5.12.4
Release: 6%{?dist}
Release: 7%{?dist}
License: LGPLv3
Url: http://www.qt.io
@ -18,6 +18,7 @@ Patch2: qtwayland-emit-wl-surfare-lifetime-signals.patch
Patch4: qtwayland-make-handleupdate-aware-of-exposure-changes.patch
Patch5: qtwayland-dont-crash-when-start-drag-without-dragfocus.patch
Patch6: qtwayland-fix-expose-event-compression.patch
Patch7: qtwayland-do-not-redraw-decorations-everytime.patch
# Upstreamable patches
# https://fedoraproject.org/wiki/Changes/Qt_Wayland_By_Default_On_Gnome
@ -126,6 +127,9 @@ popd
%changelog
* Tue Jul 30 2019 Jan Grulich <jgrulich@redhat.com> - 5.12.3-6
- Do not redraw decorations everytime
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.12.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

View File

@ -0,0 +1,33 @@
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index 3fe2ce80..6d660e64 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -289,11 +289,13 @@ void QWaylandShmBackingStore::resize(const QSize &size)
buffer = getBuffer(sizeWithMargins);
}
- qsizetype oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0;
+ qsizetype oldSizeInBytes = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0;
+ qsizetype newSizeInBytes = buffer->image()->sizeInBytes();
+
// mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway
- if (mBackBuffer != buffer && oldSize == buffer->image()->sizeInBytes()) {
- memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->sizeInBytes());
- }
+ if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes)
+ memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), newSizeInBytes);
+
mBackBuffer = buffer;
// ensure the new buffer is at the beginning of the list so next time getBuffer() will pick
// it if possible
@@ -302,8 +304,9 @@ void QWaylandShmBackingStore::resize(const QSize &size)
mBuffers.prepend(buffer);
}
- if (windowDecoration() && window()->isVisible())
+ if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) {
windowDecoration()->update();
+ }
}
QImage *QWaylandShmBackingStore::entireSurface() const