aboutsummaryrefslogtreecommitdiffstats
path: root/ui.c
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2012-07-17 21:49:23 -0700
committerKoushik Dutta <koushd@gmail.com>2012-07-17 21:51:41 -0700
commit92095766c2b9a59e05b42d153f6cca26774824f1 (patch)
treee37b1c67784faeabfea4da370fd775aff2754305 /ui.c
parent382525c2ba8cb91933644cdf1f6703fa279388dd (diff)
downloadbootable_recovery-92095766c2b9a59e05b42d153f6cca26774824f1.zip
bootable_recovery-92095766c2b9a59e05b42d153f6cca26774824f1.tar.gz
bootable_recovery-92095766c2b9a59e05b42d153f6cca26774824f1.tar.bz2
fix a bunch of off by one errors. disable display toggle.
Change-Id: Ie34a787188f7df5ab46573bba50dd593bc728514
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/ui.c b/ui.c
index 4405ead..e500cf7 100644
--- a/ui.c
+++ b/ui.c
@@ -253,7 +253,6 @@ static void draw_screen_locked(void)
int total_rows = gr_fb_height() / CHAR_HEIGHT;
int i = 0;
int j = 0;
- int offset = 0; // offset of separating bar under menus
int row = 0; // current row that we are drawing on
if (show_menu) {
#ifndef BOARD_TOUCH_RECOVERY
@@ -287,11 +286,8 @@ static void draw_screen_locked(void)
break;
}
- 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);
+ gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
+ gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
#else
row = draw_touch_menu(menu, menu_items, menu_top, menu_sel, menu_show_start);
#endif
@@ -763,13 +759,10 @@ int ui_start_menu(char** headers, char** items, int initial_selection) {
menu[i][MENU_MAX_COLS-1] = '\0';
}
- if (gShowBackButton && ui_menu_level > 0) {
+ if (gShowBackButton && !ui_root_menu) {
strcpy(menu[i], " - +++++Go Back+++++");
++i;
}
-
- strcpy(menu[i], " ");
- ++i;
menu_items = i - menu_top;
show_menu = 1;
@@ -777,7 +770,7 @@ int ui_start_menu(char** headers, char** items, int initial_selection) {
update_screen_locked();
}
pthread_mutex_unlock(&gUpdateMutex);
- if (gShowBackButton && ui_menu_level > 0) {
+ if (gShowBackButton && !ui_root_menu) {
return menu_items - 1;
}
return menu_items;
@@ -790,8 +783,8 @@ int ui_menu_select(int sel) {
old_sel = menu_sel;
menu_sel = sel;
- if (menu_sel < 0) menu_sel = menu_items-1 + menu_sel;
- if (menu_sel >= menu_items-1) menu_sel = menu_sel - menu_items+1;
+ if (menu_sel < 0) menu_sel = menu_items + menu_sel;
+ if (menu_sel >= menu_items) menu_sel = menu_sel - menu_items;
if (menu_sel < menu_show_start && menu_show_start > 0) {
@@ -982,6 +975,10 @@ int ui_get_showing_back_button() {
return gShowBackButton;
}
+int ui_is_showing_back_button() {
+ return gShowBackButton && !ui_root_menu;
+}
+
int ui_get_selected_item() {
return menu_sel;
}