ui/ncurses: do all config screen updates in config_screen_post
authorJeremy Kerr <jk@ozlabs.org>
Fri, 13 Dec 2013 02:09:06 +0000 (10:09 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 31 Jan 2014 00:46:34 +0000 (08:46 +0800)
We call _post when the config screen is to be displayed, so do all
drawing here. This means we get the same drawing code on both init and
update.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-config.c

index 74105f1f5c6d853e16e31f549f22c84f2520b419..9cc6a29085ff3e4b21b14d3bb11ed4ec689e6763 100644 (file)
@@ -131,6 +131,8 @@ static int config_screen_post(struct nc_scr *scr)
        struct config_screen *screen = config_screen_from_scr(scr);
        widgetset_post(screen->widgetset);
        nc_scr_frame_draw(scr);
+       redrawwin(scr->main_ncw);
+       wrefresh(screen->scr.main_ncw);
        pad_refresh(screen);
        return 0;
 }
@@ -580,8 +582,7 @@ static void config_screen_widget_focus(struct nc_widget *widget, void *arg)
        pad_refresh(screen);
 }
 
-
-void config_screen_update(struct config_screen *screen,
+static void config_screen_draw(struct config_screen *screen,
                const struct config *config,
                const struct system_info *sysinfo)
 {
@@ -626,7 +627,13 @@ void config_screen_update(struct config_screen *screen,
 
        if (repost)
                widgetset_post(screen->widgetset);
+}
 
+void config_screen_update(struct config_screen *screen,
+               const struct config *config,
+               const struct system_info *sysinfo)
+{
+       config_screen_draw(screen, config, sysinfo);
        pad_refresh(screen);
 }
 
@@ -666,9 +673,7 @@ struct config_screen *config_screen_init(struct cui *cui,
 
        scrollok(screen->scr.sub_ncw, true);
 
-       config_screen_update(screen, config, sysinfo);
-
-       wrefresh(screen->scr.main_ncw);
+       config_screen_draw(screen, config, sysinfo);
 
        return screen;
 }