From 380dd8cde9eac2355f421326623dda1722ab605c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 16 Aug 2019 15:29:56 +0200 Subject: [PATCH] Widgets: Simplify discardSyncRequest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3bc66a0f958fed44eac5fee6642ef1b00d45a2c4 Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qwidget_p.h | 2 ++ src/widgets/kernel/qwidgetrepaintmanager.cpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 1cb9769d4d..941f92c062 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -439,6 +439,8 @@ public: void syncBackingStore(); void syncBackingStore(const QRegion ®ion); + bool shouldDiscardSyncRequest() const; + // tells the input method about the widgets transform void updateWidgetTransform(QEvent *event); diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 76b591aa2c..697212461c 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -1045,12 +1045,10 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) #endif // QT_NO_OPENGL -static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) +bool QWidgetPrivate::shouldDiscardSyncRequest() const { - if (!tlw || !tlwExtra || !tlw->testAttribute(Qt::WA_Mapped) || !tlw->isVisible()) - return true; - - return false; + Q_Q(const QWidget); + return !maybeTopData() || !q->testAttribute(Qt::WA_Mapped) || !q->isVisible(); } bool QWidgetRepaintManager::syncAllowed() @@ -1119,8 +1117,7 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR void QWidgetRepaintManager::sync() { updateRequestSent = false; - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (discardSyncRequest(tlw, tlwExtra)) { + if (qt_widget_private(tlw)->shouldDiscardSyncRequest()) { // If the top-level is minimized, it's not visible on the screen so we can delay the // update until it's shown again. In order to do that we must keep the dirty states. // These will be cleared when we receive the first expose after showNormal(). @@ -1543,10 +1540,10 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) if (data.in_destructor) return; - Q_Q(QWidget); - if (discardSyncRequest(q, maybeTopData())) + if (shouldDiscardSyncRequest()) return; + Q_Q(QWidget); if (q->testAttribute(Qt::WA_StaticContents)) { if (!extra) createExtra();