summaryrefslogtreecommitdiff
path: root/Source/Kernel/VTManager
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/VTManager')
-rw-r--r--Source/Kernel/VTManager/FileVT.class.cpp4
-rw-r--r--Source/Kernel/VTManager/FileVT.class.h2
-rw-r--r--Source/Kernel/VTManager/PipeVT.class.cpp2
-rw-r--r--Source/Kernel/VTManager/ScrollableVT.class.cpp2
-rw-r--r--Source/Kernel/VTManager/ScrollableVT.class.h2
-rw-r--r--Source/Kernel/VTManager/SimpleVT.class.h2
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal-sc.proto.cpp31
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.proto.h12
8 files changed, 48 insertions, 9 deletions
diff --git a/Source/Kernel/VTManager/FileVT.class.cpp b/Source/Kernel/VTManager/FileVT.class.cpp
index 0acc623..5469fbd 100644
--- a/Source/Kernel/VTManager/FileVT.class.cpp
+++ b/Source/Kernel/VTManager/FileVT.class.cpp
@@ -31,8 +31,8 @@ void FileVT::put(WChar c, bool updatecsr) {
}
}
-Kbd::keypress_t FileVT::getKeypress(bool show, bool block) {
- Kbd::keypress_t ret;
+keypress_t FileVT::getKeypress(bool show, bool block) {
+ keypress_t ret;
if (m_isWriting) return ret;
if (m_bufferPos == m_buffer.size()) {
diff --git a/Source/Kernel/VTManager/FileVT.class.h b/Source/Kernel/VTManager/FileVT.class.h
index ed3e224..a246ce0 100644
--- a/Source/Kernel/VTManager/FileVT.class.h
+++ b/Source/Kernel/VTManager/FileVT.class.h
@@ -18,7 +18,7 @@ class FileVT : public VirtualTerminal {
void setCursorCol(u32int col);
void put(WChar c, bool updatecsr = true);
- Kbd::keypress_t getKeypress(bool show = true, bool block = true);
+ keypress_t getKeypress(bool show = true, bool block = true);
};
#endif
diff --git a/Source/Kernel/VTManager/PipeVT.class.cpp b/Source/Kernel/VTManager/PipeVT.class.cpp
index 10c7e7b..7e67161 100644
--- a/Source/Kernel/VTManager/PipeVT.class.cpp
+++ b/Source/Kernel/VTManager/PipeVT.class.cpp
@@ -11,7 +11,7 @@ void PipeVT::setCursorCol(u32int col) {
}
void PipeVT::put(WChar c, bool updatecsr) {
- Kbd::keypress_t kp;
+ keypress_t kp;
if (c.value == '\t') {
m_col = (m_col + 8) &~(8 - 1);
kp.hascmd = true;
diff --git a/Source/Kernel/VTManager/ScrollableVT.class.cpp b/Source/Kernel/VTManager/ScrollableVT.class.cpp
index ca0075a..264c3a4 100644
--- a/Source/Kernel/VTManager/ScrollableVT.class.cpp
+++ b/Source/Kernel/VTManager/ScrollableVT.class.cpp
@@ -69,7 +69,7 @@ void ScrollableVT::scroll() {
SimpleVT::scroll();
}
-void ScrollableVT::keyPress(Kbd::keypress_t kp) {
+void ScrollableVT::keyPress(keypress_t kp) {
if (kp.hascmd && kp.modifiers == STATUS_SHIFT) {
s32int nlup = m_linesup;
if (kp.command == KBDC_PGUP) {
diff --git a/Source/Kernel/VTManager/ScrollableVT.class.h b/Source/Kernel/VTManager/ScrollableVT.class.h
index fbc2c4c..6d29645 100644
--- a/Source/Kernel/VTManager/ScrollableVT.class.h
+++ b/Source/Kernel/VTManager/ScrollableVT.class.h
@@ -18,7 +18,7 @@ class ScrollableVT : public SimpleVT {
void redraw();
void scroll();
- void keyPress(Kbd::keypress_t kp);
+ void keyPress(keypress_t kp);
};
#endif
diff --git a/Source/Kernel/VTManager/SimpleVT.class.h b/Source/Kernel/VTManager/SimpleVT.class.h
index 6a50549..9eda6de 100644
--- a/Source/Kernel/VTManager/SimpleVT.class.h
+++ b/Source/Kernel/VTManager/SimpleVT.class.h
@@ -22,6 +22,8 @@ class SimpleVT : public VirtualTerminal {
void clear();
void setColor(u8int fgcolor, u8int bgcolor = 0xFF);
bool isBoxed() { return true; }
+ u8int height() { return m_rows; }
+ u8int width() { return m_cols; }
void map(s32int row = -1, s32int col = -1);
void unmap();
diff --git a/Source/Kernel/VTManager/VirtualTerminal-sc.proto.cpp b/Source/Kernel/VTManager/VirtualTerminal-sc.proto.cpp
index 5506c74..47941c6 100644
--- a/Source/Kernel/VTManager/VirtualTerminal-sc.proto.cpp
+++ b/Source/Kernel/VTManager/VirtualTerminal-sc.proto.cpp
@@ -8,10 +8,14 @@ call_t VirtualTerminal::m_callTable[] = {
CALL1(VTIF_WRITE, &VirtualTerminal::writeSC),
CALL1(VTIF_PUT, &VirtualTerminal::putSC),
CALL1(VTIF_READLINE, &VirtualTerminal::readLineSC),
+ CALL1(VTIF_GETKEYPRESS, &VirtualTerminal::getKeypressSC),
CALL1(VTIF_SETCOLOR, &VirtualTerminal::setColorSC),
CALL1(VTIF_SETCSRLINE, &VirtualTerminal::setCursorLineSC),
CALL1(VTIF_SETCSRCOL, &VirtualTerminal::setCursorColSC),
CALL0(VTIF_ISBOXED, &VirtualTerminal::isBoxedSC),
+ CALL0(VTIF_GETHEIGHT, &VirtualTerminal::getHeightSC),
+ CALL0(VTIF_GETWIDTH, &VirtualTerminal::getWidthSC),
+ CALL2(VTIF_LOCATE, &VirtualTerminal::locateSC),
CALL0(0, 0)
};
@@ -47,6 +51,14 @@ u32int VirtualTerminal::readLineSC(u32int show) {
return readLine(show != 0).serialize();
}
+u32int VirtualTerminal::getKeypressSC(u32int flags) {
+ bool show = (flags & 1), block = (flags & 2);
+ keypress_t temp = getKeypress(show, block);
+ void* ptr = Mem::mkXchgSpace(sizeof(keypress_t));
+ memcpy((u8int*)ptr, (const u8int*)&temp, sizeof(keypress_t));
+ return (u32int)ptr;
+}
+
u32int VirtualTerminal::setColorSC(u32int x) {
setColor((x >> 8) & 0xFF, x & 0xFF);
return 0;
@@ -65,3 +77,22 @@ u32int VirtualTerminal::setCursorColSC(u32int c) {
u32int VirtualTerminal::isBoxedSC() {
return (isBoxed() ? 1 : 0);
}
+
+u32int VirtualTerminal::getHeightSC() {
+ return height();
+}
+
+u32int VirtualTerminal::getWidthSC() {
+ return width();
+}
+
+u32int VirtualTerminal::locateSC(u32int line, u32int col) {
+ if (line < 1000 and col < 1000) {
+ moveCursor(line, col);
+ } else if (line < 1000) {
+ setCursorLine(line);
+ } else if (col < 1000) {
+ setCursorCol(line);
+ }
+ return 0;
+}
diff --git a/Source/Kernel/VTManager/VirtualTerminal.proto.h b/Source/Kernel/VTManager/VirtualTerminal.proto.h
index 9c138ec..5f874b4 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.proto.h
+++ b/Source/Kernel/VTManager/VirtualTerminal.proto.h
@@ -17,7 +17,7 @@ struct vtchr {
class VirtualTerminal : public Ressource {
protected:
Mutex m_kbdMutex, m_kbdbuffMutex;
- Vector<Kbd::keypress_t> m_kbdbuff; //Key press events buffer
+ Vector<keypress_t> m_kbdbuff; //Key press events buffer
//SYSCALLS :
static call_t m_callTable[];
@@ -26,10 +26,14 @@ class VirtualTerminal : public Ressource {
u32int writeSC(u32int);
u32int putSC(u32int);
u32int readLineSC(u32int);
+ u32int getKeypressSC(u32int);
u32int setColorSC(u32int);
u32int setCursorLineSC(u32int);
u32int setCursorColSC(u32int);
u32int isBoxedSC();
+ u32int getHeightSC();
+ u32int getWidthSC();
+ u32int locateSC(u32int, u32int);
bool accessible() { return true; }
public:
@@ -40,6 +44,8 @@ class VirtualTerminal : public Ressource {
virtual void setColor(u8int fgcolor, u8int bgcolor = 0xFF) {} //For a pipe/file VT, this will do nothing.
virtual bool isBoxed() = 0;
+ virtual u8int height() { return 0; }
+ virtual u8int width() { return 0; }
virtual void updateCursor() {}
virtual void moveCursor(u32int row, u32int col) {} //These are not implemented for pipe/file VTs
@@ -60,8 +66,8 @@ class VirtualTerminal : public Ressource {
inline VirtualTerminal& operator<<(u32int i) { writeHex(i); return *this; }
//Keyboard functions
- virtual void keyPress(Kbd::keypress_t kp); //Called by Kbd:: when a key is pressed, overloaded by ScrollableVT
- virtual Kbd::keypress_t getKeypress(bool show = true, bool block = true); //Block : must we wait for a key to be pressed ?
+ virtual void keyPress(keypress_t kp); //Called by Kbd:: when a key is pressed, overloaded by ScrollableVT
+ virtual keypress_t getKeypress(bool show = true, bool block = true); //Block : must we wait for a key to be pressed ?
String readLine(bool show = true);
};