From cba327862bacf0f133438b3cc7e39d78c8d762b7 Mon Sep 17 00:00:00 2001 From: Alvin Wang Date: Tue, 5 Nov 2019 20:53:15 +0800 Subject: [PATCH] Add touchwin to force update to screen --- ui/ncurses/nc-add-url.c | 7 ++++++- ui/ncurses/nc-auth.c | 5 ++++- ui/ncurses/nc-boot-editor.c | 3 +++ ui/ncurses/nc-config.c | 6 +++++- ui/ncurses/nc-cui.c | 4 +++- ui/ncurses/nc-lang.c | 7 ++++++- ui/ncurses/nc-menu.c | 2 ++ ui/ncurses/nc-plugin.c | 2 ++ ui/ncurses/nc-scr.c | 1 + ui/ncurses/nc-subset.c | 1 + ui/ncurses/nc-textscreen.c | 2 ++ 11 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ui/ncurses/nc-add-url.c b/ui/ncurses/nc-add-url.c index 33f502da..491c2d7b 100644 --- a/ui/ncurses/nc-add-url.c +++ b/ui/ncurses/nc-add-url.c @@ -81,6 +81,7 @@ static void pad_refresh(struct add_url_screen *screen) getmaxyx(screen->scr.sub_ncw, rows, cols); getbegyx(screen->scr.sub_ncw, y, x); + touchwin(screen->pad); prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols); } @@ -149,6 +150,8 @@ static int add_url_screen_post(struct nc_scr *scr) redrawwin(scr->main_ncw); screen->need_redraw = false; } + + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); pad_refresh(screen); return 0; @@ -179,10 +182,12 @@ static void ok_click(void *arg) struct add_url_screen *screen = arg; if (discover_client_authenticated(screen->cui->client)) { - if (screen_process_form(screen)) + if (screen_process_form(screen)){ /* errors are written to the status line, so we'll need * to refresh */ + touchwin(screen->scr.main_ncw) wrefresh(screen->scr.main_ncw); + } else screen->exit = true; } else { diff --git a/ui/ncurses/nc-auth.c b/ui/ncurses/nc-auth.c index 227c57bf..6c52e723 100644 --- a/ui/ncurses/nc-auth.c +++ b/ui/ncurses/nc-auth.c @@ -101,8 +101,10 @@ static void auth_screen_process_key(struct nc_scr *scr, int key) if (screen->exit) screen->on_exit(screen->cui); - else if (handled) + else if (handled){ + touchwin(screen->scr.sub_ncw); wrefresh(screen->scr.sub_ncw); + } } static void auth_screen_frame_draw(struct nc_scr *scr) @@ -123,6 +125,7 @@ static int auth_screen_post(struct nc_scr *scr) struct auth_screen *screen = auth_screen_from_scr(scr); widgetset_post(screen->widgetset); auth_screen_frame_draw(scr); + touchwin(scr->sub_ncw); wrefresh(scr->sub_ncw); return 0; } diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c index 3f7c5e51..51f94ca9 100644 --- a/ui/ncurses/nc-boot-editor.c +++ b/ui/ncurses/nc-boot-editor.c @@ -100,6 +100,7 @@ static void pad_refresh(struct boot_editor *boot_editor) getmaxyx(boot_editor->scr.sub_ncw, rows, cols); getbegyx(boot_editor->scr.sub_ncw, y, x); + touchwin(boot_editor->pad); prefresh(boot_editor->pad, boot_editor->scroll_y, 0, y, x, rows, cols); } @@ -128,6 +129,7 @@ static int boot_editor_post(struct nc_scr *scr) redrawwin(scr->main_ncw); boot_editor->need_redraw = false; } + touchwin(boot_editor->scr.main_ncw); wrefresh(boot_editor->scr.main_ncw); pad_refresh(boot_editor); return 0; @@ -692,6 +694,7 @@ struct boot_editor *boot_editor_init(struct cui *cui, } boot_editor_draw(boot_editor, sysinfo); + touchwin(boot_editor->scr.main_ncw); wrefresh(boot_editor->scr.main_ncw); return boot_editor; diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 943ee8a8..5047060d 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -150,6 +150,7 @@ static void pad_refresh(struct config_screen *screen) getmaxyx(screen->scr.sub_ncw, rows, cols); getbegyx(screen->scr.sub_ncw, y, x); + touchwin(screen->pad); prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols); } @@ -399,10 +400,12 @@ static void ok_click(void *arg) struct config_screen *screen = arg; if (discover_client_authenticated(screen->cui->client)) { - if (screen_process_form(screen)) + if (screen_process_form(screen)){ /* errors are written to the status line, so we'll need * to refresh */ + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); + } else screen->exit = true; } else { @@ -1315,6 +1318,7 @@ static int config_screen_post(struct nc_scr *scr) redrawwin(scr->main_ncw); screen->need_redraw = false; } + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); pad_refresh(screen); return 0; diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 66f34b6e..e5a700e5 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -809,8 +809,10 @@ static bool process_global_keys(struct cui *cui, int key) switch (key) { case 0xc: - if (cui->current && cui->current->main_ncw) + if (cui->current && cui->current->main_ncw){ + touchwin(curscr); wrefresh(curscr); + } return true; } diff --git a/ui/ncurses/nc-lang.c b/ui/ncurses/nc-lang.c index 91d86e10..d48a2ab7 100644 --- a/ui/ncurses/nc-lang.c +++ b/ui/ncurses/nc-lang.c @@ -98,6 +98,7 @@ static void pad_refresh(struct lang_screen *screen) getmaxyx(screen->scr.sub_ncw, rows, cols); getbegyx(screen->scr.sub_ncw, y, x); + touchwin(screen->pad); prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols); } @@ -183,6 +184,7 @@ static int lang_screen_post(struct nc_scr *scr) widgetset_post(screen->widgetset); nc_scr_frame_draw(scr); + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); pad_refresh(screen); return 0; @@ -223,10 +225,13 @@ static void ok_click(void *arg) } if (discover_client_authenticated(screen->cui->client)) { - if (lang_process_form(screen)) + if (lang_process_form(screen)){ /* errors are written to the status line, so we'll need * to refresh */ + + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); + } else screen->exit = true; } else { diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c index a90a02e3..3d2dc572 100644 --- a/ui/ncurses/nc-menu.c +++ b/ui/ncurses/nc-menu.c @@ -62,6 +62,7 @@ static int pmenu_post(struct nc_scr *scr) result = post_menu(menu->ncm); nc_scr_frame_draw(scr); + touchwin(menu->scr.main_ncw); wrefresh(menu->scr.main_ncw); return result; @@ -370,6 +371,7 @@ static int pmenu_item_get_index(const struct pmenu_item *item) static void pmenu_move_cursor(struct pmenu *menu, int req) { menu_driver(menu->ncm, req); + touchwin(menu->scr.main_ncw); wrefresh(menu->scr.main_ncw); } diff --git a/ui/ncurses/nc-plugin.c b/ui/ncurses/nc-plugin.c index f897cc8e..77d922f3 100644 --- a/ui/ncurses/nc-plugin.c +++ b/ui/ncurses/nc-plugin.c @@ -107,6 +107,7 @@ static void pad_refresh(struct plugin_screen *screen) getmaxyx(screen->scr.sub_ncw, rows, cols); getbegyx(screen->scr.sub_ncw, y, x); + touchwin(screen->pad); prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols); } @@ -179,6 +180,7 @@ static int plugin_screen_post(struct nc_scr *scr) redrawwin(scr->main_ncw); screen->need_redraw = false; } + touchwin(screen->scr.main_ncw); wrefresh(screen->scr.main_ncw); pad_refresh(screen); diff --git a/ui/ncurses/nc-scr.c b/ui/ncurses/nc-scr.c index e95c0ea3..59fca9e8 100644 --- a/ui/ncurses/nc-scr.c +++ b/ui/ncurses/nc-scr.c @@ -111,6 +111,7 @@ void nc_scr_status_printf(struct nc_scr *scr, const char *format, ...) va_end(ap); nc_scr_status_draw(scr); + touchwin(scr->main_ncw); wrefresh(scr->main_ncw); } diff --git a/ui/ncurses/nc-subset.c b/ui/ncurses/nc-subset.c index 9ca3e8aa..ce54446a 100644 --- a/ui/ncurses/nc-subset.c +++ b/ui/ncurses/nc-subset.c @@ -86,6 +86,7 @@ static void pad_refresh(struct subset_screen *screen) getmaxyx(screen->scr.sub_ncw, rows, cols); getbegyx(screen->scr.sub_ncw, y, x); + touchwin(screen->pad); prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols); } diff --git a/ui/ncurses/nc-textscreen.c b/ui/ncurses/nc-textscreen.c index 0be20164..84b40432 100644 --- a/ui/ncurses/nc-textscreen.c +++ b/ui/ncurses/nc-textscreen.c @@ -53,6 +53,7 @@ void text_screen_draw(struct text_screen *screen) mvwaddnstr(screen->scr.sub_ncw, i, 1, screen->lines[i], len); } + touchwin(screen->scr.sub_ncw); wrefresh(screen->scr.sub_ncw); } @@ -89,6 +90,7 @@ static void text_screen_scroll(struct text_screen *screen, int key) mvwaddnstr(screen->scr.sub_ncw, 0, 1, screen->lines[i], len); } + touchwin(screen->scr.sub_ncw); wrefresh(screen->scr.sub_ncw); }