diff options
Diffstat (limited to 'src/widgets/kernel/qwidgetbackingstore.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index c8d5440999..dc918657b4 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -736,7 +736,8 @@ QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) dirtyOnScreenWidgets(0), widgetTextures(0), fullUpdatePending(0), - updateRequestSent(0) + updateRequestSent(0), + textureListWatcher(0) { store = tlw->backingStore(); Q_ASSERT(store); @@ -962,6 +963,25 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo } #endif +QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetBackingStore *backingStore) + : m_locked(false), + m_backingStore(backingStore) +{ +} + +void QPlatformTextureListWatcher::watch(QPlatformTextureList *textureList) +{ + connect(textureList, SIGNAL(locked(bool)), SLOT(onLockStatusChanged(bool))); + m_locked = textureList->isLocked(); +} + +void QPlatformTextureListWatcher::onLockStatusChanged(bool locked) +{ + m_locked = locked; + if (!locked) + m_backingStore->sync(); +} + /*! Synchronizes the backing store, i.e. dirty areas are repainted and flushed. */ @@ -985,6 +1005,17 @@ void QWidgetBackingStore::sync() return; } + if (textureListWatcher && !textureListWatcher->isLocked()) { + textureListWatcher->deleteLater(); + textureListWatcher = 0; + } else if (widgetTextures && widgetTextures->isLocked()) { + if (!textureListWatcher) + textureListWatcher = new QPlatformTextureListWatcher(this); + if (!textureListWatcher->isLocked()) + textureListWatcher->watch(widgetTextures); + return; + } + doSync(); } @@ -1077,7 +1108,7 @@ void QWidgetBackingStore::doSync() delete widgetTextures; widgetTextures = 0; if (tlw->d_func()->textureChildSeen) { - widgetTextures = new QPlatformTextureList; // TODO: implement support for locking + widgetTextures = new QPlatformTextureList; findTextureWidgetsRecursively(tlw, tlw, widgetTextures); } fullUpdatePending = false; |