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
parent
e435b73fed
commit
a21ad8d4fa
|
@ -114,7 +114,7 @@ public:
|
||||||
if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) {
|
if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) {
|
||||||
const xkb_keysym_t keysym = event->nativeVirtualKey();
|
const xkb_keysym_t keysym = event->nativeVirtualKey();
|
||||||
if (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12) {
|
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;
|
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
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue