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.
This commit is contained in:
parent
a21ad8d4fa
commit
a25bf237e0
1 changed files with 15 additions and 5 deletions
20
input.cpp
20
input.cpp
|
@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#if HAVE_INPUT
|
#if HAVE_INPUT
|
||||||
#include "libinput/connection.h"
|
#include "libinput/connection.h"
|
||||||
#include "virtual_terminal.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "shell_client.h"
|
#include "shell_client.h"
|
||||||
|
@ -773,10 +772,21 @@ InputRedirection::InputRedirection(QObject *parent)
|
||||||
qRegisterMetaType<KWin::InputRedirection::PointerAxis>();
|
qRegisterMetaType<KWin::InputRedirection::PointerAxis>();
|
||||||
#if HAVE_INPUT
|
#if HAVE_INPUT
|
||||||
if (Application::usesLibinput()) {
|
if (Application::usesLibinput()) {
|
||||||
if (VirtualTerminal::self()) {
|
if (LogindIntegration::self()->hasSessionControl()) {
|
||||||
setupLibInput();
|
setupLibInput();
|
||||||
} else {
|
} 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
|
#endif
|
||||||
|
@ -875,7 +885,7 @@ void InputRedirection::setupWorkspace()
|
||||||
void InputRedirection::setupInputFilters()
|
void InputRedirection::setupInputFilters()
|
||||||
{
|
{
|
||||||
#if HAVE_INPUT
|
#if HAVE_INPUT
|
||||||
if (VirtualTerminal::self()) {
|
if (LogindIntegration::self()->hasSessionControl()) {
|
||||||
installInputEventFilter(new VirtualTerminalFilter);
|
installInputEventFilter(new VirtualTerminalFilter);
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
[this] (bool active) {
|
||||||
if (!active) {
|
if (!active) {
|
||||||
m_libInput->deactivate();
|
m_libInput->deactivate();
|
||||||
|
|
Loading…
Reference in a new issue