macOS: Deliver theme changes synchronously

Otherwise the expose event that AppKit triggers will be delivered before
we've propagated the theme change, and we fail to draw the UI using the
new theme.

Change-Id: I502122a2bf02a866d136106d831f0c2a0dfe26f2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-12-18 18:01:27 +01:00 committed by Tor Arne Vestbø
parent e2f4c5f4a1
commit 9a77beaea3
3 changed files with 4 additions and 3 deletions

View File

@ -880,10 +880,10 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleThemeChange(QWindow *window)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window)
{
QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(window);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
#if QT_CONFIG(draganddrop)

View File

@ -249,6 +249,7 @@ public:
static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleThemeChange(QWindow *window);
static void handleFileOpenEvent(const QString& fileName);

View File

@ -129,7 +129,7 @@ void QCocoaTheme::handleSystemThemeChange()
QFontCache::instance()->clear();
}
QWindowSystemInterface::handleThemeChange(nullptr);
QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr);
}
bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const