diff options
author | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-09-02 15:43:39 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-09-07 16:55:52 +1000 |
commit | 9384b0ab3b9bec1744c19c64ac5431db99110b04 (patch) | |
tree | b5fed2d89b6a3cc20a10e9cbc007913dae09b1e8 /ui/ncurses/nc-textscreen.c | |
parent | 72148c718113a17d80fd1da3c8dd82b471bed07a (diff) | |
download | talos-petitboot-9384b0ab3b9bec1744c19c64ac5431db99110b04.tar.gz talos-petitboot-9384b0ab3b9bec1744c19c64ac5431db99110b04.zip |
ui/ncurses: Improve update handling in nested screens
Several screens in petitboot-nc require an update if a config or sysinfo
update is received. However if those screens exist but are not the
current screen they will incorrectly try to draw to the screen.
Where the currently active screen is a textscreen (eg. a help screen)
the update is delayed until after the screen is exited.
In the particular case of nc-config where the current screen can be an
nc-subset screen, the nc-subset screen is exited immediately so the
update can be performed, since the nc-subset screen depends on the
information in the previous screen.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'ui/ncurses/nc-textscreen.c')
-rw-r--r-- | ui/ncurses/nc-textscreen.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/ncurses/nc-textscreen.c b/ui/ncurses/nc-textscreen.c index 826244c..55428e7 100644 --- a/ui/ncurses/nc-textscreen.c +++ b/ui/ncurses/nc-textscreen.c @@ -183,6 +183,13 @@ void text_screen_set_help(struct text_screen *screen, const char *title, static int text_screen_post(struct nc_scr *scr) { + struct text_screen *screen = text_screen_from_scr(scr); + + if (screen->need_update) { + text_screen_draw(screen); + screen->need_update = false; + } + nc_scr_frame_draw(scr); redrawwin(scr->main_ncw); wrefresh(scr->main_ncw); @@ -202,6 +209,7 @@ void text_screen_init(struct text_screen *screen, struct cui *cui, screen->cui = cui; screen->on_exit = on_exit; + screen->need_update = false; screen->scr.frame.ltitle = talloc_strdup(screen, title); screen->scr.frame.rtitle = NULL; |