From 4d934ad1731fd16ed3a6d1266bf6bf4cf5f72a3a Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 25 May 2018 00:59:24 +0200 Subject: [PATCH] - screensaver: allow to switch clock <-> picture while runtime Signed-off-by: Thilo Graf --- src/gui/screensaver.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index f6bb523ae..d3cdda956 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -150,13 +150,13 @@ void* CScreenSaver::ScreenSaverPrg(void* arg) CScreenSaver * PScreenSaver = static_cast(arg); - PScreenSaver->ReadDir(); //TODO kill Screensaver if false PScreenSaver->m_frameBuffer->Clear(); if (g_settings.screensaver_timeout) { while(PScreenSaver) { + PScreenSaver->ReadDir(); PScreenSaver->paint(); sleep(g_settings.screensaver_timeout); } @@ -248,8 +248,10 @@ bool CScreenSaver::ReadDir() if(!v_bg_files.empty()) ret = true; +#if 0 else dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : no picture found\n", __func__, __LINE__); +#endif return ret; } @@ -257,6 +259,14 @@ bool CScreenSaver::ReadDir() void CScreenSaver::paint() { + if (scr_clock) + { + scr_clock->Stop(); + scr_clock->kill(); + } + if (g_settings.screensaver_mode == SCR_MODE_IMAGE && v_bg_files.empty()) + m_frameBuffer->paintBackground(); + if (g_settings.screensaver_mode == SCR_MODE_IMAGE && !v_bg_files.empty()){ if( (index >= v_bg_files.size()) || (access(v_bg_files.at(index).c_str(), F_OK)) ) @@ -286,10 +296,7 @@ void CScreenSaver::paint() scr_clock->disableSaveBg(); scr_clock->doPaintBg(false); } - if (scr_clock->isPainted()) - scr_clock->Stop(); - scr_clock->kill(); scr_clock->setTextColor(clr.i_color); //check position and size use only possible available screen size