summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-12-21 05:19:12 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-12-21 05:19:12 +0000
commit9d1832cfba5ad91c815aa181b299f5cd53252681 (patch)
tree1bc915c0ec15e996189cced2001f7e76f38c49ab /apps
parent88ae46cc88acf38c72ce3f9f7618d07007c92cd7 (diff)
downloadrockbox-9d1832cfba5ad91c815aa181b299f5cd53252681.tar.gz
rockbox-9d1832cfba5ad91c815aa181b299f5cd53252681.tar.bz2
rockbox-9d1832cfba5ad91c815aa181b299f5cd53252681.zip
fix FS#10870 - slightly change the viewportmanager theme undo-er to be able to force an update even if the theme isnt being toggled from off to on which caused WPS artifacts when leaving the WPS if the theme was enabled
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24087 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/gui/list.c2
-rw-r--r--apps/gui/splash.c2
-rw-r--r--apps/gui/usb_screen.c2
-rw-r--r--apps/gui/viewport.c97
-rw-r--r--apps/gui/viewport.h6
-rw-r--r--apps/gui/wps.c11
-rw-r--r--apps/menu.c2
-rw-r--r--apps/menus/eq_menu.c2
-rw-r--r--apps/menus/theme_menu.c4
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/recorder/keyboard.c2
-rw-r--r--apps/screens.c2
13 files changed, 72 insertions, 64 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 74169301e2..2691d2dc8d 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2665,7 +2665,7 @@ static int menu_action_callback(int btn, struct gui_synclist *lists)
menuitems[gui_synclist_get_sel_pos(lists)].function();
btn = ACTION_REDRAW;
FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
}
return btn;
}
diff --git a/apps/gui/list.c b/apps/gui/list.c
index eacebb5c30..8e350b514c 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -908,7 +908,7 @@ bool simplelist_show_list(struct simplelist_info *info)
}
talk_shutup();
FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
return false;
}
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 39d224a742..7e4617bb73 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -212,7 +212,7 @@ void splashf(int ticks, const char *fmt, ...)
if (ticks)
sleep(ticks);
FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
}
void splash(int ticks, const char *str)
diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c
index fb09d3ea61..338cb0fe44 100644
--- a/apps/gui/usb_screen.c
+++ b/apps/gui/usb_screen.c
@@ -320,7 +320,7 @@ void gui_usb_screen_run(void)
screens[i].backlight_on();
if(screen_theme_needs_undo[i])
{
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
}
}
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 6e8491d110..6e0d269228 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -69,7 +69,7 @@ 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(void)
+static void toggle_theme(enum screen_type screen, bool force)
{
bool enable_event = false;
static bool was_enabled[NB_SCREENS] = {false};
@@ -91,53 +91,50 @@ static void toggle_theme(void)
/* remove the left overs from the previous screen.
* could cause a tiny flicker. Redo your screen code if that happens */
- FOR_NB_SCREENS(i)
+ if (!was_enabled[screen] || force)
{
- if (!was_enabled[i])
+ struct viewport deadspace, user;
+ viewport_set_defaults(&user, screen);
+ deadspace = user; /* get colours and everything */
+ /* above */
+ deadspace.x = 0;
+ deadspace.y = 0;
+ deadspace.width = screens[screen].lcdwidth;
+ deadspace.height = user.y;
+ if (deadspace.width && deadspace.height)
+ {
+ screens[screen].set_viewport(&deadspace);
+ screens[screen].clear_viewport();
+ screens[screen].update_viewport();
+ }
+ /* below */
+ deadspace.y = user.y + user.height;
+ deadspace.height = screens[screen].lcdheight - deadspace.y;
+ if (deadspace.width && deadspace.height)
+ {
+ screens[screen].set_viewport(&deadspace);
+ screens[screen].clear_viewport();
+ screens[screen].update_viewport();
+ }
+ /* left */
+ deadspace.x = 0;
+ deadspace.y = 0;
+ deadspace.width = user.x;
+ deadspace.height = screens[screen].lcdheight;
+ if (deadspace.width && deadspace.height)
+ {
+ screens[screen].set_viewport(&deadspace);
+ screens[screen].clear_viewport();
+ screens[screen].update_viewport();
+ }
+ /* below */
+ deadspace.x = user.x + user.width;
+ deadspace.width = screens[screen].lcdwidth - deadspace.x;
+ if (deadspace.width && deadspace.height)
{
- struct viewport deadspace, user;
- viewport_set_defaults(&user, i);
- deadspace = user; /* get colours and everything */
- /* above */
- deadspace.x = 0;
- deadspace.y = 0;
- deadspace.width = screens[i].lcdwidth;
- deadspace.height = user.y;
- if (deadspace.width && deadspace.height)
- {
- screens[i].set_viewport(&deadspace);
- screens[i].clear_viewport();
- screens[i].update_viewport();
- }
- /* below */
- deadspace.y = user.y + user.height;
- deadspace.height = screens[i].lcdheight - deadspace.y;
- if (deadspace.width && deadspace.height)
- {
- screens[i].set_viewport(&deadspace);
- screens[i].clear_viewport();
- screens[i].update_viewport();
- }
- /* left */
- deadspace.x = 0;
- deadspace.y = 0;
- deadspace.width = user.x;
- deadspace.height = screens[i].lcdheight;
- if (deadspace.width && deadspace.height)
- {
- screens[i].set_viewport(&deadspace);
- screens[i].clear_viewport();
- screens[i].update_viewport();
- }
- /* below */
- deadspace.x = user.x + user.width;
- deadspace.width = screens[i].lcdwidth - deadspace.x;
- if (deadspace.width && deadspace.height)
- {
- screens[i].set_viewport(&deadspace);
- screens[i].clear_viewport();
- screens[i].update_viewport();
- }
+ screens[screen].set_viewport(&deadspace);
+ screens[screen].clear_viewport();
+ screens[screen].update_viewport();
}
}
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
@@ -167,19 +164,19 @@ void viewportmanager_theme_enable(enum screen_type screen, bool enable,
panicf("Stack overflow... viewportmanager");
theme_stack[screen][top].enabled = enable;
theme_stack[screen][top].vp = viewport;
- toggle_theme();
+ toggle_theme(screen, false);
/* then be nice and set the viewport up */
if (viewport)
viewport_set_defaults(viewport, screen);
}
-void viewportmanager_theme_undo(enum screen_type screen)
+void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw)
{
int top = --theme_stack_top[screen];
if (top < 0)
panicf("Stack underflow... viewportmanager");
- toggle_theme();
+ toggle_theme(screen, force_redraw);
}
@@ -259,7 +256,7 @@ void viewportmanager_theme_changed(const int which)
/* This can probably be done better...
* disable the theme so it's forced to do a full redraw */
viewportmanager_theme_enable(i, false, NULL);
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, true);
}
}
send_event(GUI_EVENT_THEME_CHANGED, NULL);
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 6cb8d1f574..fffd2fedf2 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -53,8 +53,10 @@ void viewport_set_fullscreen(struct viewport *vp,
#ifdef HAVE_LCD_BITMAP
void viewportmanager_theme_enable(enum screen_type screen, bool enable,
struct viewport *viewport);
-
-void viewportmanager_theme_undo(enum screen_type screen);
+/* Force will cause a redraw even if the theme was previously and
+ * currently enabled (i,e the undo doing nothing).
+ * Should almost always be set to false except coming out of fully skinned screens */
+void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw);
/* call this when a theme changed */
void viewportmanager_theme_changed(const int);
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index e500f1c2d9..f6bcd78457 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -565,7 +565,16 @@ static void gwps_leave_wps(void)
{
gui_wps[i].display->stop_scroll();
gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
- viewportmanager_theme_undo(i);
+
+ bool draw = false;
+#ifdef HAVE_LCD_BITMAP
+ if (gui_wps[i].data->wps_sb_tag)
+ draw = gui_wps[i].data->show_sb_on_wps;
+ else if (statusbar_position(i) != STATUSBAR_OFF)
+ draw = true;
+#endif
+ viewportmanager_theme_undo(i, draw);
+
}
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
diff --git a/apps/menu.c b/apps/menu.c
index 951238e177..88f0f3c529 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -687,7 +687,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
gui_synclist_get_sel_pos(&lists), menu);
}
FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
return ret;
}
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 1fc176213f..05ee3f3633 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -576,7 +576,7 @@ bool eq_menu_graphical(void)
screens[i].setfont(FONT_UI);
screens[i].clear_display();
screens[i].set_viewport(NULL);
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
}
return result;
}
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index 9c9a2b2c72..777ab7f815 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -51,7 +51,7 @@ static int clear_main_backdrop(void)
backdrop_show(BACKDROP_MAIN);
/* force a full redraw so the whole backdrop is cleared */
viewportmanager_theme_enable(SCREEN_MAIN, false, NULL);
- viewportmanager_theme_undo(SCREEN_MAIN);
+ viewportmanager_theme_undo(SCREEN_MAIN, false);
settings_save();
return 0;
}
@@ -165,7 +165,7 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
/* force a full redraw */
viewportmanager_theme_enable(screen, false, NULL);
- viewportmanager_theme_undo(screen);
+ viewportmanager_theme_undo(screen, false);
break;
}
return ACTION_REDRAW;
diff --git a/apps/plugin.c b/apps/plugin.c
index 7c7c7adf09..ca23134725 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -835,7 +835,7 @@ int plugin_load(const char* plugin, const void* parameter)
#endif
FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i);
+ viewportmanager_theme_undo(i, false);
if (pfn_tsr_exit == NULL)
plugin_loaded = false;
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 4d59a85bb1..1ca0069735 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -1128,7 +1128,7 @@ int kbd_input(char* text, int buflen)
FOR_NB_SCREENS(l)
{
screens[l].setfont(FONT_UI);
- viewportmanager_theme_undo(l);
+ viewportmanager_theme_undo(l, false);
}
return ret;
}
diff --git a/apps/screens.c b/apps/screens.c
index bed7d9d902..d997590623 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -930,7 +930,7 @@ int calibrate(void)
sizeof(struct touchscreen_parameter));
touchscreen_set_mode(old_mode);
- viewportmanager_theme_undo(SCREEN_MAIN);
+ viewportmanager_theme_undo(SCREEN_MAIN, false);
settings_save();
return ret;