From 6b87bfadfff6c44722f8ffe5227c05c41b1b47c8 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 14 Dec 2022 03:06:04 -0500 Subject: [PATCH] wps.c cleanup gui_show_wps remove some old cruft move a few things around clean-up flow Change-Id: I138c6cd9e2d58ef526eb686333da413819df725d --- apps/bookmark.c | 4 +- apps/gui/option_select.c | 2 +- apps/gui/quickscreen.c | 4 +- apps/gui/usb_screen.c | 2 +- apps/gui/wps.c | 354 ++++++++++++++++++------------------ apps/menus/time_menu.c | 2 +- apps/misc.c | 37 +++- apps/misc.h | 9 +- apps/onplay.c | 8 +- apps/playlist_viewer.c | 17 +- apps/plugin.c | 16 +- apps/plugins/pitch_screen.c | 2 +- apps/radio/radio.c | 2 +- apps/recorder/recording.c | 2 +- apps/root_menu.c | 20 +- apps/screens.c | 2 +- apps/shortcuts.c | 4 +- 17 files changed, 249 insertions(+), 238 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index 64a4b9f761..68c10b36e7 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -1122,7 +1122,7 @@ int bookmark_load_menu(void) } } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return ret; } @@ -1143,7 +1143,7 @@ bool bookmark_mrb_load() ret = play_bookmark(bookmark); } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return ret; } diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 918335d6cd..ca16b5b05f 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -574,7 +574,7 @@ bool option_screen(const struct settings_list *setting, if (function == sound_get_fn(SOUND_VOLUME)) global_status.last_volume_change = current_tick; } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return false; } diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 1f32dca544..4eebe09fd3 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -410,9 +410,9 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter } if (ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU) /* Eliminate flashing of parent during */ - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* transition to Shortcuts */ + pop_current_activity_without_refresh(); /* transition to Shortcuts */ else - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return ret; } diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index 05e60067e0..31321ec005 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c @@ -315,5 +315,5 @@ void gui_usb_screen_run(bool early_usb) viewportmanager_theme_undo(i, false); } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); } diff --git a/apps/gui/wps.c b/apps/gui/wps.c index fe4bcf3213..8b74b0e02b 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -65,9 +65,6 @@ #include "skin_engine/wps_internals.h" #include "open_plugin.h" -#define RESTORE_WPS_INSTANTLY 0l -#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) - #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ #define MIN_FF_REWIND_STEP 500 @@ -148,14 +145,6 @@ void unpause_action(bool updatewps) update_non_static(); } -static bool update_onvol_change(enum screen_type screen) -{ - skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC); - - return false; -} - - #ifdef HAVE_TOUCHSCREEN static int skintouch_to_wps(void) { @@ -340,9 +329,9 @@ static bool ffwd_rew(int button, bool seek_from_end) return usb; } -#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) static void gwps_caption_backlight(struct wps_state *state) { +#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) if (state->id3) { #ifdef HAVE_BACKLIGHT @@ -379,9 +368,10 @@ static void gwps_caption_backlight(struct wps_state *state) } #endif } +#else + (void) state; +#endif /* def HAVE_BACKLIGHT || def HAVE_REMOTE_LCD */ } -#endif - static void change_dir(int direction) { @@ -498,7 +488,6 @@ static void play_hop(int direction) audio_ff_rewind(elapsed); } - #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) /* * If the user is unable to see the wps, because the display is deactivated, @@ -541,20 +530,30 @@ static void gwps_leave_wps(bool theme_enabled) #endif } +static void restore_theme(void) +{ + FOR_NB_SCREENS(i) + { + struct gui_wps *gwps = skin_get_gwps(WPS, i); + struct screen *display = gwps->display; + display->scroll_stop(); + viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); + } +} + /* * display the wps on entering or restoring */ static void gwps_enter_wps(bool theme_enabled) { struct gui_wps *gwps; struct screen *display; + if (theme_enabled) + restore_theme(); FOR_NB_SCREENS(i) { gwps = skin_get_gwps(WPS, i); display = gwps->display; display->scroll_stop(); - if (theme_enabled) - viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); - /* Update the values in the first (default) viewport - in case the user has modified the statusbar or colour settings */ #if LCD_DEPTH > 1 @@ -607,6 +606,57 @@ void wps_do_playpause(bool updatewps) } } +static long do_wps_exit(long action, bool bookmark) +{ + audio_pause(); + update_non_static(); + if (bookmark) + bookmark_autobookmark(true); + audio_stop(); +#ifdef AB_REPEAT_ENABLE + ab_reset_markers(); +#endif + gwps_leave_wps(true); +#ifdef HAVE_RECORDING + if (action == ACTION_WPS_REC) + return GO_TO_RECSCREEN; +#else + (void)action; +#endif + if (global_settings.browse_current) + return GO_TO_PREVIOUS_BROWSER; + return GO_TO_PREVIOUS; +} + +static long do_party_mode(long action) +{ + if (global_settings.party_mode) + { + switch (action) + { +#ifdef ACTION_WPSAB_SINGLE + case ACTION_WPSAB_SINGLE: + if (!ab_repeat_mode_enabled()) + break; + /* Note: currently all targets use ACTION_WPS_BROWSE + * if mapped to any of below actions this will cause problems */ +#endif + case ACTION_WPS_PLAY: + case ACTION_WPS_SEEKFWD: + case ACTION_WPS_SEEKBACK: + case ACTION_WPS_SKIPPREV: + case ACTION_WPS_SKIPNEXT: + case ACTION_WPS_ABSETB_NEXTDIR: + case ACTION_WPS_ABSETA_PREVDIR: + case ACTION_WPS_STOP: + return ACTION_NONE; + break; + default: + break; + } + } + return action; +} /* The WPS can be left in two ways: * a) call a function, which draws over the wps. In this case, the wps @@ -621,11 +671,10 @@ long gui_wps_show(void) { long button = 0; bool restore = true; - long restoretimer = RESTORE_WPS_INSTANTLY; /* timer to delay screen redraw temporarily */ bool exit = false; bool bookmark = false; bool update = false; - bool vol_changed = false; + bool theme_enabled = true; long last_left = 0, last_right = 0; struct wps_state *state = get_wps_state(); @@ -634,12 +683,10 @@ long gui_wps_show(void) ab_reset_markers(); #endif wps_state_init(); - while ( 1 ) { - bool theme_enabled = true; + bool hotkey = false; bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; - /* did someone else (i.e power thread) change audio pause mode? */ if (state->paused != audio_paused) { state->paused = audio_paused; @@ -653,8 +700,53 @@ long gui_wps_show(void) #endif } } - button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK, - restore ? 1 : HZ/5); + + if (restore) + { + restore = false; +#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) + add_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook); +#endif + /* we remove the update delay since it's not very usable in the wps, + * e.g. during volume changing or ffwd/rewind */ + sb_skin_set_update_delay(0); + skin_request_full_update(WPS); + update = true; + gwps_enter_wps(theme_enabled); + theme_enabled = true; + } + else + { + gwps_caption_backlight(state); + + FOR_NB_SCREENS(i) + { +#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) + /* currently, all remotes are readable without backlight + * so still update those */ + if (lcd_active() || (i != SCREEN_MAIN)) +#endif + { + bool full_update = skin_do_full_update(WPS, i); + if (update || full_update) + { + skin_update(WPS, i, full_update ? + SKIN_REFRESH_ALL : SKIN_REFRESH_NON_STATIC); + } + } + } + update = false; + } + + if (exit) + { + return do_wps_exit(button, bookmark); + } + + if (button && !IS_SYSEVENT(button) ) + storage_spin(); + + button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK, HZ/5); /* Exit if audio has stopped playing. This happens e.g. at end of playlist or if using the sleep timer. */ @@ -664,44 +756,39 @@ long gui_wps_show(void) if (button == ACTION_TOUCHSCREEN) button = skintouch_to_wps(); #endif + button = do_party_mode(button); /* block select actions in party mode */ + /* The iPods/X5/M5 use a single button for the A-B mode markers, defined as ACTION_WPSAB_SINGLE in their config files. */ #ifdef ACTION_WPSAB_SINGLE - if (!global_settings.party_mode && ab_repeat_mode_enabled()) + static int wps_ab_state = 0; + if (button == ACTION_WPSAB_SINGLE && ab_repeat_mode_enabled()) { - static int wps_ab_state = 0; - if (button == ACTION_WPSAB_SINGLE) + switch (wps_ab_state) { - switch (wps_ab_state) - { - case 0: /* set the A spot */ - button = ACTION_WPS_ABSETA_PREVDIR; - break; - case 1: /* set the B spot */ - button = ACTION_WPS_ABSETB_NEXTDIR; - break; - case 2: - button = ACTION_WPS_ABRESET; - break; - } - wps_ab_state = (wps_ab_state+1) % 3; + case 0: /* set the A spot */ + button = ACTION_WPS_ABSETA_PREVDIR; + break; + case 1: /* set the B spot */ + button = ACTION_WPS_ABSETB_NEXTDIR; + break; + case 2: + button = ACTION_WPS_ABRESET; + break; } + wps_ab_state = (wps_ab_state+1) % 3; } -#endif +#endif /* def ACTION_WPSAB_SINGLE */ + switch(button) { #ifdef HAVE_HOTKEY case ACTION_WPS_HOTKEY: + { + hotkey = true; if (!global_settings.hotkey_wps) break; - /* fall through */ -#endif - case ACTION_WPS_CONTEXT: - { - bool hotkey = button == ACTION_WPS_HOTKEY; - -#ifdef HAVE_HOTKEY - if (hotkey && global_settings.hotkey_wps == HOTKEY_PLUGIN) + if (global_settings.hotkey_wps == HOTKEY_PLUGIN) { /* leave WPS without re-enabling theme */ theme_enabled = false; @@ -711,39 +798,31 @@ long gui_wps_show(void) if (!audio_status()) { /* re-enable theme since we're returning to SBS */ - FOR_NB_SCREENS(i) - { - struct gui_wps *gwps = skin_get_gwps(WPS, i); -#ifdef HAVE_BACKDROP_IMAGE - skin_backdrop_show(sb_get_backdrop(i)); -#endif - viewportmanager_theme_undo(i, skin_has_sbs(gwps)); - } + gwps_leave_wps(true); return GO_TO_ROOT; } + restore = true; + break; } - else -#endif + } + /* fall through */ +#endif /* def HAVE_HOTKEY */ + case ACTION_WPS_CONTEXT: + { + gwps_leave_wps(true); + int retval = onplay(state->id3->path, + FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); + /* if music is stopped in the context menu we want to exit the wps */ + if (retval == ONPLAY_MAINMENU + || !audio_status()) + return GO_TO_ROOT; + else if (retval == ONPLAY_PLAYLIST) + return GO_TO_PLAYLIST_VIEWER; + else if (retval == ONPLAY_PLUGIN) { - gwps_leave_wps(true); - int retval = onplay(state->id3->path, - FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); - /* if music is stopped in the context menu we want to exit the wps */ - if (retval == ONPLAY_MAINMENU - || !audio_status()) - return GO_TO_ROOT; - else if (retval == ONPLAY_PLAYLIST) - return GO_TO_PLAYLIST_VIEWER; - else if (retval == ONPLAY_PLUGIN) - { - FOR_NB_SCREENS(i) - { - struct gui_wps *gwps = skin_get_gwps(WPS, i); - viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); - } - theme_enabled = false; - open_plugin_run(ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN)); - } + restore_theme(); + theme_enabled = false; + open_plugin_run(ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN)); } restore = true; @@ -757,24 +836,26 @@ long gui_wps_show(void) /* play/pause */ case ACTION_WPS_PLAY: - if (global_settings.party_mode) - break; wps_do_playpause(true); break; - case ACTION_WPS_VOLUP: - global_settings.volume += sound_steps(SOUND_VOLUME); - vol_changed = true; - break; + case ACTION_WPS_VOLUP: /* fall through */ case ACTION_WPS_VOLDOWN: - global_settings.volume -= sound_steps(SOUND_VOLUME); - vol_changed = true; + if (button == ACTION_WPS_VOLUP) + global_settings.volume += sound_steps(SOUND_VOLUME); + else + global_settings.volume -= sound_steps(SOUND_VOLUME); + + setvol(); + FOR_NB_SCREENS(i) + { + skin_update(WPS, i, SKIN_REFRESH_NON_STATIC); + } + update = false; break; /* fast forward OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ case ACTION_WPS_SEEKFWD: - if (global_settings.party_mode) - break; if (current_tick -last_right < HZ) { if (state->id3->cuesheet) @@ -793,9 +874,7 @@ long gui_wps_show(void) /* fast rewind OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/ case ACTION_WPS_SEEKBACK: - if (global_settings.party_mode) - break; - if (current_tick -last_left < HZ) + if (current_tick - last_left < HZ) { if (state->id3->cuesheet) { @@ -824,8 +903,6 @@ long gui_wps_show(void) /* prev / restart */ case ACTION_WPS_SKIPPREV: - if (global_settings.party_mode) - break; last_left = current_tick; #ifdef AB_REPEAT_ENABLE /* if we're in A/B repeat mode and the current position @@ -844,8 +921,6 @@ long gui_wps_show(void) /* next OR if skip length set, hop by predetermined amount. */ case ACTION_WPS_SKIPNEXT: - if (global_settings.party_mode) - break; last_right = current_tick; #ifdef AB_REPEAT_ENABLE /* if we're in A/B repeat mode and the current position is @@ -866,8 +941,6 @@ long gui_wps_show(void) /* next / prev directories */ /* and set A-B markers if in a-b mode */ case ACTION_WPS_ABSETB_NEXTDIR: - if (global_settings.party_mode) - break; #if defined(AB_REPEAT_ENABLE) if (ab_repeat_mode_enabled()) { @@ -881,8 +954,6 @@ long gui_wps_show(void) } break; case ACTION_WPS_ABSETA_PREVDIR: - if (global_settings.party_mode) - break; #if defined(AB_REPEAT_ENABLE) if (ab_repeat_mode_enabled()) ab_set_A_marker(state->id3->elapsed); @@ -915,7 +986,7 @@ long gui_wps_show(void) restore = true; } - if (enter_shortcuts_menu) + if (enter_shortcuts_menu) /* enter_shortcuts_menu */ { global_status.last_screen = GO_TO_SHORTCUTMENU; int ret = do_shortcut_menu(NULL); @@ -952,8 +1023,6 @@ long gui_wps_show(void) /* stop and exit wps */ case ACTION_WPS_STOP: - if (global_settings.party_mode) - break; bookmark = true; exit = true; break; @@ -1013,85 +1082,6 @@ long gui_wps_show(void) update = true; break; } - - if (vol_changed) - { - bool res = false; - vol_changed = false; - setvol(); - FOR_NB_SCREENS(i) - { - if(update_onvol_change(i)) - res = true; - } - if (res) { - restore = true; - restoretimer = RESTORE_WPS_NEXT_SECOND; - } - } - - - if (restore && - ((restoretimer == RESTORE_WPS_INSTANTLY) || - TIME_AFTER(current_tick, restoretimer))) - { - restore = false; - restoretimer = RESTORE_WPS_INSTANTLY; -#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) - add_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook); -#endif - /* we remove the update delay since it's not very usable in the wps, - * e.g. during volume changing or ffwd/rewind */ - sb_skin_set_update_delay(0); - skin_request_full_update(WPS); - update = true; - gwps_enter_wps(theme_enabled); - } - else - { -#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) - gwps_caption_backlight(state); -#endif - FOR_NB_SCREENS(i) - { -#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) - /* currently, all remotes are readable without backlight - * so still update those */ - if (lcd_active() || (i != SCREEN_MAIN)) -#endif - { - bool full_update = skin_do_full_update(WPS, i); - if (update || full_update) - { - skin_update(WPS, i, full_update ? - SKIN_REFRESH_ALL : SKIN_REFRESH_NON_STATIC); - } - } - } - update = false; - } - - if (exit) { - audio_pause(); - update_non_static(); - if (bookmark) - bookmark_autobookmark(true); - audio_stop(); -#ifdef AB_REPEAT_ENABLE - ab_reset_markers(); -#endif - gwps_leave_wps(true); -#ifdef HAVE_RECORDING - if (button == ACTION_WPS_REC) - return GO_TO_RECSCREEN; -#endif - if (global_settings.browse_current) - return GO_TO_PREVIOUS_BROWSER; - return GO_TO_PREVIOUS; - } - - if (button && !IS_SYSEVENT(button) ) - storage_spin(); } return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */ } diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index b44d47ff8b..e37e2b5637 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c @@ -304,7 +304,7 @@ int time_screen(void* ignored) #endif ret = do_menu(&time_menu, NULL, menu, false); - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); /* see comments above in the button callback */ if (!menu_was_pressed && ret == GO_TO_PREVIOUS) return 0; diff --git a/apps/misc.c b/apps/misc.c index aa79ec632d..71ab913139 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -1569,25 +1569,43 @@ int clamp_value_wrap(int value, int max, int min) static enum current_activity current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN}; static int current_activity_top = 0; -void push_current_activity(enum current_activity screen) + +static void push_current_activity_refresh(enum current_activity screen, bool refresh) { current_activity[current_activity_top++] = screen; FOR_NB_SCREENS(i) { skinlist_set_cfg(i, NULL); - skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); + if (refresh) + skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); } } +static void pop_current_activity_refresh(bool refresh) +{ + current_activity_top--; + FOR_NB_SCREENS(i) + { + skinlist_set_cfg(i, NULL); + if (refresh) + skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); + } +} + +void push_current_activity(enum current_activity screen) +{ + push_current_activity_refresh(screen, true); +} + void push_activity_without_refresh(enum current_activity screen) { - current_activity[current_activity_top++] = screen; - FOR_NB_SCREENS(i) - skinlist_set_cfg(i, NULL); + push_current_activity_refresh(screen, false); } -void pop_current_activity(enum activity_refresh refresh) +void pop_current_activity(void) { + pop_current_activity_refresh(true); +#if 0 current_activity_top--; FOR_NB_SCREENS(i) { @@ -1595,7 +1613,14 @@ void pop_current_activity(enum activity_refresh refresh) if (ACTIVITY_REFRESH_NOW == refresh) skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); } +#endif } + +void pop_current_activity_without_refresh(void) +{ + pop_current_activity_refresh(false); +} + enum current_activity get_current_activity(void) { return current_activity[current_activity_top?current_activity_top-1:0]; diff --git a/apps/misc.h b/apps/misc.h index e59399d55b..463e772aa5 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -214,15 +214,10 @@ struct mp3entry; int id3_get_replaygain_mode(const struct mp3entry *id3); void replaygain_update(void); -enum activity_refresh -{ - ACTIVITY_REFRESH_DEFERRED = 0, - ACTIVITY_REFRESH_NOW, -}; - void push_current_activity(enum current_activity screen); void push_activity_without_refresh(enum current_activity screen); -void pop_current_activity(enum activity_refresh refresh); +void pop_current_activity(void); +void pop_current_activity_without_refresh(void); enum current_activity get_current_activity(void); /* format a sound value like: -1.05 dB */ diff --git a/apps/onplay.c b/apps/onplay.c index 7ea6b9035b..0fae795fb3 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -148,7 +148,7 @@ static bool clipboard_clip(struct clipboard *clip, const char *path, static int bookmark_load_menu_wrapper(void) { if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + pop_current_activity_without_refresh(); /* when called from ctxt menu */ return bookmark_load_menu(); } @@ -474,7 +474,7 @@ static bool save_playlist(void) static int wps_view_cur_playlist(void) { if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + pop_current_activity_without_refresh(); /* when called from ctxt menu */ playlist_viewer_ex(NULL, NULL); @@ -1520,7 +1520,7 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), static int browse_id3_wrapper(void) { if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + pop_current_activity_without_refresh(); /* when called from ctxt menu */ if (browse_id3(audio_current_track(), playlist_get_display_index(), @@ -1979,7 +1979,7 @@ int onplay(char* file, int attr, int from, bool hotkey) menu_selection = do_menu(menu, NULL, NULL, false); if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ - pop_current_activity(ACTIVITY_REFRESH_NOW); /* popped already by menu item */ + pop_current_activity(); /* popped already by menu item */ switch (menu_selection) { diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 4c57d1a5ce..80239367e4 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -143,7 +143,7 @@ static void format_line(const struct playlist_entry* track, char* str, static bool update_playlist(bool force); static enum pv_onplay_result onplay_menu(int index); -static void close_playlist_viewer(bool pop_activity); +static void close_playlist_viewer(void); static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer, int names_buffer_size) @@ -525,12 +525,12 @@ static enum pv_onplay_result show_track_info(const struct playlist_entry *curren static enum pv_onplay_result open_with(const struct playlist_entry *current_track) { char selected_track[MAX_PATH]; - close_playlist_viewer(false); /* don't pop activity yet – relevant for plugin_load */ + close_playlist_viewer(); /* don't pop activity yet – relevant for plugin_load */ strmemccpy(selected_track, current_track->name, sizeof(selected_track)); int plugin_return = filetype_list_viewers(selected_track); - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); switch (plugin_return) { @@ -548,11 +548,11 @@ static enum pv_onplay_result open_with(const struct playlist_entry *current_trac static enum pv_onplay_result open_pictureflow(const struct playlist_entry *current_track) { char selected_track[MAX_PATH]; - close_playlist_viewer(false); /* don't pop activity yet – relevant for plugin_load */ + close_playlist_viewer(); /* don't pop activity yet – relevant for plugin_load */ strmemccpy(selected_track, current_track->name, sizeof(selected_track)); int plugin_return = filetype_load_plugin((void *)"pictureflow", selected_track); - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); switch (plugin_return) { @@ -1093,15 +1093,14 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename, } exit: - close_playlist_viewer(true); + pop_current_activity_without_refresh(); + close_playlist_viewer(); return ret; } -static void close_playlist_viewer(bool pop_activity) +static void close_playlist_viewer(void) { talk_shutup(); - if (pop_activity) - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); if (viewer.playlist) { if (viewer.initial_selection) diff --git a/apps/plugin.c b/apps/plugin.c index 21dbe47c54..45829a42ad 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -925,14 +925,16 @@ int plugin_load(const char* plugin, const void* parameter) tree_unlock_cache(tree_get_context()); - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); - int curr_activity = get_current_activity(); - if ((curr_activity != ACTIVITY_PLAYLISTVIEWER) && - (curr_activity != ACTIVITY_WPS) && - (rc != PLUGIN_GOTO_WPS)) + pop_current_activity_without_refresh(); + if (rc != PLUGIN_GOTO_WPS) { - FOR_NB_SCREENS(i) - skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); + int curr_activity = get_current_activity(); + if ((curr_activity != ACTIVITY_PLAYLISTVIEWER) && + (curr_activity != ACTIVITY_WPS)) + { + FOR_NB_SCREENS(i) + skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); + } } if (!pfn_tsr_exit) diff --git a/apps/plugins/pitch_screen.c b/apps/plugins/pitch_screen.c index 76e7fa9775..e24e0240a2 100644 --- a/apps/plugins/pitch_screen.c +++ b/apps/plugins/pitch_screen.c @@ -1109,7 +1109,7 @@ int gui_syncpitchscreen_run(void) } //rb->pcmbuf_set_low_latency(false); - //pop_current_activity(ACTIVITY_REFRESH_NOW); + //pop_current_activity(); /* Clean up */ FOR_NB_SCREENS(i) diff --git a/apps/radio/radio.c b/apps/radio/radio.c index a02d4429fa..bf8ad865dd 100644 --- a/apps/radio/radio.c +++ b/apps/radio/radio.c @@ -729,7 +729,7 @@ void radio_screen(void) cpu_idle_mode(false); #endif fms_fix_displays(FMS_EXIT); - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); in_screen = false; } /* radio_screen */ diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 374583cc21..6c52adf5d3 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -1844,7 +1844,7 @@ rec_abort: #endif settings_save(); - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0; } /* recording_screen */ diff --git a/apps/root_menu.c b/apps/root_menu.c index 6008c87eda..89afae8c25 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -280,9 +280,9 @@ static int browser(void* param) if (ret_val == GO_TO_WPS || ret_val == GO_TO_PREVIOUS_MUSIC || ret_val == GO_TO_PLUGIN) - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); else - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); switch ((intptr_t)param) { @@ -355,10 +355,10 @@ static int wpsscrn(void* param) || last_screen == GO_TO_SYSTEM_SCREEN || last_screen == GO_TO_PLAYLISTS_SCREEN))) { - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); } else - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return ret_val; } @@ -396,10 +396,10 @@ static int playlist_view_catalog(void * param) if (item_was_selected) { - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); return GO_TO_WPS; } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return GO_TO_ROOT; } @@ -714,10 +714,10 @@ static inline int load_screen(int screen) || ret_val == GO_TO_PREVIOUS_BROWSER || ret_val == GO_TO_FILEBROWSER) { - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); } else - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); } last_screen = screen; @@ -744,7 +744,7 @@ static int load_context_screen(int selection) if (context_menu) retval = do_menu(context_menu, NULL, NULL, false); - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return retval; } @@ -992,7 +992,7 @@ void root_menu(void) push_activity_without_refresh(ACTIVITY_UNKNOWN); /* prevent plugin_load */ next_screen = load_plugin_screen(key); /* from flashing root */ - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* menu activity */ + pop_current_activity_without_refresh(); /* menu activity */ if (next_screen == GO_TO_PREVIOUS) { diff --git a/apps/screens.c b/apps/screens.c index 2ffdf68023..db24e534c1 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -733,7 +733,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a } } - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); return ret; } diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 98edcf653e..cf372ce023 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -719,9 +719,9 @@ int do_shortcut_menu(void *ignored) } } if (GO_TO_PLUGIN == done) - pop_current_activity(ACTIVITY_REFRESH_DEFERRED); + pop_current_activity_without_refresh(); else - pop_current_activity(ACTIVITY_REFRESH_NOW); + pop_current_activity(); --buflib_move_lock; return done;