summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h3
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm21
2 files changed, 24 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index dd694283908..07c8f71a53d 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -8,6 +8,8 @@
#include <qpa/qplatformscreen.h>
+#include <QtCore/private/qcore_mac_p.h>
+
@class QIOSOrientationListener;
QT_BEGIN_NAMESPACE
@@ -53,6 +55,7 @@ private:
#if !defined(Q_OS_VISIONOS)
UIScreen *m_uiScreen = nullptr;
+ QMacNotificationObserver m_screenBrightnessObserver;
#endif
QRect m_geometry;
QRect m_availableGeometry;
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index c5944ba1a7e..843e33bb8de 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -180,6 +180,27 @@ QIOSScreen::QIOSScreen(UIScreen *screen)
m_displayLink.paused = YES; // Enabled when clients call QWindow::requestUpdate()
[m_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
+
+ // The screen brightness might affect the EDR headroom of the display,
+ // which might affect the rendering of windows that opt in to EDR.
+ m_screenBrightnessObserver = QMacNotificationObserver(m_uiScreen,
+ UIScreenBrightnessDidChangeNotification, [&]() {
+ if (@available(iOS 17, *)) {
+ for (auto *window : QPlatformScreen::windows()) {
+ auto *platformWindow = static_cast<QIOSWindow*>(window->handle());
+ if (!platformWindow)
+ continue;
+
+ UIView *view = platformWindow->view();
+
+ if (!view.layer.wantsExtendedDynamicRangeContent)
+ continue;
+
+ [view setNeedsDisplay];
+ }
+ }
+ });
+
#endif // !defined(Q_OS_VISIONOS))
updateProperties();