From 4b472de39b30c079ff846aec83d2da33cc0adcc5 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sat, 3 Jan 2009 13:27:19 +0000 Subject: a few more button/statusbar fixes... * hopefully fix the last of the plugins which dont handle the enw SYS event. * fix FS#9750 - WPS's which dont specify (or force the wps on) wernt showing the statusbar at all * lamp, battery_bench, *_flash button handling fixes * plugins using the core menu code will again show the statusbar git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19656 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 3 +-- apps/gui/statusbar.c | 2 +- apps/menu.c | 2 ++ apps/plugins/battery_bench.c | 21 ++++++++++++++------- apps/plugins/firmware_flash.c | 2 +- apps/plugins/iriver_flash.c | 2 +- apps/plugins/lamp.c | 8 +++++--- apps/plugins/rockbox_flash.c | 2 +- 8 files changed, 26 insertions(+), 16 deletions(-) (limited to 'apps') diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 2b1d6417e2..e218c123f3 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -85,8 +85,7 @@ static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) if (wps->data->wps_sb_tag) draw = wps->data->show_sb_on_wps; - if (!draw) - viewportmanager_set_statusbar(false); + viewportmanager_set_statusbar(draw); } #else #define gui_wps_statusbar_draw(wps, force) diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 29b80112f7..b4e99f8885 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -341,7 +341,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) if(!display->has_disk_led && bar->info.led) gui_statusbar_led(display); #endif - display->update_rect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); + display->update_viewport(); bar->lastinfo = bar->info; } #endif /* HAVE_LCD_BITMAP */ diff --git a/apps/menu.c b/apps/menu.c index b5309a047e..419db3ae3e 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -355,6 +355,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, const struct menu_item_ex *temp, *menu; int ret = 0, i; bool redraw_lists; + bool oldbars = viewportmanager_set_statusbar(!hide_bars); const struct menu_item_ex *menu_stack[MAX_MENUS]; int menu_stack_selected_item[MAX_MENUS]; @@ -696,6 +697,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, *start_selected = get_menu_selection( gui_synclist_get_sel_pos(&lists), menu); } + viewportmanager_set_statusbar(oldbars); return ret; } diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 7c67cca937..6559f535af 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c @@ -224,6 +224,7 @@ static unsigned int buf_idx; bool exit_tsr(bool reenter) { + long button; (void)reenter; rb->lcd_clear_display(); rb->lcd_puts_scroll(0, 0, "Batt.Bench is currently running."); @@ -233,15 +234,21 @@ bool exit_tsr(bool reenter) #endif rb->lcd_update(); - if (rb->button_get(true) == BATTERY_OFF) + while (1) { - rb->queue_post(&thread_q, EV_EXIT, 0); - rb->thread_wait(thread_id); - /* remove the thread's queue from the broadcast list */ - rb->queue_delete(&thread_q); - return true; + button = rb->button_get(true); + if (IS_SYSEVENT(button)) + continue; + if (button == BATTERY_OFF) + { + rb->queue_post(&thread_q, EV_EXIT, 0); + rb->thread_wait(thread_id); + /* remove the thread's queue from the broadcast list */ + rb->queue_delete(&thread_q); + return true; + } + else return false; } - else return false; } #define BIT_CHARGER 0x1 diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c index 376ae7f80f..6380f6dbdb 100644 --- a/apps/plugins/firmware_flash.c +++ b/apps/plugins/firmware_flash.c @@ -592,7 +592,7 @@ int WaitForButton(void) do { button = rb->button_get(true); - } while (button & BUTTON_REL); + } while (IS_SYSEVENT(button) || (button & BUTTON_REL)); return button; } diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index 9f26f82d13..e7ae056d38 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c @@ -230,7 +230,7 @@ int wait_for_button(void) do { button = rb->button_get(true); - } while (button & BUTTON_REL); + } while (IS_SYSEVENT(button) || (button & BUTTON_REL)); return button; } diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c index e355ee4ce3..ace6545865 100644 --- a/apps/plugins/lamp.c +++ b/apps/plugins/lamp.c @@ -110,6 +110,7 @@ static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */ /* this is the plugin entry point */ enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { + long button; (void)parameter; rb = api; @@ -167,7 +168,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame rb->lcd_clear_display(); rb->lcd_update(); - switch(rb->button_get(true)) + switch((button = rb->button_get(true))) { case LAMP_RIGHT: #ifdef LAMP_NEXT @@ -196,9 +197,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame case (LAMP_PREV|BUTTON_REL): #endif /* LAMP_PREV */ /* eat these... */ - break; + break; default: - quit = true; + if (!IS_SYSEVENT(button)) + quit = true; } } while (!quit); diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index 6323ca9736..d0dc73875e 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c @@ -516,7 +516,7 @@ static int WaitForButton(void) do { button = rb->button_get(true); - } while (button & BUTTON_REL); + } while (IS_SYSEVENT(button) || (button & BUTTON_REL)); return button; } -- cgit v1.2.3