aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-04 03:21:06 +0300
committerJoursoir <chat@joursoir.net>2021-11-04 03:21:06 +0300
commit854718a302d46a588bd2aa1a62664569b6f41553 (patch)
treec0f04217de52e54d9ac402760d817da82296126f
parenta5f15c8e9db0dc8e6a782392b4ed91ccee3eff98 (diff)
downloadufm-854718a302d46a588bd2aa1a62664569b6f41553.tar.gz
ufm-854718a302d46a588bd2aa1a62664569b6f41553.tar.bz2
ufm-854718a302d46a588bd2aa1a62664569b6f41553.zip
tbi/win: make wrefresh()
-rw-r--r--lib/tbi/win.c36
-rw-r--r--lib/tbi/win.h9
2 files changed, 45 insertions, 0 deletions
diff --git a/lib/tbi/win.c b/lib/tbi/win.c
index 172f9a9..7e3b413 100644
--- a/lib/tbi/win.c
+++ b/lib/tbi/win.c
@@ -252,3 +252,39 @@ UINTN EFIAPI wvprintf(struct window *w, CONST CHAR16 *fmt, VA_LIST args)
return length;
}
+VOID wrefresh(struct window *w)
+{
+ UINTN x, y;
+ INT32 attributes;
+ CHAR16 tmp_ch, *print_ptr;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *stdout;
+
+ ASSERT(w != NULL);
+
+ attributes = w->attr[0][0];
+ stdout = w->scr->stdout;
+ stdout->SetAttribute(stdout, attributes);
+
+ for(y = 0; y < w->height; y++) {
+ stdout->SetCursorPosition(stdout, w->begx, w->begy + y);
+ print_ptr = w->text[y];
+
+ for(x = 0; x <= (w->width); x++) {
+ if(w->text[y][x] == CHAR_NULL || attributes != w->attr[y][x])
+ {
+ tmp_ch = w->text[y][x];
+ w->text[y][x] = CHAR_NULL;
+ stdout->OutputString(stdout, print_ptr);
+ w->text[y][x] = tmp_ch;
+
+ print_ptr = &(w->text[y][x]);
+ if(w->text[y][x] != CHAR_NULL) {
+ attributes = w->attr[y][x];
+ stdout->SetAttribute(stdout, attributes);
+ }
+ }
+ }
+ }
+
+ stdout->SetAttribute(stdout, w->scr->attr);
+}
diff --git a/lib/tbi/win.h b/lib/tbi/win.h
index 3c42538..76be2d8 100644
--- a/lib/tbi/win.h
+++ b/lib/tbi/win.h
@@ -174,4 +174,13 @@ UINTN EFIAPI mvwprintf(struct window *w, INT32 x, INT32 y, CONST CHAR16 *fmt, ..
*/
UINTN EFIAPI wvprintf(struct window *w, CONST CHAR16 *fmt, VA_LIST args);
+/*
+ * Does the output of window to the terminal
+ *
+ * w: the window on which to operate
+ *
+ * return: VOID
+*/
+VOID wrefresh(struct window *w);
+
#endif /* UFM_TBI_WINDOW_H */