From d7048c20560562eb253339bc90b19310ae86fd30 Mon Sep 17 00:00:00 2001 From: kleuter Date: Sat, 30 Nov 2019 10:27:58 +0100 Subject: [PATCH] 5.13.2: better patch by https://codereview.qt-project.org/c/qt/qtbase/+/283280 --- 5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.h | 6 +++--- .../qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.h b/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.h index c929cc6..1c88447 100644 --- a/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.h +++ b/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.h @@ -112,13 +112,13 @@ private: QRect m_geometry; QRect m_availableGeometry; QDpi m_logicalDpi; - qreal m_refreshRate = 0; - int m_depth = 0; + qreal m_refreshRate; + int m_depth; QString m_name; QImage::Format m_format; QSizeF m_physicalSize; QCocoaCursor *m_cursor; - qreal m_devicePixelRatio = 0; + qreal m_devicePixelRatio; CVDisplayLinkRef m_displayLink = nullptr; dispatch_source_t m_displayLinkSource = nullptr; diff --git a/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm b/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm index e4dd4cf..a66483c 100644 --- a/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm +++ b/5.13.2/qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm @@ -471,6 +471,15 @@ void QCocoaScreen::deliverUpdateRequests() // it on the main thread yet, because the processing of the update request is taking // too long, or because the update request was deferred due to window live resizing. qDeferredDebug(screenUpdates) << ", " << framesAheadOfDelivery << " frame(s) ahead"; + + // We skip the frame completely if we're live-resizing, to not put any extra + // strain on the main thread runloop. Otherwise we assume we should push frames + // as fast as possible, and hopefully the callback will be delivered on the + // main thread just when the previous finished. + if (qt_apple_sharedApplication().keyWindow.inLiveResize) { + qDeferredDebug(screenUpdates) << "; waiting for main thread to catch up"; + return; + } } qDeferredDebug(screenUpdates) << "; signaling dispatch source";