Widgets: Simplify discardSyncRequest
Change-Id: I3bc66a0f958fed44eac5fee6642ef1b00d45a2c4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
14fc3f4b0d
commit
380dd8cde9
@ -439,6 +439,8 @@ public:
|
|||||||
void syncBackingStore();
|
void syncBackingStore();
|
||||||
void syncBackingStore(const QRegion ®ion);
|
void syncBackingStore(const QRegion ®ion);
|
||||||
|
|
||||||
|
bool shouldDiscardSyncRequest() const;
|
||||||
|
|
||||||
// tells the input method about the widgets transform
|
// tells the input method about the widgets transform
|
||||||
void updateWidgetTransform(QEvent *event);
|
void updateWidgetTransform(QEvent *event);
|
||||||
|
|
||||||
|
@ -1045,12 +1045,10 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
|
|||||||
|
|
||||||
#endif // QT_NO_OPENGL
|
#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())
|
Q_Q(const QWidget);
|
||||||
return true;
|
return !maybeTopData() || !q->testAttribute(Qt::WA_Mapped) || !q->isVisible();
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWidgetRepaintManager::syncAllowed()
|
bool QWidgetRepaintManager::syncAllowed()
|
||||||
@ -1119,8 +1117,7 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR
|
|||||||
void QWidgetRepaintManager::sync()
|
void QWidgetRepaintManager::sync()
|
||||||
{
|
{
|
||||||
updateRequestSent = false;
|
updateRequestSent = false;
|
||||||
QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
|
if (qt_widget_private(tlw)->shouldDiscardSyncRequest()) {
|
||||||
if (discardSyncRequest(tlw, tlwExtra)) {
|
|
||||||
// If the top-level is minimized, it's not visible on the screen so we can delay the
|
// 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.
|
// 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().
|
// 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)
|
if (data.in_destructor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_Q(QWidget);
|
if (shouldDiscardSyncRequest())
|
||||||
if (discardSyncRequest(q, maybeTopData()))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Q_Q(QWidget);
|
||||||
if (q->testAttribute(Qt::WA_StaticContents)) {
|
if (q->testAttribute(Qt::WA_StaticContents)) {
|
||||||
if (!extra)
|
if (!extra)
|
||||||
createExtra();
|
createExtra();
|
||||||
|
Loading…
Reference in New Issue
Block a user