screensaver: allow to switch clock <-> picture while runtime

Origin commit data
------------------
Commit: 67184441e9
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-05-25 (Fri, 25 May 2018)

Origin message was:
------------------
- screensaver: allow to switch clock <-> picture while runtime
This commit is contained in:
vanhofen
2018-05-25 00:59:24 +02:00
parent 7ff38342fe
commit b061d03a6d

View File

@@ -169,13 +169,13 @@ void* CScreenSaver::ScreenSaverPrg(void* arg)
CScreenSaver * PScreenSaver = static_cast<CScreenSaver*>(arg); CScreenSaver * PScreenSaver = static_cast<CScreenSaver*>(arg);
PScreenSaver->ReadDir(); //TODO kill Screensaver if false
PScreenSaver->m_frameBuffer->Clear(); PScreenSaver->m_frameBuffer->Clear();
if (g_settings.screensaver_timeout) if (g_settings.screensaver_timeout)
{ {
while(PScreenSaver) while(PScreenSaver)
{ {
PScreenSaver->ReadDir();
PScreenSaver->paint(); PScreenSaver->paint();
sleep(g_settings.screensaver_timeout); sleep(g_settings.screensaver_timeout);
} }
@@ -256,8 +256,10 @@ bool CScreenSaver::ReadDir()
if(!v_bg_files.empty()) if(!v_bg_files.empty())
ret = true; ret = true;
#if 0
else else
dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : no picture found\n", __func__, __LINE__); dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : no picture found\n", __func__, __LINE__);
#endif
return ret; return ret;
} }
@@ -265,6 +267,14 @@ bool CScreenSaver::ReadDir()
void CScreenSaver::paint() 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 (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)) ) if( (index >= v_bg_files.size()) || (access(v_bg_files.at(index).c_str(), F_OK)) )
@@ -294,10 +304,7 @@ void CScreenSaver::paint()
scr_clock->disableSaveBg(); scr_clock->disableSaveBg();
scr_clock->doPaintBg(false); scr_clock->doPaintBg(false);
} }
if (scr_clock->isPainted())
scr_clock->Stop();
scr_clock->kill();
scr_clock->setTextColor(clr.i_color); scr_clock->setTextColor(clr.i_color);
//check position and size use only possible available screen size //check position and size use only possible available screen size