summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-08-16 15:29:56 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-08-20 11:34:20 +0200
commit380dd8cde9eac2355f421326623dda1722ab605c (patch)
tree75aa7a0ea53a452598398daa6f426328896827e0 /src/widgets/kernel
parent14fc3f4b0d69a2395dc734d9bf72b943508e0450 (diff)
Widgets: Simplify discardSyncRequest
Change-Id: I3bc66a0f958fed44eac5fee6642ef1b00d45a2c4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp15
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 &region);
+ 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();