Fix lingering dpms input event filter after cancelling scheduled dpms mode change

The output goes through the following stages when it changes its dpms
mode:

- Output::aboutToTurnOff()]
- some time later, Output::dpmsModeChanged() to indicate that it's off
- Output::dpmsModeChanged() to indicate that it's back on
- Output::wakeUp()

The Output::dpmsModeChanged() signals in the middle are optional. They
may not be emitted after Output::aboutToTurnOff() if the user quickly
cancels the dpms mode transition.

The Workspace should monitor the Output::wakeUp() signal instead.
Alternatively, create the dpms input event filter only after the dpms
mode has changed. While the screen won't be turned back on immediately,
it's still going to produce acceptable visuals. Either solution is fine.
This patch makes the Workspace monitor the wakeUp signal because it
takes fewer lines of code.

BUG: 479659
This commit is contained in:
Vlad Zahorodnii 2024-01-23 14:36:53 +02:00
parent adc076322b
commit bbb40a9a84

View file

@ -1346,7 +1346,7 @@ void Workspace::updateOutputs(const QList<Output *> &outputOrder)
output->ref();
m_tileManagers[output] = std::make_unique<TileManager>(output);
connect(output, &Output::aboutToTurnOff, this, &Workspace::createDpmsFilter);
connect(output, &Output::dpmsModeChanged, this, &Workspace::maybeDestroyDpmsFilter);
connect(output, &Output::wakeUp, this, &Workspace::maybeDestroyDpmsFilter);
if (output->dpmsMode() != Output::DpmsMode::On) {
createDpmsFilter();
}