[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.
This commit is contained in:
Martin Gräßlin 2015-07-20 11:49:41 +02:00
parent 01d805f193
commit e98d5d6a15
2 changed files with 5 additions and 0 deletions

View file

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

View file

@ -51,6 +51,7 @@ private:
int m_vt = -1;
QSocketNotifier *m_notifier = nullptr;
bool m_active = false;
int m_vtNumber = 0;
KWIN_SINGLETON(VirtualTerminal)
};