diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-05-17 10:02:41 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-05-21 15:29:43 +0800 |
commit | a610837ff38f5cc80bcbad465a80ab920e67927d (patch) | |
tree | 3e157da8508053daef1d400e8dfa3ec7c48e9f56 /ui/ncurses/nc-cui.c | |
parent | 3461b6ad5cb90f1448360d0eb04dd661ae477610 (diff) | |
download | talos-petitboot-a610837ff38f5cc80bcbad465a80ab920e67927d.tar.gz talos-petitboot-a610837ff38f5cc80bcbad465a80ab920e67927d.zip |
ui/ncurses: move getch() out of process_key callbacks
All process_key callbacks will want to query the key that was pressed,
so do the getch() once in cui_process_key, and pass the result to the
callback.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r-- | ui/ncurses/nc-cui.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 167c2bb..3f8995e 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -210,7 +210,14 @@ static int cui_process_key(void *arg) assert(cui->current); ui_timer_disable(&cui->timer); - cui->current->process_key(cui->current); + for (;;) { + int c = getch(); + + if (c == ERR) + break; + + cui->current->process_key(cui->current, c); + } return 0; } |