From 16b67e5812e8b6d5425864655c2825512709b538 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Thu, 5 Jul 2007 23:20:58 +0000 Subject: [PATCH] Make sure statusbar is updated when time changes. Fixes FS #7388. Moved time variable around and added init of info struct. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13802 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/statusbar.c | 12 ++++++++++-- apps/gui/statusbar.h | 9 ++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index bbf01abd7c..043fbd3e76 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -157,6 +157,10 @@ static void gui_statusbar_init(struct gui_statusbar * bar) { bar->redraw_volume = true; bar->volume_icon_switch_tick = bar->battery_icon_switch_tick = current_tick; + memset((void*)&(bar->lastinfo), 0, sizeof(struct status_info)); +#if CONFIG_RTC + bar->last_tm_min = 0; +#endif } void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) @@ -239,11 +243,14 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) bar->info.led = led_read(HZ/2); /* delay should match polling interval */ #endif #if CONFIG_RTC - bar->info.time = get_time(); + bar->time = get_time(); #endif /* CONFIG_RTC */ /* only redraw if forced to, or info has changed */ if (force_redraw || bar->redraw_volume || +#if CONFIG_RTC + (bar->time->tm_min != bar->last_tm_min) || +#endif memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) { display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); @@ -313,7 +320,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) gui_statusbar_icon_lock_remote(display); #endif #if CONFIG_RTC - gui_statusbar_time(display, bar->info.time); + gui_statusbar_time(display, bar->time); + bar->last_tm_min = bar->time->tm_min; #endif /* CONFIG_RTC */ #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) if(!display->has_disk_led && bar->info.led) diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 2be765b8e8..8862620596 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h @@ -33,10 +33,6 @@ struct status_info { int volume; int playmode; int repeat; -#if CONFIG_RTC - struct tm *time; -#endif - #if CONFIG_CHARGING bool inserted; #endif @@ -65,7 +61,10 @@ struct gui_statusbar struct status_info info; struct status_info lastinfo; - +#if CONFIG_RTC + struct tm *time; + int last_tm_min; +#endif struct screen * display; };