diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-08-23 23:44:31 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-08-23 23:44:31 +0000 |
commit | 19f44a61cfb333c363d823e43b5de282ef2d2ed0 (patch) | |
tree | 77aeee29551bc99be86adc39f43436ebc4bda5f1 /apps/gui | |
parent | 7dfec97c5d0c0295403bb97570a5f524b2cb26b4 (diff) | |
download | rockbox-19f44a61cfb333c363d823e43b5de282ef2d2ed0.tar.gz rockbox-19f44a61cfb333c363d823e43b5de282ef2d2ed0.zip |
Fix redraw issues when the statusbar setting was changed with an UI viewport. Now the old statusbar area is cleared upon changing the setting.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22484 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/statusbar.c | 50 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 9 |
2 files changed, 46 insertions, 13 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 024ade330f..1a724406ef 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "powermgmt.h" | 34 | #include "powermgmt.h" |
35 | #include "usb.h" | 35 | #include "usb.h" |
36 | #include "led.h" | 36 | #include "led.h" |
37 | #include "screen_access.h" | ||
37 | 38 | ||
38 | #include "status.h" /* needed for battery_state global var */ | 39 | #include "status.h" /* needed for battery_state global var */ |
39 | #include "action.h" /* for keys_locked */ | 40 | #include "action.h" /* for keys_locked */ |
@@ -172,13 +173,23 @@ static void gui_statusbar_init(struct gui_statusbar * bar) | |||
172 | #endif | 173 | #endif |
173 | } | 174 | } |
174 | 175 | ||
176 | #define GET_RECT(vp, vals,display) do { \ | ||
177 | viewport_set_fullscreen(&(vp), (display)->screen_type); \ | ||
178 | (vp).height = STATUSBAR_HEIGHT; \ | ||
179 | (vp).x = STATUSBAR_X_POS; \ | ||
180 | if ((vals) != STATUSBAR_BOTTOM) \ | ||
181 | (vp).y = 0; \ | ||
182 | else \ | ||
183 | (vp).y = (display)->lcdheight - STATUSBAR_HEIGHT; \ | ||
184 | } while(0) | ||
185 | |||
175 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | 186 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) |
176 | { | 187 | { |
177 | struct screen * display = bar->display; | 188 | struct screen * display = bar->display; |
178 | 189 | ||
179 | #ifdef HAVE_LCD_CHARCELLS | 190 | #ifdef HAVE_LCD_CHARCELLS |
180 | int val; | 191 | int val; |
181 | (void)force_redraw; /* players always "redraw" */ | 192 | (void)force_redraw; /* The Player always has "redraw" */ |
182 | #endif /* HAVE_LCD_CHARCELLS */ | 193 | #endif /* HAVE_LCD_CHARCELLS */ |
183 | 194 | ||
184 | bar->info.battlevel = battery_level(); | 195 | bar->info.battlevel = battery_level(); |
@@ -263,13 +274,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
263 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) | 274 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) |
264 | { | 275 | { |
265 | struct viewport vp; | 276 | struct viewport vp; |
266 | viewport_set_fullscreen(&vp, display->screen_type); | 277 | |
267 | vp.height = STATUSBAR_HEIGHT; | 278 | GET_RECT(vp,statusbar_position(display->screen_type),display); |
268 | vp.x = STATUSBAR_X_POS; | ||
269 | if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM) | ||
270 | vp.y = 0; | ||
271 | else | ||
272 | vp.y = display->lcdheight - STATUSBAR_HEIGHT; | ||
273 | display->set_viewport(&vp); | 279 | display->set_viewport(&vp); |
274 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 280 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
275 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); | 281 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); |
@@ -816,11 +822,33 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, | |||
816 | } | 822 | } |
817 | } | 823 | } |
818 | 824 | ||
819 | void gui_statusbar_changed(int enabled) | 825 | #ifdef HAVE_LCD_BITMAP |
826 | void gui_statusbar_changed( enum screen_type screen, | ||
827 | enum statusbar_values old) | ||
820 | { | 828 | { |
821 | (void)enabled; | 829 | /* clear and update the statusbar area to remove old parts */ |
822 | send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); | 830 | enum statusbar_values bar; |
831 | #ifdef HAVE_REMOTE_LCD | ||
832 | if (screen == SCREEN_REMOTE) | ||
833 | bar = global_settings.remote_statusbar; | ||
834 | else | ||
835 | #endif | ||
836 | bar = global_settings.statusbar; | ||
837 | |||
838 | struct screen *display = &screens[screen]; | ||
839 | struct viewport vp; | ||
840 | |||
841 | if (old != STATUSBAR_OFF && old != bar) | ||
842 | { | ||
843 | GET_RECT(vp, old, display); | ||
844 | display->set_viewport(&vp); | ||
845 | display->clear_viewport(); | ||
846 | display->update_viewport(); | ||
847 | display->set_viewport(NULL); | ||
848 | } | ||
823 | } | 849 | } |
850 | #endif | ||
851 | |||
824 | #ifdef HAVE_REMOTE_LCD | 852 | #ifdef HAVE_REMOTE_LCD |
825 | int statusbar_position(int screen) | 853 | int statusbar_position(int screen) |
826 | { | 854 | { |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index c2829a029b..169b76b15a 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -54,6 +54,9 @@ struct status_info { | |||
54 | 54 | ||
55 | }; | 55 | }; |
56 | 56 | ||
57 | /* statusbar visibility/position, used for settings also */ | ||
58 | enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM }; | ||
59 | |||
57 | struct gui_statusbar | 60 | struct gui_statusbar |
58 | { | 61 | { |
59 | long battery_icon_switch_tick; | 62 | long battery_icon_switch_tick; |
@@ -97,8 +100,10 @@ struct gui_syncstatusbar | |||
97 | }; | 100 | }; |
98 | 101 | ||
99 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); | 102 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); |
100 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); | 103 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, |
101 | void gui_statusbar_changed(int enabled); | 104 | bool force_redraw); |
105 | void gui_statusbar_changed(enum screen_type screen, | ||
106 | enum statusbar_values old); | ||
102 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) | 107 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) |
103 | #define statusbar_position(a) (global_settings.statusbar) | 108 | #define statusbar_position(a) (global_settings.statusbar) |
104 | #else | 109 | #else |