summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-boot-editor.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-09-02 15:43:39 +1000
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-09-07 16:55:52 +1000
commit9384b0ab3b9bec1744c19c64ac5431db99110b04 (patch)
treeb5fed2d89b6a3cc20a10e9cbc007913dae09b1e8 /ui/ncurses/nc-boot-editor.c
parent72148c718113a17d80fd1da3c8dd82b471bed07a (diff)
downloadtalos-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-boot-editor.c')
-rw-r--r--ui/ncurses/nc-boot-editor.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c
index e2357f9..4012ec5 100644
--- a/ui/ncurses/nc-boot-editor.c
+++ b/ui/ncurses/nc-boot-editor.c
@@ -44,6 +44,7 @@ struct boot_editor {
struct pmenu_item *item,
struct pb_boot_data *bd);
bool need_redraw;
+ bool need_update;
int label_x;
int field_x;
@@ -109,7 +110,14 @@ static struct boot_editor *boot_editor_from_arg(void *arg)
static int boot_editor_post(struct nc_scr *scr)
{
struct boot_editor *boot_editor = boot_editor_from_scr(scr);
- widgetset_post(boot_editor->widgetset);
+
+ if (boot_editor->need_update) {
+ boot_editor_update(boot_editor, boot_editor->cui->sysinfo);
+ boot_editor->need_update = false;
+ } else {
+ widgetset_post(boot_editor->widgetset);
+ }
+
nc_scr_frame_draw(scr);
if (boot_editor->need_redraw) {
redrawwin(scr->main_ncw);
@@ -506,6 +514,11 @@ void boot_editor_update(struct boot_editor *boot_editor,
{
int height;
+ if (boot_editor->cui->current != boot_editor_scr(boot_editor)) {
+ boot_editor->need_update = true;
+ return;
+ }
+
widgetset_unpost(boot_editor->widgetset);
height = pad_height(sysinfo ? sysinfo->n_blockdevs : 0);
@@ -546,6 +559,7 @@ struct boot_editor *boot_editor_init(struct cui *cui,
boot_editor->on_exit = on_exit;
boot_editor->state = STATE_EDIT;
boot_editor->need_redraw = false;
+ boot_editor->need_update = false;
int ncols1 = strncols(_("Device tree:"));
int ncols2 = strncols(_("Boot arguments:"));
OpenPOWER on IntegriCloud