summaryrefslogtreecommitdiff
path: root/apps/gui/viewport.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-01-27 20:34:51 +0000
committerThomas Martitz <kugel@rockbox.org>2010-01-27 20:34:51 +0000
commitfeb3a261c7373bec1c5dada090e4e37880c34de6 (patch)
treed8865927b31ddc4accdf4c9f6c0f3cf2ab0049bf /apps/gui/viewport.c
parent32265959c8e9bd946be7cf5df91ade5089526fa0 (diff)
Fix multiscreen handling of the viewportmanager.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24351 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r--apps/gui/viewport.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index ad9fad6846..a76de4bf4b 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -69,16 +69,10 @@ static int theme_stack_top[NB_SCREENS]; /* the last item added */
static struct viewport_stack_item theme_stack[NB_SCREENS][VPSTACK_DEPTH];
static bool is_theme_enabled(enum screen_type screen);
-static void toggle_theme(enum screen_type screen, bool force)
+
+static void toggle_events(bool enable)
{
- bool enable_event = false;
- static bool was_enabled[NB_SCREENS] = {false};
- int i;
- FOR_NB_SCREENS(i)
- {
- enable_event = enable_event || is_theme_enabled(i);
- }
- if (enable_event)
+ if (enable)
{
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
@@ -88,8 +82,34 @@ static void toggle_theme(enum screen_type screen, bool force)
do_sbs_update_callback);
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false,
do_sbs_update_callback);
-
-#if LCD_DEPTH > 1
+ }
+ else
+ {
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ remove_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback);
+#endif
+ remove_event(PLAYBACK_EVENT_TRACK_CHANGE, do_sbs_update_callback);
+ remove_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_sbs_update_callback);
+ remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
+ }
+}
+
+
+static void toggle_theme(enum screen_type screen, bool force)
+{
+ bool enable_event = false;
+ static bool was_enabled[NB_SCREENS] = {false};
+ int i;
+
+ FOR_NB_SCREENS(i)
+ {
+ enable_event = enable_event || is_theme_enabled(i);
+ }
+ toggle_events(enable_event);
+
+ if (is_theme_enabled(screen))
+ {
+#if LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1
screens[screen].backdrop_show(BACKDROP_MAIN);
#endif
/* remove the left overs from the previous screen.
@@ -144,20 +164,10 @@ static void toggle_theme(enum screen_type screen, bool force)
}
else
{
- FOR_NB_SCREENS(i)
- {
-#if LCD_DEPTH > 1
- screens[i].backdrop_hide();
+#if LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1
+ screens[screen].backdrop_hide();
#endif
- screens[i].stop_scroll();
- }
-
-#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
- remove_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback);
-#endif
- remove_event(PLAYBACK_EVENT_TRACK_CHANGE, do_sbs_update_callback);
- remove_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_sbs_update_callback);
- remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
+ screens[screen].stop_scroll();
}
/* let list initialize viewport in case viewport dimensions is changed. */
send_event(GUI_EVENT_THEME_CHANGED, NULL);