diff options
Diffstat (limited to 'gui/blanktimer.cpp')
-rw-r--r-- | gui/blanktimer.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp index 4662b1fab..220525387 100644 --- a/gui/blanktimer.cpp +++ b/gui/blanktimer.cpp @@ -116,3 +116,37 @@ void blanktimer::resetTimerAndUnblank(void) { pthread_mutex_unlock(&mutex); #endif } + +void blanktimer::blank(void) { +/* 1) No need for timer handling since checkForTimeout() verifies + * state of screen before performing screen-off + * 2) Assume screen-off causes issues for devices that set + * TW_NO_SCREEN_TIMEOUT and do not blank screen here either + */ + +#ifndef TW_NO_SCREEN_TIMEOUT + pthread_mutex_lock(&mutex); + if (state == kOn) { + orig_brightness = getBrightness(); + state = kOff; + TWFunc::Set_Brightness("0"); + TWFunc::check_and_run_script("/sbin/postscreenblank.sh", "blank"); + } +#ifndef TW_NO_SCREEN_BLANK + if (state == kOff) { + gr_fb_blank(true); + state = kBlanked; + } +#endif + pthread_mutex_unlock(&mutex); +#endif +} + +void blanktimer::toggleBlank(void) { + if (state == kOn) { + blank(); + PageManager::ChangeOverlay("lock"); + } else { + resetTimerAndUnblank(); + } +} |