Switch virtual teminal through logind seat
When we get the key code for virtual terminal switching we pass it to Logind instead of going through the "legacy" ioctl interface.
This commit is contained in:
parent
e435b73fed
commit
a21ad8d4fa
3 changed files with 15 additions and 1 deletions
|
@ -114,7 +114,7 @@ public:
|
|||
if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) {
|
||||
const xkb_keysym_t keysym = event->nativeVirtualKey();
|
||||
if (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12) {
|
||||
VirtualTerminal::self()->activate(keysym - XKB_KEY_XF86Switch_VT_1 + 1);
|
||||
LogindIntegration::self()->switchVirtualTerminal(keysym - XKB_KEY_XF86Switch_VT_1 + 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
13
logind.cpp
13
logind.cpp
|
@ -362,4 +362,17 @@ void LogindIntegration::getSeat()
|
|||
);
|
||||
}
|
||||
|
||||
void LogindIntegration::switchVirtualTerminal(quint32 vtNr)
|
||||
{
|
||||
if (!m_connected || m_seatPath.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service,
|
||||
m_seatPath,
|
||||
QStringLiteral("org.freedesktop.login1.Seat"),
|
||||
QStringLiteral("SwitchTo"));
|
||||
message.setArguments(QVariantList{vtNr});
|
||||
m_bus.asyncCall(message);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
1
logind.h
1
logind.h
|
@ -48,6 +48,7 @@ public:
|
|||
int vt() const {
|
||||
return m_vt;
|
||||
}
|
||||
void switchVirtualTerminal(quint32 vtNr);
|
||||
|
||||
void takeControl();
|
||||
void releaseControl();
|
||||
|
|
Loading…
Reference in a new issue