summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps.c96
-rw-r--r--apps/misc.c7
-rw-r--r--apps/misc.h1
-rw-r--r--apps/playlist_viewer.c16
-rw-r--r--apps/plugin.c17
-rw-r--r--apps/root_menu.c12
6 files changed, 109 insertions, 40 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 430746cc8d..fe4bcf3213 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -63,6 +63,7 @@
63#include "wps.h" 63#include "wps.h"
64#include "statusbar-skinned.h" 64#include "statusbar-skinned.h"
65#include "skin_engine/wps_internals.h" 65#include "skin_engine/wps_internals.h"
66#include "open_plugin.h"
66 67
67#define RESTORE_WPS_INSTANTLY 0l 68#define RESTORE_WPS_INSTANTLY 0l
68#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) 69#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
@@ -514,16 +515,19 @@ static void wps_lcd_activation_hook(unsigned short id, void *param)
514} 515}
515#endif 516#endif
516 517
517static void gwps_leave_wps(void) 518static void gwps_leave_wps(bool theme_enabled)
518{ 519{
519 FOR_NB_SCREENS(i) 520 FOR_NB_SCREENS(i)
520 { 521 {
521 struct gui_wps *gwps = skin_get_gwps(WPS, i); 522 struct gui_wps *gwps = skin_get_gwps(WPS, i);
522 gwps->display->scroll_stop(); 523 gwps->display->scroll_stop();
524 if (theme_enabled)
525 {
523#ifdef HAVE_BACKDROP_IMAGE 526#ifdef HAVE_BACKDROP_IMAGE
524 skin_backdrop_show(sb_get_backdrop(i)); 527 skin_backdrop_show(sb_get_backdrop(i));
525#endif 528#endif
526 viewportmanager_theme_undo(i, skin_has_sbs(gwps)); 529 viewportmanager_theme_undo(i, skin_has_sbs(gwps));
530 }
527 } 531 }
528 532
529#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 533#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
@@ -539,7 +543,7 @@ static void gwps_leave_wps(void)
539 543
540/* 544/*
541 * display the wps on entering or restoring */ 545 * display the wps on entering or restoring */
542static void gwps_enter_wps(void) 546static void gwps_enter_wps(bool theme_enabled)
543{ 547{
544 struct gui_wps *gwps; 548 struct gui_wps *gwps;
545 struct screen *display; 549 struct screen *display;
@@ -548,7 +552,8 @@ static void gwps_enter_wps(void)
548 gwps = skin_get_gwps(WPS, i); 552 gwps = skin_get_gwps(WPS, i);
549 display = gwps->display; 553 display = gwps->display;
550 display->scroll_stop(); 554 display->scroll_stop();
551 viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); 555 if (theme_enabled)
556 viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL);
552 557
553 /* Update the values in the first (default) viewport - in case the user 558 /* Update the values in the first (default) viewport - in case the user
554 has modified the statusbar or colour settings */ 559 has modified the statusbar or colour settings */
@@ -609,7 +614,7 @@ void wps_do_playpause(bool updatewps)
609 * b) return with a value evaluated by root_menu.c, in this case the wps 614 * b) return with a value evaluated by root_menu.c, in this case the wps
610 * is really left, and root_menu will handle the next screen 615 * is really left, and root_menu will handle the next screen
611 * 616 *
612 * In either way, call gwps_leave_wps(), in order to restore the correct 617 * In either way, call gwps_leave_wps(true), in order to restore the correct
613 * "main screen" backdrops and statusbars 618 * "main screen" backdrops and statusbars
614 */ 619 */
615long gui_wps_show(void) 620long gui_wps_show(void)
@@ -632,6 +637,7 @@ long gui_wps_show(void)
632 637
633 while ( 1 ) 638 while ( 1 )
634 { 639 {
640 bool theme_enabled = true;
635 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; 641 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
636 642
637 /* did someone else (i.e power thread) change audio pause mode? */ 643 /* did someone else (i.e power thread) change audio pause mode? */
@@ -693,23 +699,59 @@ long gui_wps_show(void)
693 case ACTION_WPS_CONTEXT: 699 case ACTION_WPS_CONTEXT:
694 { 700 {
695 bool hotkey = button == ACTION_WPS_HOTKEY; 701 bool hotkey = button == ACTION_WPS_HOTKEY;
696 gwps_leave_wps(); 702
697 int retval = onplay(state->id3->path, 703#ifdef HAVE_HOTKEY
704 if (hotkey && global_settings.hotkey_wps == HOTKEY_PLUGIN)
705 {
706 /* leave WPS without re-enabling theme */
707 theme_enabled = false;
708 gwps_leave_wps(theme_enabled);
709 onplay(state->id3->path,
698 FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); 710 FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
699 /* if music is stopped in the context menu we want to exit the wps */ 711 if (!audio_status())
700 if (retval == ONPLAY_MAINMENU 712 {
701 || !audio_status()) 713 /* re-enable theme since we're returning to SBS */
702 return GO_TO_ROOT; 714 FOR_NB_SCREENS(i)
703 else if (retval == ONPLAY_PLAYLIST) 715 {
704 return GO_TO_PLAYLIST_VIEWER; 716 struct gui_wps *gwps = skin_get_gwps(WPS, i);
705 else if (retval == ONPLAY_PLUGIN) 717#ifdef HAVE_BACKDROP_IMAGE
706 return GO_TO_PLUGIN; 718 skin_backdrop_show(sb_get_backdrop(i));
719#endif
720 viewportmanager_theme_undo(i, skin_has_sbs(gwps));
721 }
722 return GO_TO_ROOT;
723 }
724 }
725 else
726#endif
727 {
728 gwps_leave_wps(true);
729 int retval = onplay(state->id3->path,
730 FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
731 /* if music is stopped in the context menu we want to exit the wps */
732 if (retval == ONPLAY_MAINMENU
733 || !audio_status())
734 return GO_TO_ROOT;
735 else if (retval == ONPLAY_PLAYLIST)
736 return GO_TO_PLAYLIST_VIEWER;
737 else if (retval == ONPLAY_PLUGIN)
738 {
739 FOR_NB_SCREENS(i)
740 {
741 struct gui_wps *gwps = skin_get_gwps(WPS, i);
742 viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL);
743 }
744 theme_enabled = false;
745 open_plugin_run(ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN));
746 }
747 }
748
707 restore = true; 749 restore = true;
708 } 750 }
709 break; 751 break;
710 752
711 case ACTION_WPS_BROWSE: 753 case ACTION_WPS_BROWSE:
712 gwps_leave_wps(); 754 gwps_leave_wps(true);
713 return GO_TO_PREVIOUS_BROWSER; 755 return GO_TO_PREVIOUS_BROWSER;
714 break; 756 break;
715 757
@@ -852,7 +894,7 @@ long gui_wps_show(void)
852 break; 894 break;
853 /* menu key functions */ 895 /* menu key functions */
854 case ACTION_WPS_MENU: 896 case ACTION_WPS_MENU:
855 gwps_leave_wps(); 897 gwps_leave_wps(true);
856 return GO_TO_ROOT; 898 return GO_TO_ROOT;
857 break; 899 break;
858 900
@@ -860,7 +902,7 @@ long gui_wps_show(void)
860#ifdef HAVE_QUICKSCREEN 902#ifdef HAVE_QUICKSCREEN
861 case ACTION_WPS_QUICKSCREEN: 903 case ACTION_WPS_QUICKSCREEN:
862 { 904 {
863 gwps_leave_wps(); 905 gwps_leave_wps(true);
864 bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs; 906 bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs;
865 if (!enter_shortcuts_menu) 907 if (!enter_shortcuts_menu)
866 { 908 {
@@ -889,7 +931,7 @@ long gui_wps_show(void)
889#ifdef HAVE_PITCHCONTROL 931#ifdef HAVE_PITCHCONTROL
890 case ACTION_WPS_PITCHSCREEN: 932 case ACTION_WPS_PITCHSCREEN:
891 { 933 {
892 gwps_leave_wps(); 934 gwps_leave_wps(true);
893 if (1 == gui_syncpitchscreen_run()) 935 if (1 == gui_syncpitchscreen_run())
894 return GO_TO_ROOT; 936 return GO_TO_ROOT;
895 restore = true; 937 restore = true;
@@ -917,7 +959,7 @@ long gui_wps_show(void)
917 break; 959 break;
918 960
919 case ACTION_WPS_LIST_BOOKMARKS: 961 case ACTION_WPS_LIST_BOOKMARKS:
920 gwps_leave_wps(); 962 gwps_leave_wps(true);
921 if (bookmark_load_menu() == BOOKMARK_USB_CONNECTED) 963 if (bookmark_load_menu() == BOOKMARK_USB_CONNECTED)
922 { 964 {
923 return GO_TO_ROOT; 965 return GO_TO_ROOT;
@@ -926,14 +968,14 @@ long gui_wps_show(void)
926 break; 968 break;
927 969
928 case ACTION_WPS_CREATE_BOOKMARK: 970 case ACTION_WPS_CREATE_BOOKMARK:
929 gwps_leave_wps(); 971 gwps_leave_wps(true);
930 bookmark_create_menu(); 972 bookmark_create_menu();
931 restore = true; 973 restore = true;
932 break; 974 break;
933 975
934 case ACTION_WPS_ID3SCREEN: 976 case ACTION_WPS_ID3SCREEN:
935 { 977 {
936 gwps_leave_wps(); 978 gwps_leave_wps(true);
937 if (browse_id3(audio_current_track(), 979 if (browse_id3(audio_current_track(),
938 playlist_get_display_index(), 980 playlist_get_display_index(),
939 playlist_amount())) 981 playlist_amount()))
@@ -956,7 +998,7 @@ long gui_wps_show(void)
956 break; 998 break;
957#endif 999#endif
958 case ACTION_WPS_VIEW_PLAYLIST: 1000 case ACTION_WPS_VIEW_PLAYLIST:
959 gwps_leave_wps(); 1001 gwps_leave_wps(true);
960 return GO_TO_PLAYLIST_VIEWER; 1002 return GO_TO_PLAYLIST_VIEWER;
961 break; 1003 break;
962 default: 1004 default:
@@ -965,7 +1007,7 @@ long gui_wps_show(void)
965 case SYS_USB_CONNECTED: 1007 case SYS_USB_CONNECTED:
966 case SYS_CALL_INCOMING: 1008 case SYS_CALL_INCOMING:
967 case BUTTON_MULTIMEDIA_STOP: 1009 case BUTTON_MULTIMEDIA_STOP:
968 gwps_leave_wps(); 1010 gwps_leave_wps(true);
969 return GO_TO_ROOT; 1011 return GO_TO_ROOT;
970 } 1012 }
971 update = true; 1013 update = true;
@@ -1003,7 +1045,7 @@ long gui_wps_show(void)
1003 sb_skin_set_update_delay(0); 1045 sb_skin_set_update_delay(0);
1004 skin_request_full_update(WPS); 1046 skin_request_full_update(WPS);
1005 update = true; 1047 update = true;
1006 gwps_enter_wps(); 1048 gwps_enter_wps(theme_enabled);
1007 } 1049 }
1008 else 1050 else
1009 { 1051 {
@@ -1038,7 +1080,7 @@ long gui_wps_show(void)
1038#ifdef AB_REPEAT_ENABLE 1080#ifdef AB_REPEAT_ENABLE
1039 ab_reset_markers(); 1081 ab_reset_markers();
1040#endif 1082#endif
1041 gwps_leave_wps(); 1083 gwps_leave_wps(true);
1042#ifdef HAVE_RECORDING 1084#ifdef HAVE_RECORDING
1043 if (button == ACTION_WPS_REC) 1085 if (button == ACTION_WPS_REC)
1044 return GO_TO_RECSCREEN; 1086 return GO_TO_RECSCREEN;
diff --git a/apps/misc.c b/apps/misc.c
index 7da3c57c73..aa79ec632d 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1579,6 +1579,13 @@ void push_current_activity(enum current_activity screen)
1579 } 1579 }
1580} 1580}
1581 1581
1582void push_activity_without_refresh(enum current_activity screen)
1583{
1584 current_activity[current_activity_top++] = screen;
1585 FOR_NB_SCREENS(i)
1586 skinlist_set_cfg(i, NULL);
1587}
1588
1582void pop_current_activity(enum activity_refresh refresh) 1589void pop_current_activity(enum activity_refresh refresh)
1583{ 1590{
1584 current_activity_top--; 1591 current_activity_top--;
diff --git a/apps/misc.h b/apps/misc.h
index 4f4527f686..e59399d55b 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -221,6 +221,7 @@ enum activity_refresh
221}; 221};
222 222
223void push_current_activity(enum current_activity screen); 223void push_current_activity(enum current_activity screen);
224void push_activity_without_refresh(enum current_activity screen);
224void pop_current_activity(enum activity_refresh refresh); 225void pop_current_activity(enum activity_refresh refresh);
225enum current_activity get_current_activity(void); 226enum current_activity get_current_activity(void);
226 227
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 90a47c35ea..4c57d1a5ce 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,
143static bool update_playlist(bool force); 143static bool update_playlist(bool force);
144static enum pv_onplay_result onplay_menu(int index); 144static enum pv_onplay_result onplay_menu(int index);
145 145
146static void close_playlist_viewer(void); 146static void close_playlist_viewer(bool pop_activity);
147 147
148static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer, 148static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer,
149 int names_buffer_size) 149 int names_buffer_size)
@@ -525,11 +525,12 @@ static enum pv_onplay_result show_track_info(const struct playlist_entry *curren
525static enum pv_onplay_result open_with(const struct playlist_entry *current_track) 525static enum pv_onplay_result open_with(const struct playlist_entry *current_track)
526{ 526{
527 char selected_track[MAX_PATH]; 527 char selected_track[MAX_PATH];
528 close_playlist_viewer(); 528 close_playlist_viewer(false); /* don't pop activity yet – relevant for plugin_load */
529 529
530 strmemccpy(selected_track, current_track->name, sizeof(selected_track)); 530 strmemccpy(selected_track, current_track->name, sizeof(selected_track));
531 531
532 int plugin_return = filetype_list_viewers(selected_track); 532 int plugin_return = filetype_list_viewers(selected_track);
533 pop_current_activity(ACTIVITY_REFRESH_DEFERRED);
533 534
534 switch (plugin_return) 535 switch (plugin_return)
535 { 536 {
@@ -547,11 +548,11 @@ static enum pv_onplay_result open_with(const struct playlist_entry *current_trac
547static enum pv_onplay_result open_pictureflow(const struct playlist_entry *current_track) 548static enum pv_onplay_result open_pictureflow(const struct playlist_entry *current_track)
548{ 549{
549 char selected_track[MAX_PATH]; 550 char selected_track[MAX_PATH];
550 close_playlist_viewer(); 551 close_playlist_viewer(false); /* don't pop activity yet – relevant for plugin_load */
551 552
552 strmemccpy(selected_track, current_track->name, sizeof(selected_track)); 553 strmemccpy(selected_track, current_track->name, sizeof(selected_track));
553
554 int plugin_return = filetype_load_plugin((void *)"pictureflow", selected_track); 554 int plugin_return = filetype_load_plugin((void *)"pictureflow", selected_track);
555 pop_current_activity(ACTIVITY_REFRESH_DEFERRED);
555 556
556 switch (plugin_return) 557 switch (plugin_return)
557 { 558 {
@@ -1092,14 +1093,15 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
1092 } 1093 }
1093 1094
1094exit: 1095exit:
1095 close_playlist_viewer(); 1096 close_playlist_viewer(true);
1096 return ret; 1097 return ret;
1097} 1098}
1098 1099
1099static void close_playlist_viewer(void) 1100static void close_playlist_viewer(bool pop_activity)
1100{ 1101{
1101 talk_shutup(); 1102 talk_shutup();
1102 pop_current_activity(ACTIVITY_REFRESH_DEFERRED); 1103 if (pop_activity)
1104 pop_current_activity(ACTIVITY_REFRESH_DEFERRED);
1103 if (viewer.playlist) 1105 if (viewer.playlist)
1104 { 1106 {
1105 if (viewer.initial_selection) 1107 if (viewer.initial_selection)
diff --git a/apps/plugin.c b/apps/plugin.c
index 2be6e10308..21dbe47c54 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -894,14 +894,16 @@ int plugin_load(const char* plugin, const void* parameter)
894 *(p_hdr->api) = &rockbox_api; 894 *(p_hdr->api) = &rockbox_api;
895 lcd_set_viewport(NULL); 895 lcd_set_viewport(NULL);
896 lcd_clear_display(); 896 lcd_clear_display();
897 lcd_update();
898 897
899#ifdef HAVE_REMOTE_LCD 898#ifdef HAVE_REMOTE_LCD
900 lcd_remote_set_viewport(NULL); 899 lcd_remote_set_viewport(NULL);
901 lcd_remote_clear_display(); 900 lcd_remote_clear_display();
902 lcd_remote_update(); 901 lcd_remote_update();
903#endif 902#endif
904 push_current_activity(ACTIVITY_PLUGIN); 903 if (get_current_activity() == ACTIVITY_WPS)
904 push_activity_without_refresh(ACTIVITY_PLUGIN);
905 else
906 push_current_activity(ACTIVITY_PLUGIN);
905 /* some plugins assume the entry cache doesn't move and save pointers to it 907 /* some plugins assume the entry cache doesn't move and save pointers to it
906 * they should be fixed properly instead of this lock */ 908 * they should be fixed properly instead of this lock */
907 tree_lock_cache(tree_get_context()); 909 tree_lock_cache(tree_get_context());
@@ -922,7 +924,16 @@ int plugin_load(const char* plugin, const void* parameter)
922 int rc = p_hdr->entry_point(parameter); 924 int rc = p_hdr->entry_point(parameter);
923 925
924 tree_unlock_cache(tree_get_context()); 926 tree_unlock_cache(tree_get_context());
925 pop_current_activity(ACTIVITY_REFRESH_NOW); 927
928 pop_current_activity(ACTIVITY_REFRESH_DEFERRED);
929 int curr_activity = get_current_activity();
930 if ((curr_activity != ACTIVITY_PLAYLISTVIEWER) &&
931 (curr_activity != ACTIVITY_WPS) &&
932 (rc != PLUGIN_GOTO_WPS))
933 {
934 FOR_NB_SCREENS(i)
935 skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL);
936 }
926 937
927 if (!pfn_tsr_exit) 938 if (!pfn_tsr_exit)
928 { /* close handle if plugin is no tsr one */ 939 { /* close handle if plugin is no tsr one */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 3553b794fa..6008c87eda 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -708,8 +708,11 @@ static inline int load_screen(int screen)
708 708
709 if (activity != ACTIVITY_UNKNOWN) 709 if (activity != ACTIVITY_UNKNOWN)
710 { 710 {
711 if (ret_val == GO_TO_WPS 711 if (ret_val == GO_TO_PLUGIN
712 || ret_val == GO_TO_PREVIOUS_MUSIC) 712 || ret_val == GO_TO_WPS
713 || ret_val == GO_TO_PREVIOUS_MUSIC
714 || ret_val == GO_TO_PREVIOUS_BROWSER
715 || ret_val == GO_TO_FILEBROWSER)
713 { 716 {
714 pop_current_activity(ACTIVITY_REFRESH_DEFERRED); 717 pop_current_activity(ACTIVITY_REFRESH_DEFERRED);
715 } 718 }
@@ -986,7 +989,10 @@ void root_menu(void)
986 } 989 }
987 } 990 }
988 991
989 next_screen = load_plugin_screen(key); 992
993 push_activity_without_refresh(ACTIVITY_UNKNOWN); /* prevent plugin_load */
994 next_screen = load_plugin_screen(key); /* from flashing root */
995 pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* menu activity */
990 996
991 if (next_screen == GO_TO_PREVIOUS) 997 if (next_screen == GO_TO_PREVIOUS)
992 { 998 {