diff options
author | Joursoir <chat@joursoir.net> | 2021-12-01 19:39:14 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-12-01 19:39:14 +0300 |
commit | 5b90554b7604b76c1ba912cb585e30876d6042ba (patch) | |
tree | 60afde575e61b20aa8a44c4b39f5767fe065233f /Library/UefiShellUfmCommandLib | |
parent | c106872dd21b8b229941a942f6a5e2d4a5b7b575 (diff) | |
download | ufm-5b90554b7604b76c1ba912cb585e30876d6042ba.tar.gz ufm-5b90554b7604b76c1ba912cb585e30876d6042ba.tar.bz2 ufm-5b90554b7604b76c1ba912cb585e30876d6042ba.zip |
tbi/win: make wgetch()
Diffstat (limited to 'Library/UefiShellUfmCommandLib')
-rw-r--r-- | Library/UefiShellUfmCommandLib/tbi/win.c | 19 | ||||
-rw-r--r-- | Library/UefiShellUfmCommandLib/tbi/win.h | 10 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/tbi/win.c b/Library/UefiShellUfmCommandLib/tbi/win.c index 55171da..6ef09a2 100644 --- a/Library/UefiShellUfmCommandLib/tbi/win.c +++ b/Library/UefiShellUfmCommandLib/tbi/win.c @@ -5,6 +5,7 @@ #include <Library/PrintLib.h> // UnicodeVSPrint() #include <Library/BaseMemoryLib.h> #include <Library/MemoryAllocationLib.h> +#include <Library/UefiBootServicesTableLib.h> #include "screen.h" #include "win.h" @@ -122,6 +123,24 @@ VOID echo(struct window *w, BOOLEAN state) w->echo = state; } +EFI_INPUT_KEY wgetch(struct window *w) +{ + UINTN key_event = 0; + EFI_SIMPLE_TEXT_INPUT_PROTOCOL *stdin; + EFI_INPUT_KEY key = { 0 }; + + ASSERT(w != NULL); + + stdin = w->scr->stdin; + gBS->WaitForEvent(1, &stdin->WaitForKey, &key_event); + stdin->ReadKeyStroke(stdin, &key); + + if(echo) { + ; // print char + } + return key; +} + BOOLEAN wmove(struct window *w, INT32 x, INT32 y) { ASSERT(w != NULL); diff --git a/Library/UefiShellUfmCommandLib/tbi/win.h b/Library/UefiShellUfmCommandLib/tbi/win.h index 02822d4..0dfe41b 100644 --- a/Library/UefiShellUfmCommandLib/tbi/win.h +++ b/Library/UefiShellUfmCommandLib/tbi/win.h @@ -87,6 +87,16 @@ VOID wattroff(struct window *w); VOID echo(struct window *w, BOOLEAN state); /* + * Gets character from the input device. + * + * w: the window on which to operate + * + * return: A pointer to a buffer that is filled in with the keystroke + * information for the key that was pressed. +*/ +EFI_INPUT_KEY wgetch(struct window *w); + +/* * Moves cursor position to specified coordinates * * w: the window on which to operate |