diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2009-11-16 01:38:30 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2009-11-16 01:38:30 +0000 |
| commit | bdf2961ba3c0d6ac1b58d6e4acd748415d4cfdd6 (patch) | |
| tree | 2311c321ca36b82e9bfc521442871998979e49b0 /apps/gui/viewport.c | |
| parent | d5af5c061c92dc4e662d6fa423643796d29158ee (diff) | |
| download | rockbox-bdf2961ba3c0d6ac1b58d6e4acd748415d4cfdd6.zip rockbox-bdf2961ba3c0d6ac1b58d6e4acd748415d4cfdd6.tar.gz rockbox-bdf2961ba3c0d6ac1b58d6e4acd748415d4cfdd6.tar.bz2 rockbox-bdf2961ba3c0d6ac1b58d6e4acd748415d4cfdd6.tar.xz | |
Fix some drawing problems when displaying the WPS initially with sbs enabled. Move initial display of the wps to wps.c too. Should fix bug 3 of FS#10771.
Also change GUI_EVENT_REFRESH event handling so that the passed drawing function is always called, not only when sbs or custom ui vp are used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23644 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
| -rw-r--r-- | apps/gui/viewport.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 0a2630c..9a7cfbd 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -70,6 +70,7 @@ static struct viewport custom_vp[NB_SCREENS]; /* callbacks for GUI_EVENT_* events */ static void viewportmanager_ui_vp_changed(void *param); +static void viewportmanager_call_draw_func(void *param); static void statusbar_toggled(void* param); static unsigned viewport_init_ui_vp(void); #endif @@ -215,29 +216,47 @@ void viewportmanager_theme_changed(const int which) event_add |= (statusbar_position(i) == STATUSBAR_CUSTOM); } + /* add one of those to ensure the draw function is called always */ if (event_add) + { add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed); + remove_event(GUI_EVENT_REFRESH, viewportmanager_call_draw_func); + } else + { + add_event(GUI_EVENT_REFRESH, false, viewportmanager_call_draw_func); remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed); + } send_event(GUI_EVENT_THEME_CHANGED, NULL); } +/* + * simply calls a function that draws stuff, this exists to ensure the + * drawing function call in the GUI_EVENT_REFRESH event + * + * param should be 'void func(void)' */ +static void viewportmanager_call_draw_func(void *param) +{ + /* cast param to a function */ + void (*draw_func)(void) = ((void(*)(void))param); + /* call the passed function which will redraw the content of + * the current screen */ + if (draw_func != NULL) + draw_func(); +} + static void viewportmanager_ui_vp_changed(void *param) { /* if the user changed the theme, we need to initiate a full redraw */ int i; - /* cast param to a function */ - void (*draw_func)(void) = ((void(*)(void))param); /* start with clearing the screen */ FOR_NB_SCREENS(i) screens[i].clear_display(); /* redraw the statusbar if it was enabled */ send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); - /* call the passed function which will redraw the content of - * the current screen */ - if (draw_func != NULL) - draw_func(); + /* call redraw function */ + viewportmanager_call_draw_func(param); FOR_NB_SCREENS(i) screens[i].update(); } |