A patch for QScreen::sdrBrightnessLevel()

Alvin Wong alvin at alvinhc.com
Wed Jan 14 10:50:40 GMT 2026


On 13/01/2026 19:07, Dmitry Kazakov wrote:
> Hi, all!
>
> If someone might be interested in that, I did a bit of research on 
> implementing a way of fetching screen's SDR brightness level in Qt's 
> QScreen implementation on Windows. This value is configured by the 
> user in the display settings, so the application needs this value to 
> be able to blend the GUI elements on the HDR canvas.
>
> Here is the draft patch:
> https://invent.kde.org/dkazakov/qtbase/-/commit/b401b32e3eb2616087ca9614df18959673c05e5a
>
> Current limitations:
>
> 1) The feature is implemented on Windows only. It is technically 
> possible to implement that on Wayland, but this draft doesn't address 
> that.
>
> 2) QScreen::sdrBrightnessLevelChanged() signal is **NOT** delivered 
> when the user actually changes the SDR brightness preference. There 
> seems to be no WinAPI message delivered when this setting is changed. 
> At least nothing I could see in the docs or event stream dumps. Id you 
> know some details about that, please yell! :)

I checked what Chrome/Chromium does (both the code and the actual 
behaviour), and it seems to only refresh the SDR brightness value on 
receiving `WM_ACTIVATEAPP`, so it seems even Chromium devs haven't found 
a way to get notified of the SDR brightness changing, or perhaps they 
just consider this good enough.


>
> Though the signal is delivered when the user toggles SDR and HDR modes 
> of the screen. It makes Windows to deliver WM_DISPLAYCHANGE, which is 
> handled by QWindowsScreenManager properly.
>
> --
> Dmitry Kazakov
Alvin Wong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20260114/973112bb/attachment.htm>


More information about the kimageshop mailing list