]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[menu] Adapt user interface to fit display size
authorMichael Brown <mcb30@ipxe.org>
Fri, 6 Dec 2013 17:00:06 +0000 (17:00 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 6 Dec 2013 17:00:06 +0000 (17:00 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/hci/tui/menu_ui.c

index 98f0f0aefe155a343284223e6043bff75f1d1760..d5645b32ab010e22da094ece7a13d0e15f3775b4 100644 (file)
@@ -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;
                        }