libdpms: Delay supportedChanged signal until after the constructor
BUG: 338796 (fix DPMS in screen locker when Escape is pressed)
KScreen::Dpms
was giving promises that it couldn't keep,
i.e. blocking in isSupported()
until initialization is done.
Implementing this safely as specified would involve multithreading
or manual event loop processing, both of which seem overkill here.
Given the lack of blocking in isSupported()
, an owner of the Dpms
object could only connect to supportedChanged()
. However, this was
emitted during the constructor, which makes connections pointless
for someone who can only connect after creating the object.
To make any of this work, queue the majority of initialization work until after the constructor is called, for both X11 and Wayland.
CC @apol who both ported KScreen::Dpms from its earlier place in PowerDevil, and then made use of it in kscreenlocker_greeter.