Fixed a bug that would select a non-selectable entry when wrapping around
the "cursor". Now disables serial output when the boot menu is shown. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -250,6 +250,36 @@ draw_menu(Menu *menu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int32
|
||||||
|
first_selectable_item(Menu *menu)
|
||||||
|
{
|
||||||
|
int32 index = -1;
|
||||||
|
MenuItem *item;
|
||||||
|
|
||||||
|
while ((item = menu->ItemAt(++index)) != NULL) {
|
||||||
|
if (item->IsEnabled() && item->Type() != MENU_ITEM_SEPARATOR)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int32
|
||||||
|
last_selectable_item(Menu *menu)
|
||||||
|
{
|
||||||
|
int32 index = menu->CountItems();
|
||||||
|
MenuItem *item;
|
||||||
|
|
||||||
|
while ((item = menu->ItemAt(--index)) != NULL) {
|
||||||
|
if (item->IsEnabled() && item->Type() != MENU_ITEM_SEPARATOR)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run_menu(Menu *menu)
|
run_menu(Menu *menu)
|
||||||
{
|
{
|
||||||
@@ -283,7 +313,7 @@ run_menu(Menu *menu)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (selected < 0)
|
if (selected < 0)
|
||||||
selected = menu->CountItems() - 1;
|
selected = last_selectable_item(menu);
|
||||||
break;
|
break;
|
||||||
case BIOS_KEY_DOWN:
|
case BIOS_KEY_DOWN:
|
||||||
while ((item = menu->ItemAt(++selected)) != NULL) {
|
while ((item = menu->ItemAt(++selected)) != NULL) {
|
||||||
@@ -291,7 +321,7 @@ run_menu(Menu *menu)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (selected >= menu->CountItems())
|
if (selected >= menu->CountItems())
|
||||||
selected = 0;
|
selected = first_selectable_item(menu);
|
||||||
break;
|
break;
|
||||||
case BIOS_KEY_PAGE_UP:
|
case BIOS_KEY_PAGE_UP:
|
||||||
selected -= menu_height() - 1;
|
selected -= menu_height() - 1;
|
||||||
@@ -428,9 +458,12 @@ void
|
|||||||
platform_run_menu(Menu *menu)
|
platform_run_menu(Menu *menu)
|
||||||
{
|
{
|
||||||
platform_switch_to_text_mode();
|
platform_switch_to_text_mode();
|
||||||
|
serial_disable();
|
||||||
|
// no serial output while we're playing on the console
|
||||||
|
|
||||||
run_menu(menu);
|
run_menu(menu);
|
||||||
|
|
||||||
|
serial_enable();
|
||||||
platform_switch_to_logo();
|
platform_switch_to_logo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user