diff options
Diffstat (limited to 'ui-curses.c')
| -rw-r--r-- | ui-curses.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui-curses.c b/ui-curses.c index 1b3af1e..d6f042b 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -15,7 +15,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <termios.h> -#include <termkey.h> #include "ui-curses.h" #include "vis.h" @@ -1079,14 +1078,23 @@ static TermKey *ui_termkey_new(int fd) { return termkey; } +static TermKey *ui_termkey_get(Ui *ui) { + UiCurses *uic = (UiCurses*)ui; + return uic->termkey; +} + static void ui_suspend(Ui *ui) { endwin(); raise(SIGSTOP); } -static void ui_needkey(Ui *ui) { - UiCurses *uic = (UiCurses*)ui; - termkey_advisereadable(uic->termkey); +static bool ui_haskey(Ui *ui) { + nodelay(stdscr, TRUE); + int c = getch(); + if (c != ERR) + ungetch(c); + nodelay(stdscr, FALSE); + return c != ERR; } static const char *ui_getkey(Ui *ui) { @@ -1175,7 +1183,9 @@ Ui *ui_curses_new(void) { .init = ui_init, .start = ui_start, .free = ui_curses_free, + .termkey_get = ui_termkey_get, .suspend = ui_suspend, + .resize = ui_resize, .update = ui_update, .window_new = ui_window_new, .window_free = ui_window_free, @@ -1187,7 +1197,7 @@ Ui *ui_curses_new(void) { .die = ui_die, .info = ui_info, .info_hide = ui_info_hide, - .needkey = ui_needkey, + .haskey = ui_haskey, .getkey = ui_getkey, .terminal_save = ui_terminal_save, .terminal_restore = ui_terminal_restore, |
