From ccdd7948e22f21d2add8f51c4918a2c576dc5e91 Mon Sep 17 00:00:00 2001 From: Weijie Gao Date: Tue, 29 Oct 2024 17:47:16 +0800 Subject: menu: add support to check if menu needs to be reprinted This patch adds a new callback named need_reprint for menu. The need_reprint will be called before printing the menu. If the callback exists and returns FALSE, menu printing will be canceled. This is very useful if the menu was not changed. It can save time for serial-based menu to handle more input data. Signed-off-by: Weijie Gao Reviewed-by: Daniel Golle Tested-by: Daniel Golle --- include/menu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/menu.h b/include/menu.h index 6571c39b143..79643af272b 100644 --- a/include/menu.h +++ b/include/menu.h @@ -13,6 +13,7 @@ struct menu *menu_create(char *title, int timeout, int prompt, void (*display_statusline)(struct menu *), void (*item_data_print)(void *), char *(*item_choice)(void *), + bool (*need_reprint)(void *), void *item_choice_data); int menu_default_set(struct menu *m, char *item_key); int menu_get_choice(struct menu *m, void **choice); -- cgit v1.2.3