Quantcast
Viewing all articles
Browse latest Browse all 1684

Jakob Petsovits commented on merge request !289 at Plasma / PowerDevil

The overall idea seems right to me, but the extra asynchronicity makes it harder to follow what's supposed to happen in which order.

To recap, your patch makes onLidClosedChanged() call itself a little later by appending an extra slot to the constructor's KScreen::GetConfigOperation::finished signal. At that point we know for sure if an external monitor is connected.

I think we don't need the delayed call, we can just return from onLidClosedChanged() immediately if the screen config hasn't yet been initialized. My rationale is that the lambda connected to KScreen::ConfigOperation::finished is already calling checkOutputs(), which will in turn call onLidClosedChanged(closed=true) if necessary. I think we can also assume that within checkOutputs(), we're never going to miss a desired onLidClosedChanged() because m_externalMonitorPresent is false initially [1] and will change to true upon KScreen::ConfigOperation::finished, which satisfies the condition.

[1] It's sufficient to only worry about the initial value of m_externalMonitorPresent, we're talking about a condition that applies only to the duration between constructor and first screen config initialization.

I made 6f7fc47f to demonstrate what I mean. It seems to work with Nate's test case and I believe it works as well as the initial patch here, only simpler. Please have a look if you agree with this.


Viewing all articles
Browse latest Browse all 1684

Trending Articles