diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index c18f01eb6..34259392c 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -2210,6 +2210,10 @@ void CAudioPlayerGui::play(unsigned int pos) m_time_total = m_playlist[m_current].MetaData.total_time; m_state = CAudioPlayerGui::PLAY; m_curr_audiofile = m_playlist[m_current]; + + if (m_screensaver && g_settings.audioplayer_cover_as_screensaver) + CScreenSaver::getInstance()->forceRefresh(); + // Play CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index f982c1552..861de4ed0 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -64,6 +64,7 @@ CScreenSaver::CScreenSaver() clr.i_color = COL_DARK_GRAY; pip_channel_id = 0; idletime = time(NULL); + force_refresh = false; } CScreenSaver::~CScreenSaver() @@ -183,11 +184,20 @@ void* CScreenSaver::ScreenSaverPrg(void* arg) { PScreenSaver->ReadDir(); PScreenSaver->paint(); - sleep(g_settings.screensaver_timeout); + int t = g_settings.screensaver_timeout; + while (t--) + { + sleep(1); + if (PScreenSaver->force_refresh) + { + PScreenSaver->force_refresh = false; + break; + } + } } } else - PScreenSaver->paint(); //just paint first found picture + PScreenSaver->paint(); return 0; } diff --git a/src/gui/screensaver.h b/src/gui/screensaver.h index 1f3b63fd5..716e874df 100644 --- a/src/gui/screensaver.h +++ b/src/gui/screensaver.h @@ -42,6 +42,7 @@ class CScreenSaver : public sigc::trackable std::vector v_bg_files; unsigned int index; t_channel_id pip_channel_id; + bool force_refresh; bool status_mute; bool status_icons; //NI @@ -78,6 +79,7 @@ class CScreenSaver : public sigc::trackable void resetIdleTime() { idletime = time(NULL); } time_t getIdleTime() { return idletime; } + void forceRefresh() { force_refresh = true; } }; #endif // __CSCREENSAVER_H__