[ksmserver] Create a dedicated binary from KSMShutdownDlg

Authored by graesslin on Jul 22 2016, 7:57 AM.

Description

[ksmserver] Create a dedicated binary from KSMShutdownDlg

Summary:
The idea behind this change is to have a dedicated binary for the
logout dialog. As a follow up ksmserver needs to be adjusted to invoke
the helper binary instead of interacting with KSMShutdownDlg directly.

This will bring quite some improvements to the logout architecture:

  • ksmserver doesn't need to run a QEventLoop to wait for the dialog to finish
  • it becomes easier to test changes for the logout dialog, one doesn't need to restart the session any more
  • ksmserver becomes better guarded against problems in the UI layer (e.g. OpenGL errors)
  • the binary can be changed to support Wayland
  • ksmserver becomes better guarded against problems with updating Qt while the session is running

This change only introduces the creation of the binary. A new sub-dir
"logout-greeter" is added which creates a ksmserver-logout-greeter.
The greeter defines various command line arguments for the options which
are being passed to the KSMShutdownDlg.

If the dialog returns an exit value of 0 it is interpreted as accepted.
A return value != 0 indicates that the user rejected the logout.

The dialog also passes additional values back. In particular the logout
method might be changed and returned back to ksmserver. To support this
operation a pipe filedescriptor can be passed to the greeter. If present
the greeter will write the numerical value of KWorkspace::ShutdownType
into the pipe on success.

To indicate how the interaction - especially the reading from pipe -
works, the change comes with an additional test binary. It forwards
the command line arguments and creates the pipe to pass to the greeter
and reads it back in a helper thread to be non-blocking. This approach is
inspired from kwin_wayland's starting of Xwayland.

Test Plan: See the new test binary

Reviewers: Plasma

Subscribers: plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D2252

Details