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.
icc-effect-5.14.5
Martin Gräßlin 2016-04-19 09:36:28 +02:00
parent e435b73fed
commit a21ad8d4fa
3 changed files with 15 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -48,6 +48,7 @@ public:
int vt() const {
return m_vt;
}
void switchVirtualTerminal(quint32 vtNr);
void takeControl();
void releaseControl();