From 478c691187fbc9ba4ccaacf92f57828eef20041c Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 18 May 2012 19:06:35 +0200 Subject: Simple shell added. Simple fprintf function added too. --- src/kernel/ui/vt.cpp | 14 ++++++++++++-- src/kernel/ui/vt.h | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/kernel/ui') diff --git a/src/kernel/ui/vt.cpp b/src/kernel/ui/vt.cpp index 2869fec..2bd82ca 100644 --- a/src/kernel/ui/vt.cpp +++ b/src/kernel/ui/vt.cpp @@ -1,7 +1,7 @@ #include "vt.h" #include -vt *ke_vt = 0; +vt *ke_vt = 0, *home_vt = 0; vt::vt(node* parent, int ww, int hh) : node(parent, FT_TERMINAL) { w = ww; h = hh; @@ -9,6 +9,7 @@ vt::vt(node* parent, int ww, int hh) : node(parent, FT_TERMINAL) { bgcolor = TC_BLACK; output = 0; cursor_visible = true; + csr_l = csr_c = 0; kbd_buffer_filled = 0; kbd_waiter = 0; @@ -148,9 +149,18 @@ void vt::outputTo(display *display) { } } } + output->text_setcsr(csr_l, csr_c, cursor_visible); } -void vt::keyboardInput(keypress kp) { +void vt::keyboardInput(keypress kp, keyboard* from) { + if (kp.command == KB_RSUPER || kp.command == KB_LSUPER) { + if (this == home_vt) return; + // go to home terminal + home_vt->outputTo(output); + from->outputTo(home_vt); + output = 0; + return; + } // convert to sequence of chars int n = 0; char b[8]; diff --git a/src/kernel/ui/vt.h b/src/kernel/ui/vt.h index b26e95a..a80452b 100644 --- a/src/kernel/ui/vt.h +++ b/src/kernel/ui/vt.h @@ -45,7 +45,7 @@ class vt : public node { void outputTo(display *display); - void keyboardInput(keypress kp); + void keyboardInput(keypress kp, keyboard* from); virtual int write(size_t offset, size_t len, char* buffer); virtual int read(size_t offset, size_t len, char* buffer); // get keyboard input @@ -53,7 +53,7 @@ class vt : public node { virtual int link(node* to, int mode); }; -extern vt *ke_vt; +extern vt *ke_vt, *home_vt; #define NL ke_vt->writeStr("\n"); #define TAB ke_vt->writeStr("\t"); #define WHERE { ke_vt->writeStr("(ke:"); \ -- cgit v1.2.3