From f2d752c59f5a1d2e815394d718350d0fcaf43ef6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 6 Dec 2019 14:16:31 +0100 Subject: QWindowSystemInterface: use QBasicMutex and qt_scoped_lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no reason to use a class-static mutex object here. Use a namespace-static QBasicMutex, port to qt_scoped_lock. Change-Id: Ia9bd3c2fadbf1da25ef79bb393c899b678cbc182 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/gui/kernel/qwindowsysteminterface.cpp') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index c9a70897d6..31765cf54c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -46,7 +46,9 @@ #include #include #include "qhighdpiscaling_p.h" + #include +#include #if QT_CONFIG(draganddrop) #include @@ -623,7 +625,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) static int g_nextPointId = 1; // map from device-independent point id (arbitrary) to "Qt point" ids -QMutex QWindowSystemInterfacePrivate::pointIdMapMutex; +static QBasicMutex pointIdMapMutex; typedef QMap PointIdMap; Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) @@ -641,7 +643,7 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) */ static int acquireCombinedPointId(quint8 deviceId, int pointId) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); quint64 combinedId64 = (quint64(deviceId) << 32) + pointId; auto it = g_pointIdMap->constFind(combinedId64); @@ -702,7 +704,7 @@ QList } if (states == Qt::TouchPointReleased) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); // All points on deviceId have been released. // Remove all points associated with that device from g_pointIdMap. @@ -723,7 +725,7 @@ QList void QWindowSystemInterfacePrivate::clearPointIdMap() { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); g_pointIdMap->clear(); g_nextPointId = 1; } -- cgit v1.2.3 From 9a77beaea36bf6c8b44086a15bed0e9903a06944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 18 Dec 2019 18:01:27 +0100 Subject: 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 --- src/gui/kernel/qwindowsysteminterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qwindowsysteminterface.cpp') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index ba04f8701d..8457282bed 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -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(e); } #if QT_CONFIG(draganddrop) -- cgit v1.2.3