neutrino: move screensaver members to screensaver's code

Signed-off-by: Thilo Graf <dbt@novatux.de>


Origin commit data
------------------
Commit: 74bc2e88d5
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-11-25 (Sat, 25 Nov 2017)

Origin message was:
------------------
- neutrino: move screensaver members to screensaver's code

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
vanhofen
2017-11-25 09:58:55 +01:00
committed by Thilo Graf
parent ab9422c64e
commit 00f4cb4ee2
5 changed files with 25 additions and 34 deletions

View File

@@ -59,6 +59,7 @@ CScreenSaver::CScreenSaver()
scr_clock = NULL;
clr.i_color = COL_DARK_GRAY;
pip_channel_id = 0;
idletime = time(NULL);
}
CScreenSaver::~CScreenSaver()
@@ -126,6 +127,7 @@ void CScreenSaver::Stop()
pthread_cancel(thrScreenSaver);
thrScreenSaver = 0;
}
resetIdleTime();
if (scr_clock){
scr_clock->Stop();
@@ -312,7 +314,7 @@ void CScreenSaver::paint()
}
}
bool CScreenSaver::IsRun()
bool CScreenSaver::isActive()
{
if(thrScreenSaver)
return true;

View File

@@ -47,6 +47,8 @@ class CScreenSaver : public sigc::trackable
bool ReadDir();
void paint();
time_t idletime;
union u_color {
struct s_color {
uint8_t b, g, r, a;
@@ -66,11 +68,14 @@ class CScreenSaver : public sigc::trackable
CScreenSaver();
~CScreenSaver();
static CScreenSaver* getInstance();
bool IsRun();
bool isActive();
void Start();
void Stop();
sigc::signal<void> OnBeforeStart;
sigc::signal<void> OnAfterStop;
void resetIdleTime() { idletime = time(NULL); }
time_t getIdleTime() { return idletime; }
};
#endif // __CSCREENSAVER_H__

View File

@@ -102,7 +102,7 @@ void CTimeOSD::initTimeString()
void CTimeOSD::show(time_t time_show, bool force)
{
time_show /= 1000;
if (!force && (m_mode == MODE_HIDE || m_time_show == time_show || CScreenSaver::getInstance()->IsRun()))
if (!force && (m_mode == MODE_HIDE || m_time_show == time_show || CScreenSaver::getInstance()->isActive()))
return;
m_time_show = time_show;