Stopping the console when a task is in foreground
This commit is contained in:
parent
5d11d37470
commit
9ccebc0d93
4 changed files with 18 additions and 1 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include "unicode.h"
|
||||
|
||||
void console_init(void);
|
||||
void console_start(void);
|
||||
void console_stop(void);
|
||||
void cout_clear(void);
|
||||
void cin_clear(void);
|
||||
void cout_putc(unicode_char c);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ void console_init(void)
|
|||
CONSOLE_MAX_COLS,
|
||||
cin_data
|
||||
);
|
||||
register_editor_key_event_listener(console_editor_key_event_listener);
|
||||
}
|
||||
|
||||
void cout_clear() {
|
||||
|
|
@ -63,6 +62,18 @@ void cin_clear() {
|
|||
window_glyph_to_framebuffer(&cin_win, cin_cursor_y, cin_cursor_x, true);
|
||||
}
|
||||
|
||||
void console_start(void)
|
||||
{
|
||||
cout_clear();
|
||||
cin_clear();
|
||||
register_editor_key_event_listener(console_editor_key_event_listener);
|
||||
}
|
||||
|
||||
void console_stop(void)
|
||||
{
|
||||
unregister_editor_key_event_listener(console_editor_key_event_listener);
|
||||
}
|
||||
|
||||
void cout_putc(uint32_t c)
|
||||
{
|
||||
int col = cout_cursor_x;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ void _start() {
|
|||
|
||||
fb_init();
|
||||
console_init();
|
||||
console_start();
|
||||
|
||||
cpu_init();
|
||||
interrupt_handler_register(0x08, double_fault_handler);
|
||||
|
|
@ -78,8 +79,10 @@ void _start() {
|
|||
// do nothing. PS2 controller should send interrupts.
|
||||
__asm__("hlt");
|
||||
if (task) {
|
||||
console_stop();
|
||||
task();
|
||||
task = NULL;
|
||||
console_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,3 +225,4 @@ glyph window_get(struct window *win, unsigned int row, unsigned int col) {
|
|||
}
|
||||
return win->data[row * win->num_cols + col];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue