Widgets: Simplify discardSyncRequest

Change-Id: I3bc66a0f958fed44eac5fee6642ef1b00d45a2c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-08-16 15:29:56 +02:00
parent 14fc3f4b0d
commit 380dd8cde9
2 changed files with 8 additions and 9 deletions

View File

@ -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);

View File

@ -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();