Remove state mutators in Output
The state of an Output
of can be changed in two ways - by using OutputChangeSet
or state setters in Output
, e.g. Output::setEnabled()
or Output::setDpmsMode()
.
Providing one way to update an object rather than two is always better. It makes API clean and there are fewer chances to have conflicts.
OutputChangeSet
is a brilliant way to update an output, and it's reasonable to replace the remaining state setters in Output
with it.
Some preparation work has already been conducted, but there's still remaining issues to resolve:
-
Refactor immutable output information -
Redirect enabled status updates through OutputChangeSet
. At the moment, it's somewhat challenging to perform because of side-effects ofOutput::updateEnablement()
-
Redirect all dpms mode updates through OutputChangeSet
. Tricky to do because of the timer inDrmOutput::setDpmsMode()
.
Proposal:- Allow effects to block
OutputChangeSet
updates. - When the platform wants to apply an output configuration, emit a signal with the next configuration
- In the effect that dims the screen, listen for that signal
- If the output is turned off, block the configuration, animate the screen, unblock the configuration
- Allow effects to block
Edited by Vlad Zahorodnii