diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-05-17 10:26:05 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-05-21 15:29:43 +0800 |
commit | 9168031edb7affc437928a9123faf8fcbddf5d2a (patch) | |
tree | 8a33229750e7a719a64265d045bc573f25e52977 /ui | |
parent | a610837ff38f5cc80bcbad465a80ab920e67927d (diff) | |
download | petitboot-9168031edb7affc437928a9123faf8fcbddf5d2a.zip petitboot-9168031edb7affc437928a9123faf8fcbddf5d2a.tar.gz |
ui/ncurses: implement global keys
Add process_global_keys to handle global key events. Using this,
implement ctrl+l to refresh.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ncurses/nc-cui.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 3f8995e..d091331 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -199,6 +199,19 @@ struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr) return old; } +static bool process_global_keys(struct cui *cui, int key) +{ + switch (key) { + case 0xc: + if (cui->current && cui->current->main_ncw) { + redrawwin(cui->current->main_ncw); + wrefresh(cui->current->main_ncw); + } + return true; + } + return false; +} + /** * cui_process_key - Process input on stdin. */ @@ -216,6 +229,9 @@ static int cui_process_key(void *arg) if (c == ERR) break; + if (process_global_keys(cui, c)) + continue; + cui->current->process_key(cui->current, c); } |