summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/list.c13
-rw-r--r--apps/gui/statusbar-skinned.c3
-rw-r--r--apps/gui/statusbar-skinned.h2
-rw-r--r--apps/gui/viewport.c17
-rw-r--r--apps/gui/wps.c52
5 files changed, 40 insertions, 47 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index c393340c57..8663abe8a0 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -66,16 +66,17 @@ static bool list_is_dirty(struct gui_synclist *list)
66 return TIME_BEFORE(list->dirty_tick, last_dirty_tick); 66 return TIME_BEFORE(list->dirty_tick, last_dirty_tick);
67} 67}
68 68
69static void list_force_reinit(void *param) 69static void list_force_reinit(unsigned short id, void *param, void *last_dirty_tick)
70{ 70{
71 (void)id;
71 (void)param; 72 (void)param;
72 last_dirty_tick = current_tick; 73 *(int *)last_dirty_tick = current_tick;
73} 74}
74 75
75void list_init(void) 76void list_init(void)
76{ 77{
77 last_dirty_tick = current_tick; 78 last_dirty_tick = current_tick;
78 add_event(GUI_EVENT_THEME_CHANGED, false, list_force_reinit); 79 add_event_ex(GUI_EVENT_THEME_CHANGED, false, list_force_reinit, &last_dirty_tick);
79} 80}
80 81
81static void list_init_viewports(struct gui_synclist *list) 82static void list_init_viewports(struct gui_synclist *list)
@@ -611,8 +612,9 @@ bool gui_synclist_keyclick_callback(int action, void* data)
611 */ 612 */
612static struct gui_synclist *current_lists; 613static struct gui_synclist *current_lists;
613static bool ui_update_event_registered = false; 614static bool ui_update_event_registered = false;
614static void _lists_uiviewport_update_callback(void *data) 615static void _lists_uiviewport_update_callback(unsigned short id, void *data)
615{ 616{
617 (void)id;
616 (void)data; 618 (void)data;
617 if (current_lists) 619 if (current_lists)
618 gui_synclist_draw(current_lists); 620 gui_synclist_draw(current_lists);
@@ -801,8 +803,7 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout)
801 { 803 {
802 if (!ui_update_event_registered) 804 if (!ui_update_event_registered)
803 ui_update_event_registered = 805 ui_update_event_registered =
804 add_event(GUI_EVENT_NEED_UI_UPDATE, false, 806 add_event(GUI_EVENT_NEED_UI_UPDATE, _lists_uiviewport_update_callback);
805 _lists_uiviewport_update_callback);
806 current_lists = lists; 807 current_lists = lists;
807 } 808 }
808 if(lists->scheduled_talk_tick) 809 if(lists->scheduled_talk_tick)
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index c991d8ea40..c4cc37d539 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -178,8 +178,9 @@ void sb_skin_update(enum screen_type screen, bool force)
178 } 178 }
179} 179}
180 180
181void do_sbs_update_callback(void *param) 181void do_sbs_update_callback(unsigned short id, void *param)
182{ 182{
183 (void)id;
183 (void)param; 184 (void)param;
184 /* the WPS handles changing the actual id3 data in the id3 pointers 185 /* the WPS handles changing the actual id3 data in the id3 pointers
185 * we imported, we just want a full update */ 186 * we imported, we just want a full update */
diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h
index ac12dfa1aa..237ec45c82 100644
--- a/apps/gui/statusbar-skinned.h
+++ b/apps/gui/statusbar-skinned.h
@@ -66,5 +66,5 @@ int sb_postproccess(enum screen_type screen, struct wps_data *data);
66#define sb_preproccess NULL 66#define sb_preproccess NULL
67#define sb_postproccess NULL 67#define sb_postproccess NULL
68#endif 68#endif
69void do_sbs_update_callback(void *param); 69void do_sbs_update_callback(unsigned short id, void *param);
70#endif /* __STATUSBAR_SKINNED_H__ */ 70#endif /* __STATUSBAR_SKINNED_H__ */
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index aeb884a95d..194954c1d2 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -69,7 +69,7 @@ struct viewport_stack_item
69}; 69};
70 70
71#ifdef HAVE_LCD_BITMAP 71#ifdef HAVE_LCD_BITMAP
72static void viewportmanager_redraw(void* data); 72static void viewportmanager_redraw(unsigned short id, void* data);
73 73
74static int theme_stack_top[NB_SCREENS]; /* the last item added */ 74static int theme_stack_top[NB_SCREENS]; /* the last item added */
75static struct viewport_stack_item theme_stack[NB_SCREENS][VPSTACK_DEPTH]; 75static struct viewport_stack_item theme_stack[NB_SCREENS][VPSTACK_DEPTH];
@@ -80,14 +80,12 @@ static void toggle_events(bool enable)
80{ 80{
81 if (enable) 81 if (enable)
82 { 82 {
83 add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); 83 add_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
84#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 84#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
85 add_event(LCD_EVENT_ACTIVATION, false, do_sbs_update_callback); 85 add_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback);
86#endif 86#endif
87 add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, 87 add_event(PLAYBACK_EVENT_TRACK_CHANGE, do_sbs_update_callback);
88 do_sbs_update_callback); 88 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_sbs_update_callback);
89 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false,
90 do_sbs_update_callback);
91 } 89 }
92 else 90 else
93 { 91 {
@@ -232,8 +230,9 @@ int viewport_get_nb_lines(const struct viewport *vp)
232#endif 230#endif
233} 231}
234 232
235static void viewportmanager_redraw(void* data) 233static void viewportmanager_redraw(unsigned short id, void* data)
236{ 234{
235 (void)id;
237 FOR_NB_SCREENS(i) 236 FOR_NB_SCREENS(i)
238 { 237 {
239#ifdef HAVE_LCD_BITMAP 238#ifdef HAVE_LCD_BITMAP
@@ -256,7 +255,7 @@ void viewportmanager_init()
256 viewportmanager_theme_enable(i, true, NULL); 255 viewportmanager_theme_enable(i, true, NULL);
257 } 256 }
258#else 257#else
259 add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); 258 add_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
260#endif 259#endif
261} 260}
262 261
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index b4c3f40e9f..d1161ea71d 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -74,8 +74,7 @@
74 74
75/* initial setup of wps_data */ 75/* initial setup of wps_data */
76static void wps_state_init(void); 76static void wps_state_init(void);
77static void track_changed_callback(void *param); 77static void track_info_callback(unsigned short id, void *param);
78static void nextid3available_callback(void* param);
79 78
80#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 79#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
81#ifdef HAVE_REMOTE_LCD 80#ifdef HAVE_REMOTE_LCD
@@ -626,8 +625,9 @@ static void play_hop(int direction)
626 * we suppress updates until the wps is activated again (the lcd driver will 625 * we suppress updates until the wps is activated again (the lcd driver will
627 * call this hook to issue an instant update) 626 * call this hook to issue an instant update)
628 * */ 627 * */
629static void wps_lcd_activation_hook(void *param) 628static void wps_lcd_activation_hook(unsigned short id, void *param)
630{ 629{
630 (void)id;
631 (void)param; 631 (void)param;
632 skin_request_full_update(WPS); 632 skin_request_full_update(WPS);
633 /* force timeout in wps main loop, so that the update is instantly */ 633 /* force timeout in wps main loop, so that the update is instantly */
@@ -1119,7 +1119,7 @@ long gui_wps_show(void)
1119 restore = false; 1119 restore = false;
1120 restoretimer = RESTORE_WPS_INSTANTLY; 1120 restoretimer = RESTORE_WPS_INSTANTLY;
1121#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1121#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
1122 add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook); 1122 add_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
1123#endif 1123#endif
1124 /* we remove the update delay since it's not very usable in the wps, 1124 /* we remove the update delay since it's not very usable in the wps,
1125 * e.g. during volume changing or ffwd/rewind */ 1125 * e.g. during volume changing or ffwd/rewind */
@@ -1187,35 +1187,27 @@ long gui_wps_show(void)
1187} 1187}
1188 1188
1189/* this is called from the playback thread so NO DRAWING! */ 1189/* this is called from the playback thread so NO DRAWING! */
1190static void track_changed_callback(void *param) 1190static void track_info_callback(unsigned short id, void *param)
1191{ 1191{
1192 struct wps_state *state = skin_get_global_state(); 1192 struct wps_state *state = skin_get_global_state();
1193 state->id3 = ((struct track_event *)param)->id3; 1193
1194 state->nid3 = audio_next_track(); 1194 if (id == PLAYBACK_EVENT_TRACK_CHANGE || id == PLAYBACK_EVENT_CUR_TRACK_READY)
1195 if (state->id3->cuesheet)
1196 { 1195 {
1197 cue_find_current_track(state->id3->cuesheet, state->id3->elapsed); 1196 state->id3 = ((struct track_event *)param)->id3;
1197 if (state->id3->cuesheet)
1198 {
1199 cue_find_current_track(state->id3->cuesheet, state->id3->elapsed);
1200 }
1198 } 1201 }
1199 skin_request_full_update(WPS);
1200}
1201static void nextid3available_callback(void* param)
1202{
1203 (void)param;
1204 skin_get_global_state()->nid3 = audio_next_track();
1205 skin_request_full_update(WPS);
1206}
1207
1208#ifdef AUDIO_FAST_SKIP_PREVIEW 1202#ifdef AUDIO_FAST_SKIP_PREVIEW
1209/* this is called on the audio_skip caller thread */ 1203 else if (id == PLAYBACK_EVENT_TRACK_SKIP)
1210static void track_skip_callback(void *param) 1204 {
1211{ 1205 state->id3 = audio_current_track();
1212 struct wps_state *state = skin_get_global_state(); 1206 }
1213 state->id3 = audio_current_track(); 1207#endif
1214 state->nid3 = audio_next_track(); 1208 skin_get_global_state()->nid3 = audio_next_track();
1215 skin_request_full_update(WPS); 1209 skin_request_full_update(WPS);
1216 (void)param;
1217} 1210}
1218#endif /* AUDIO_FAST_SKIP_PREVIEW */
1219 1211
1220static void wps_state_init(void) 1212static void wps_state_init(void)
1221{ 1213{
@@ -1235,15 +1227,15 @@ static void wps_state_init(void)
1235 /* We'll be updating due to restore initialized with true */ 1227 /* We'll be updating due to restore initialized with true */
1236 skin_request_full_update(WPS); 1228 skin_request_full_update(WPS);
1237 /* add the WPS track event callbacks */ 1229 /* add the WPS track event callbacks */
1238 add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback); 1230 add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback);
1239 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false, nextid3available_callback); 1231 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback);
1240#if CONFIG_CODEC == SWCODEC 1232#if CONFIG_CODEC == SWCODEC
1241 /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have 1233 /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have
1242 finished */ 1234 finished */
1243 add_event(PLAYBACK_EVENT_CUR_TRACK_READY, false, track_changed_callback); 1235 add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback);
1244#endif 1236#endif
1245#ifdef AUDIO_FAST_SKIP_PREVIEW 1237#ifdef AUDIO_FAST_SKIP_PREVIEW
1246 add_event(PLAYBACK_EVENT_TRACK_SKIP, false, track_skip_callback); 1238 add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback);
1247#endif 1239#endif
1248} 1240}
1249 1241