aboutsummaryrefslogtreecommitdiff
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-06-20 16:20:05 -0700
committerMichael Brown <mcb30@ipxe.org>2024-06-20 16:24:38 -0700
commit039019039e89aedf4c5a0d81c351638a1e036335 (patch)
tree8af0293694ba5095d2bb9e6cb318d4e27e9726a2 /src/hci
parentc8e50bb0fd3d9d1629e5c78f92bbf7bc9af84f2c (diff)
downloadipxe-039019039e89aedf4c5a0d81c351638a1e036335.zip
ipxe-039019039e89aedf4c5a0d81c351638a1e036335.tar.gz
ipxe-039019039e89aedf4c5a0d81c351638a1e036335.tar.bz2
[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.c7
-rw-r--r--src/hci/tui/menu_ui.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/hci/commands/dynui_cmd.c b/src/hci/commands/dynui_cmd.c
index dbaa669..557c5db 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 00cdab8..b7b52ee 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;
}
}