From 1c50ff29e69c4df6c6459e12942d62237e028b34 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 31 Jan 2012 20:02:38 -0800 Subject: [PATCH] Fix ui menu bug for long menus. Change-Id: If009dee6b7597daeec62dd65baa7ad35e1adec5d Conflicts: ui.c --- ui.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui.c b/ui.c index a3cce50..a56d8c0 100644 --- a/ui.c +++ b/ui.c @@ -238,8 +238,8 @@ static void draw_screen_locked(void) row++; } - if (menu_items - menu_show_start + menu_top >= MAX_ROWS) - j = MAX_ROWS - menu_top; + if (menu_items - menu_show_start + menu_top >= max_menu_rows) + j = max_menu_rows - menu_top; else j = menu_items - menu_show_start; @@ -254,13 +254,13 @@ static void draw_screen_locked(void) draw_text_line(i - menu_show_start, menu[i]); } row++; - if (row == max_menu_rows) + if (row >= max_menu_rows) break; } - if (menu_items <= MAX_ROWS) + if (menu_items <= max_menu_rows) offset = 1; - + gr_fill(0, (row-offset)*CHAR_HEIGHT+CHAR_HEIGHT/2-1, gr_fb_width(), (row-offset)*CHAR_HEIGHT+CHAR_HEIGHT/2+1); } @@ -444,6 +444,8 @@ void ui_init(void) text_col = text_row = 0; text_rows = gr_fb_height() / CHAR_HEIGHT; max_menu_rows = text_rows - MIN_LOG_ROWS; + if (max_menu_rows > MENU_MAX_ROWS) + max_menu_rows = MENU_MAX_ROWS; if (text_rows > MAX_ROWS) text_rows = MAX_ROWS; text_top = 1;