From 474c803c32fe055b4f09cb779f22b70d7eba8325 Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 17 Oct 2018 02:39:56 +0200 Subject: screen areas invalidation --- userspace/files/icons.ppm | Bin 6220801 -> 6220801 bytes userspace/init.c | 24 ++++++++++++++++++-- userspace/newcalls.h | 9 ++++++++ userspace/xterm/terminal.c | 17 +++++++++------ userspace/xterm/vesa.c | 6 ++++- userspace/xterm/xterm.c | 53 +++++++++++++++++++++++++-------------------- 6 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 userspace/newcalls.h (limited to 'userspace') diff --git a/userspace/files/icons.ppm b/userspace/files/icons.ppm index 45ce414..9d0ae35 100644 Binary files a/userspace/files/icons.ppm and b/userspace/files/icons.ppm differ diff --git a/userspace/init.c b/userspace/init.c index 4c55a12..e1ab531 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -6,8 +6,28 @@ char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PA int main(int argc, char **argv) { - _execve("/bin/xterm",argv1,env1); - while(1); // never reached hopefully + execve("/bin/xterm",argv1,env1); + /* + + int pid=fork(); + + if(!pid) + { + execve("/bin/xterm",argv1,env1); + } + else + { + while(1) + { + _gui_win(); + vesa_init(0); + void *tty=terminal_init_vesa(); + getchar(); + terminal_put('X'); + } + + } + */ } /* diff --git a/userspace/newcalls.h b/userspace/newcalls.h new file mode 100644 index 0000000..177e100 --- /dev/null +++ b/userspace/newcalls.h @@ -0,0 +1,9 @@ +#include +#include "../interface/syscalls.h" + +/** invalidate screen rectangle */ +// we pack x,y and width,height togehter +int _gui_inval(uint32_t xy, uint32_t wh) +{ + return syscall(SYSCALL_GUI_RECT,xy,wh,0); +} diff --git a/userspace/xterm/terminal.c b/userspace/xterm/terminal.c index 15fbd36..07c21cf 100644 --- a/userspace/xterm/terminal.c +++ b/userspace/xterm/terminal.c @@ -86,6 +86,7 @@ typedef struct term_out_struct void (*update_cursor)(uint32_t col,uint32_t row); }term_out; +// NOT USED (TODO?) typedef struct term_in_struct { void (*put_char)(uint8_t c); @@ -398,13 +399,6 @@ terminal_tty terminal_init(term_out *screen,term_in *input) term_out tout; terminal_tty tty; -terminal_tty* terminal_init_vesa() -{ - tout.put_char=vesa_console_put_char; - tout.update_cursor=vesa_update_cursor; - tty=(terminal_init(&tout,NULL)); - return &tty; -} // send one ASCII character to the terminal void terminal_put(terminal_tty *tty, uint8_t c) @@ -655,3 +649,12 @@ void terminal_put(terminal_tty *tty, uint8_t c) tty->screen->update_cursor(tty->x,tty->y); return; } + +// initialize terminal for vesa +terminal_tty* terminal_init_vesa() +{ + tout.put_char=vesa_console_put_char; + tout.update_cursor=vesa_update_cursor; + tty=(terminal_init(&tout,NULL)); + return &tty; +} diff --git a/userspace/xterm/vesa.c b/userspace/xterm/vesa.c index b6cec2f..6d61498 100644 --- a/userspace/xterm/vesa.c +++ b/userspace/xterm/vesa.c @@ -4,6 +4,7 @@ #include #include #include "vesa.h" +#include "../newcalls.h" void PutFont(char c, int x,int y, int color_fg,int color_bg); @@ -62,7 +63,6 @@ void vesa_update_cursor(uint32_t col,uint32_t row) console_x=col; console_y=row; - vesa_console_put_char(termdata[oldy*80+oldx],termdata_bg[oldy*80+oldx],termdata_fg[oldy*80+oldx],oldx,oldy); vesa_console_put_char(termdata[row*80+col],termdata_bg[row*80+col],termdata_fg[row*80+col],col,row); } @@ -194,6 +194,10 @@ void PutFont(char c, int x,int y, int color_fg,int color_bg) else PutPixel(posx,posy,color_bg); } } + + // invalidate area + _gui_inval((x<<16)|(y),(font_width+1<<16)|(font_height+1)); + /* for(int y=0;y