Previously, m_displays in DDCutilDetector
contained all validddcutil displays, and ASLEEP/AWAKE events would pause/resumethe affected display. Upon resuming, we needed to write thecurrent brightness value so that it's still in line with anychanges that were made in the meantime.
This has two downsides:
DDCutilDetector
exposes a display that it can't control,but which may still show a brightness slider to the user incertain circumstances.- We force a long-delayed brightness write that may or may notbe desired at that point, especially if we've missed previousexternal brightness changes due to DDC/CI limitations.
Instead of trying to figure out how to decide whether we want toissue a brightness write or emit externalBrightnessChangeObserved()
,we can reduce complexity by making use of a more basic concept:removing and adding displays.
With this commit, a monitor that has gone to sleep will notexpose brightness controls anymore. Once it wakes up, we read itscurrent brightness again from scratch. If the controller wants torestore any brightness values upon seeing the display again, it canset its brightness as a reaction to displaysChanged()
. Trackingand restoring brightness across sleep/wake events is not theresponsibility of our DDC/CI classes anymore.
With back-off retries in place for DDCutilDisplay
initialization,we don't need to worry about delaying DDC/CI commands after wake-upas resumeWorker()
used to do.
This also addresses this Discuss thread wherein X11 users were asking for PowerDevil not to overwrite their custom brightness values after they had already disabled dimming.