diff options
author | Michael Brown <mcb30@ipxe.org> | 2024-06-20 16:20:05 -0700 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2024-06-20 16:24:38 -0700 |
commit | 039019039e89aedf4c5a0d81c351638a1e036335 (patch) | |
tree | 8af0293694ba5095d2bb9e6cb318d4e27e9726a2 /src/hci | |
parent | c8e50bb0fd3d9d1629e5c78f92bbf7bc9af84f2c (diff) | |
download | ipxe-039019039e89aedf4c5a0d81c351638a1e036335.tar.gz |
[dynui] Allow for multiple flags on a user interface item
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r-- | src/hci/commands/dynui_cmd.c | 7 | ||||
-rw-r--r-- | src/hci/tui/menu_ui.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/hci/commands/dynui_cmd.c b/src/hci/commands/dynui_cmd.c index dbaa669ef..557c5db5d 100644 --- a/src/hci/commands/dynui_cmd.c +++ b/src/hci/commands/dynui_cmd.c @@ -148,6 +148,7 @@ static int item_exec ( int argc, char **argv ) { struct item_options opts; struct dynamic_ui *dynui; struct dynamic_item *item; + unsigned int flags = 0; char *name = NULL; char *text = NULL; int rc; @@ -174,8 +175,10 @@ static int item_exec ( int argc, char **argv ) { goto err_parse_dynui; /* Add dynamic user interface item */ - item = add_dynui_item ( dynui, name, ( text ? text : "" ), - opts.key, opts.is_default ); + if ( opts.is_default ) + flags |= DYNUI_DEFAULT; + item = add_dynui_item ( dynui, name, ( text ? text : "" ), flags, + opts.key ); if ( ! item ) { rc = -ENOMEM; goto err_add_dynui_item; diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c index 00cdab8df..b7b52ee62 100644 --- a/src/hci/tui/menu_ui.c +++ b/src/hci/tui/menu_ui.c @@ -267,7 +267,7 @@ int show_menu ( struct dynamic_ui *dynui, unsigned long timeout, if ( strcmp ( select, item->name ) == 0 ) ui.scroll.current = ui.scroll.count; } else { - if ( item->is_default ) + if ( item->flags & DYNUI_DEFAULT ) ui.scroll.current = ui.scroll.count; } } |