From 10397e53515288fa82cce684b2a9f6aa6f96939f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Thu, 20 Jun 2024 15:44:38 +0200 Subject: [PATCH] macOS: send DPR change on BackingPropertiesChange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AppKit sends the viewDidChangeBackingProperties message to the view when the backing store scale changes. Propagate to QtGui via handleWindowDevicePixelRatioChanged. Pick-to: 6.7 6.6 Fixes: QTBUG-118794 Change-Id: Ia675e84f74dd3c64d6466adc753accbbb650325b Reviewed-by: Tor Arne Vestbø (cherry picked from commit 97c12e3f2dc1e2114aeb8abaff4d551b112887ef) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnsview_drawing.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm index 61691ab4fb5..c903bcd5359 100644 --- a/src/plugins/platforms/cocoa/qnsview_drawing.mm +++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm @@ -147,7 +147,15 @@ // Ideally we would plumb this situation through QPA in a way that lets // clients invalidate their own caches, recreate QBackingStore, etc. - // For now we trigger an expose, and let QCocoaBackingStore deal with + + // QPA supports DPR (scale) change notifications. We are not sure + // based on this event that it is the scale that has changed (it + // could be the color space), however QPA will determine if it has + // actually changed. + QWindowSystemInterface::handleWindowDevicePixelRatioChanged + (m_platformWindow->window()); + + // Trigger an expose, and let QCocoaBackingStore deal with // buffer invalidation internally. [self setNeedsDisplay:YES]; }