From 30dd2ce466d6d38e4af35e786b92bde824ca4502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 31 Mar 2015 09:33:05 +0200 Subject: [PATCH] [input] Add support for VT switch shortcuts If we have a VirtualTerminal and get a XKB_KEY_XF86Switch_VT_* keysym we trigger a VT switch. --- input.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/input.cpp b/input.cpp index 28c69e7fe0..0f08e49f6c 100644 --- a/input.cpp +++ b/input.cpp @@ -35,6 +35,7 @@ along with this program. If not, see . #if HAVE_WAYLAND #include "abstract_backend.h" #include "wayland_server.h" +#include "virtual_terminal.h" #include #endif // Qt @@ -44,6 +45,7 @@ along with this program. If not, see . #include #if HAVE_XKB #include +#include #endif // system #include @@ -500,6 +502,17 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa if (oldMods != keyboardModifiers()) { emit keyboardModifiersChanged(keyboardModifiers(), oldMods); } +#if HAVE_WAYLAND + // check for vt-switch + if (VirtualTerminal::self()) { + const xkb_keysym_t keysym = m_xkb->toKeysym(key); + if (state == KWin::InputRedirection::KeyboardKeyPressed && + (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12)) { + VirtualTerminal::self()->activate(keysym - XKB_KEY_XF86Switch_VT_1 + 1); + return; + } + } +#endif // TODO: pass to internal parts of KWin #ifdef KWIN_BUILD_TABBOX if (TabBox::TabBox::self() && TabBox::TabBox::self()->isGrabbed()) {