Summary:
So far KWin resolved the logind session to take over by using its own
PID with the method GetSessionByPID. This doesn't work if KWin itself
is not part of the session or if KWin is supposed to take over a
different session.
The session to take over is now derived from XDG_SESSION_ID. If it is
not set the variant through getSessionByPID is used.
This allows to e.g. run kwin on vt1, but have the graphical output
on vt2. Thus it's possible to see the debug output. Also it should allow
to run kwin_wayland through an ssh session, so that gdb can be used.
If we take over another session on a different vt, we need to make sure
that it's the current virtual terminal. Otherwise assumptions in the
startup code would break. So let's ensure the session we integrate with
is active.
Reviewers: #plasma
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1445
LogindIntegration starts monitoring the Active property on the session
and emits a signal when the state changes. The LibInput::Connection
connects to this signal during the setup and uses it to suspend/resume
the libinput context.
With libinput we have the problem that we need to have privileges to
open the device files. In order to not need wrappers or suid bits, we
use logind. This means that kwin_wayland has to be the session controler.
A LogindIntegration is added to connect to logind and wrap the dbus
calls. This is based on the logind integration done for ksld in
ksmserver. The LogindIntegration is started by Workspace and the
InputRedirection tries to become the session controller and starts the
libinput integration only after this succeeded.