Suspend/Hibernate through daemon instead of greeter
ClosedPublic

Authored by graesslin on Jan 15 2016, 10:29 AM.

Details

Summary

This change addresses multiple problems with the implementation of
PowerManagement's suspend/hibernate in the greeter.

First of all it removes the usage of KDELibs4Support library by
dropping the usage of the PowerManagement API.

The previous variant performed blocking DBus calls which we don't want
in the greeter. The new implementation is designed in an async way, so
that it cannot block. The new implementation is also LGPL licensed to
make it easy to use it as a base for a new implementation in frameworks.
The new implementation also comes with a small test application to
demonstrate the usage.

Last but not least the power management query is moved from the greeter
into the daemon. This brings multiple advantages. It brings us closer to
no DBus in the greeter and means we don't need to query DBus every time
the screen gets locked. Instead the value is cached in the deamon and
pushed to the greeter on start (through the custom Wayland prtocol).

Diff Detail

Repository
R133 KScreenLocker
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 1980.Jan 15 2016, 10:29 AM
graesslin retitled this revision from to Suspend/Hibernate through daemon instead of greeter.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: bshah, broulik.
graesslin added a project: Plasma.
graesslin added a subscriber: plasma-devel.
broulik edited edge metadata.Jan 19 2016, 10:54 PM

+1

greeter/greeterapp.cpp
617

perhaps cache the end?

for (auto it = m_views.constBegin(), end = m_views.constEnd(); it != end; ++it)

powermanagement.cpp
111

I prefer returning a reference for singletons but I guess this way is just consistent with the rest of the APIs there.

150

= default?

waylandserver.cpp
205

Be careful with range-for and Qt containers, this detaches.

219

Same here.

graesslin added inline comments.Jan 20 2016, 7:10 AM
powermanagement.cpp
111

I thought about returning a reference, but considered it not really useful in this case, as it's a QObject, which would result in weird looking connect statements, like:
connect(&PowerManagement::instance()...

150

not sure whether it's allowed in frameworks and as I might want to take the code to frameworks I didn't use it.

waylandserver.cpp
205

You're right - that's what happens if one blindly copy'n'pastes.

graesslin marked 3 inline comments as done.Jan 25 2016, 8:33 AM
graesslin updated this revision to Diff 2085.Jan 25 2016, 8:34 AM
graesslin edited edge metadata.

Fixed issues outlined by Kai.

bshah accepted this revision.Jan 25 2016, 8:39 AM
bshah edited edge metadata.
This revision is now accepted and ready to land.Jan 25 2016, 8:39 AM
broulik accepted this revision.Jan 25 2016, 11:46 AM
broulik edited edge metadata.
This revision was automatically updated to reflect the committed changes.