From e98d5d6a15c6d4b7345bba1f528a3620c8f7dcc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 20 Jul 2015 11:49:41 +0200 Subject: [PATCH] [wayland] Don't break if we try to vt-switch to vt we're on If we were on e.g. vt 1 and pressed Ctrl+Alt+F1 KWin broke as it disabled rendering for vt switch and vt switched to vt 1, which obviously failed. So let's check whether it's going to switch to the vt we are already on and ignore surch requests. --- virtual_terminal.cpp | 4 ++++ virtual_terminal.h | 1 + 2 files changed, 5 insertions(+) diff --git a/virtual_terminal.cpp b/virtual_terminal.cpp index 4067defbbc..ece59a50fa 100644 --- a/virtual_terminal.cpp +++ b/virtual_terminal.cpp @@ -132,6 +132,7 @@ void VirtualTerminal::setup(int vtNr) closeFd(); return; } + m_vtNumber = vtNr; setActive(true); emit kwinApp()->virtualTerminalCreated(); } @@ -198,6 +199,9 @@ void VirtualTerminal::activate(int vt) if (m_vt < 0) { return; } + if (vt == m_vtNumber) { + return; + } ioctl(m_vt, VT_ACTIVATE, vt); setActive(false); } diff --git a/virtual_terminal.h b/virtual_terminal.h index 8b40beeb8f..efeeb91f9f 100644 --- a/virtual_terminal.h +++ b/virtual_terminal.h @@ -51,6 +51,7 @@ private: int m_vt = -1; QSocketNotifier *m_notifier = nullptr; bool m_active = false; + int m_vtNumber = 0; KWIN_SINGLETON(VirtualTerminal) };