aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/menu-bar.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-29 16:19:22 +0300
committerJoursoir <chat@joursoir.net>2021-11-29 16:19:22 +0300
commit16c83b50e88a3f4bb344a918c4ebe4cae5a38e31 (patch)
treefb5c9d283e1c1f0d31b00ec8c94bd11f842fcaf0 /Library/UefiShellUfmCommandLib/menu-bar.c
parentfc34983b91dcababe019ca63721ea2bcd2ac1b6a (diff)
downloadufm-16c83b50e88a3f4bb344a918c4ebe4cae5a38e31.tar.gz
ufm-16c83b50e88a3f4bb344a918c4ebe4cae5a38e31.tar.bz2
ufm-16c83b50e88a3f4bb344a918c4ebe4cae5a38e31.zip
menu-bar: not use a global variable
Diffstat (limited to 'Library/UefiShellUfmCommandLib/menu-bar.c')
-rw-r--r--Library/UefiShellUfmCommandLib/menu-bar.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/Library/UefiShellUfmCommandLib/menu-bar.c b/Library/UefiShellUfmCommandLib/menu-bar.c
index ff1ac7e..0503388 100644
--- a/Library/UefiShellUfmCommandLib/menu-bar.c
+++ b/Library/UefiShellUfmCommandLib/menu-bar.c
@@ -4,22 +4,27 @@
#include "tbi/win.h"
#include "menu-bar.h"
-struct window *menubar = NULL;
-
-BOOLEAN init_menubar(struct screen *scr)
+struct window *init_menubar(struct screen *scr)
{
- menubar = newwin(scr, scr->columns, 1, 0, 0);
+ struct window *menubar = newwin(scr, scr->columns, 1, 0, 0);
if(!menubar)
- return FALSE;
+ return NULL;
- wrefresh(menubar);
- return TRUE;
+ mvwprintf(menubar, 0, 0, L"Menu bar");
+ menubar_refresh(menubar);
+ return menubar;
}
-VOID free_menubar(VOID)
+VOID free_menubar(struct window *w)
{
- ASSERT(menubar != NULL);
+ ASSERT(w != NULL);
+
+ delwin(w);
+}
- delwin(menubar);
- menubar = NULL;
+VOID menubar_refresh(struct window *w)
+{
+ ASSERT(w != NULL);
+
+ wrefresh(w);
}