From 25026defdc610e2d3d1acee25d2928e6e623dc80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 26 Aug 2019 14:57:44 +0200 Subject: [PATCH] widgets: Clarify QWidgetRepaintManager::sync of specific widget Change-Id: Ifa2a8245decfcb2b36c1952a39ec60b7eeca6e43 Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidgetrepaintmanager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 99373f758c..11647ae05e 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -707,9 +707,9 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) /*! Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store. - If there's nothing to repaint, the area is flushed and painting does not occur; - otherwise the area is marked as dirty on screen and will be flushed right after - we are done with all painting. + If there are dirty widgets, including but not limited to the \a exposedWidget, + these will be repainted first. The backingstore is then flushed to the screen, + regardless of whether or not there were any repaints. */ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedRegion) { @@ -730,6 +730,9 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR return; } + // As requests to sync a specific widget typically comes from an expose event + // we can't rely solely on our own dirty tracking to decide what to flush, and + // need to respect the platform's request to at least flush the entire widget, QPoint offset = exposedWidget != tlw ? exposedWidget->mapTo(tlw, QPoint()) : QPoint(); markNeedsFlush(exposedWidget, exposedRegion, offset);