diff options
author | Michael Brown | 2013-12-06 18:00:06 +0100 |
---|---|---|
committer | Michael Brown | 2013-12-06 18:00:06 +0100 |
commit | f79592545bec486cdd3204a063e9f119a2a96a65 (patch) | |
tree | 4520bfd739172b94c9664cad1667b49848e79dfe /src/hci | |
parent | [login] Adapt user interface to fit display size (diff) | |
download | ipxe-f79592545bec486cdd3204a063e9f119a2a96a65.tar.gz ipxe-f79592545bec486cdd3204a063e9f119a2a96a65.tar.xz ipxe-f79592545bec486cdd3204a063e9f119a2a96a65.zip |
[menu] Adapt user interface to fit display size
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r-- | src/hci/tui/menu_ui.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c index 98f0f0ae..d5645b32 100644 --- a/src/hci/tui/menu_ui.c +++ b/src/hci/tui/menu_ui.c @@ -40,19 +40,19 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define CPAIR_SEPARATOR 3 /* Screen layout */ -#define TITLE_ROW 1 -#define MENU_ROW 3 -#define MENU_COL 1 -#define MENU_ROWS 18 -#define MENU_COLS 78 -#define MENU_PAD 2 +#define TITLE_ROW 1U +#define MENU_ROW 3U +#define MENU_COL 1U +#define MENU_ROWS ( LINES - 2U - MENU_ROW ) +#define MENU_COLS ( COLS - 2U ) +#define MENU_PAD 2U /** A menu user interface */ struct menu_ui { /** Menu */ struct menu *menu; /** Number of menu items */ - int count; + unsigned int count; /** Currently selected item */ int selected; /** First visible item */ @@ -269,7 +269,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) { if ( ui->selected < 0 ) { ui->selected = 0; move = +1; - } else if ( ui->selected >= ui->count ) { + } else if ( ui->selected >= ( int ) ui->count ) { ui->selected = ( ui->count - 1 ); move = -1; } |