summaryrefslogtreecommitdiff
path: root/Kernel/TTY/VirtualConsole.cpp
diff options
context:
space:
mode:
authorConrad Pankoff <deoxxa@fknsrs.biz>2019-08-18 12:04:09 +1000
committerAndreas Kling <awesomekling@gmail.com>2019-08-18 07:37:12 +0200
commit879bc28e14f1a998128ff784799db6b7c52ec79c (patch)
tree28f54f8d119d261a40fea3392c914ace6fecd045 /Kernel/TTY/VirtualConsole.cpp
parent36e3e7b75a284493ea2442f8f9ec8d5fa302b9ce (diff)
downloadserenity-879bc28e14f1a998128ff784799db6b7c52ec79c.zip
Kernel: Disable VGA console in graphical mode
Diffstat (limited to 'Kernel/TTY/VirtualConsole.cpp')
-rw-r--r--Kernel/TTY/VirtualConsole.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp
index 7fd1d5ccba..9955762fff 100644
--- a/Kernel/TTY/VirtualConsole.cpp
+++ b/Kernel/TTY/VirtualConsole.cpp
@@ -81,12 +81,20 @@ void VirtualConsole::switch_to(unsigned index)
{
if ((int)index == s_active_console)
return;
- dbgprintf("VC: Switch to %u (%p)\n", index, s_consoles[index]);
ASSERT(index < 6);
ASSERT(s_consoles[index]);
+
InterruptDisabler disabler;
- if (s_active_console != -1)
- s_consoles[s_active_console]->set_active(false);
+ if (s_active_console != -1) {
+ auto* active_console = s_consoles[s_active_console];
+ // We won't know how to switch away from a graphical console until we
+ // can set the video mode on our own. Just stop anyone from trying for
+ // now.
+ if (active_console->is_graphical())
+ return;
+ active_console->set_active(false);
+ }
+ dbgprintf("VC: Switch to %u (%p)\n", index, s_consoles[index]);
s_active_console = index;
s_consoles[s_active_console]->set_active(true);
Console::the().set_implementation(s_consoles[s_active_console]);
@@ -420,6 +428,10 @@ void VirtualConsole::put_character_at(unsigned row, unsigned column, u8 ch)
void VirtualConsole::on_char(u8 ch)
{
+ // ignore writes in graphical mode
+ if (m_graphical)
+ return;
+
switch (m_escape_state) {
case ExpectBracket:
if (ch == '[')
@@ -494,6 +506,10 @@ void VirtualConsole::on_char(u8 ch)
void VirtualConsole::on_key_pressed(KeyboardDevice::Event key)
{
+ // ignore keyboard in graphical mode
+ if (m_graphical)
+ return;
+
if (!key.is_press())
return;
if (key.ctrl()) {