From a25bf237e07972794d6fad783acd9120f08579b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 19 Apr 2016 09:43:23 +0200 Subject: [PATCH] Integrate libinput only through Logind instead of relying on VirtualTerminal All the important information like whether we are on the active vt are also provided by Logind. So instead of integrating with VirtualTerminal, which integrates with Logind, we can just integrate with Logind directly. --- input.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/input.cpp b/input.cpp index fe902c4a7a..8a506725bf 100644 --- a/input.cpp +++ b/input.cpp @@ -35,7 +35,6 @@ along with this program. If not, see . #include "workspace.h" #if HAVE_INPUT #include "libinput/connection.h" -#include "virtual_terminal.h" #endif #include "platform.h" #include "shell_client.h" @@ -773,10 +772,21 @@ InputRedirection::InputRedirection(QObject *parent) qRegisterMetaType(); #if HAVE_INPUT if (Application::usesLibinput()) { - if (VirtualTerminal::self()) { + if (LogindIntegration::self()->hasSessionControl()) { setupLibInput(); } else { - connect(kwinApp(), &Application::virtualTerminalCreated, this, &InputRedirection::setupLibInput); + if (LogindIntegration::self()->isConnected()) { + LogindIntegration::self()->takeControl(); + } else { + connect(LogindIntegration::self(), &LogindIntegration::connectedChanged, LogindIntegration::self(), &LogindIntegration::takeControl); + } + connect(LogindIntegration::self(), &LogindIntegration::hasSessionControlChanged, this, + [this] (bool sessionControl) { + if (sessionControl) { + setupLibInput(); + } + } + ); } } #endif @@ -875,7 +885,7 @@ void InputRedirection::setupWorkspace() void InputRedirection::setupInputFilters() { #if HAVE_INPUT - if (VirtualTerminal::self()) { + if (LogindIntegration::self()->hasSessionControl()) { installInputEventFilter(new VirtualTerminalFilter); } #endif @@ -993,7 +1003,7 @@ void InputRedirection::setupLibInput() } ); } - connect(VirtualTerminal::self(), &VirtualTerminal::activeChanged, m_libInput, + connect(LogindIntegration::self(), &LogindIntegration::sessionActiveChanged, m_libInput, [this] (bool active) { if (!active) { m_libInput->deactivate();