mirror of https://github.com/ipxe/ipxe.git
[menu] Adapt user interface to fit display size
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/17/head
parent
0344dc0094
commit
f79592545b
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue