mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 17:08:26 +02:00
PowerSaver: re-layouted code.
No functional changes.
This commit is contained in:
parent
e73a8d06ea
commit
ae685a9729
@ -1,14 +1,15 @@
|
||||
#include "powersaver.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "powersaver.h"
|
||||
#include "debug.h"
|
||||
PowerSaver *PowerSaver::instance = NULL;
|
||||
Uint32 screenTimerCallback(Uint32, void *)
|
||||
{
|
||||
|
||||
Uint32 screenTimerCallback(Uint32, void *) {
|
||||
DEBUG("Disable Backlight Event\n");
|
||||
PowerSaver::getInstance()->disableScreen();
|
||||
return 0;
|
||||
@ -48,14 +49,14 @@ void PowerSaver::resetScreenTimer() {
|
||||
}
|
||||
|
||||
addScreenTimer();
|
||||
//If display is off, turn on it
|
||||
// If display is off, turn on it.
|
||||
if (!screenState) {
|
||||
enableScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void PowerSaver::addScreenTimer() {
|
||||
//if timeout is zero, don't set timeout
|
||||
// If timeout is zero, don't set timeout.
|
||||
if (screenTimeout == 0) {
|
||||
screenTimer = NULL;
|
||||
return;
|
||||
@ -90,10 +91,9 @@ void PowerSaver::enableScreen() {
|
||||
setScreenBlanking(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PowerSaver::disableScreen() {
|
||||
if (screenState) {
|
||||
setScreenBlanking(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,26 +1,29 @@
|
||||
#ifndef POWERSAVER_H
|
||||
#define POWERSAVER_H
|
||||
#include <SDL.h>
|
||||
class PowerSaver {
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
class PowerSaver {
|
||||
public:
|
||||
static PowerSaver *getInstance();
|
||||
static bool isRunning();
|
||||
~PowerSaver();
|
||||
void addScreenTimer();
|
||||
void resetScreenTimer();
|
||||
|
||||
void enableScreen();
|
||||
void disableScreen();
|
||||
|
||||
void setScreenTimeout(unsigned int seconds);
|
||||
|
||||
private:
|
||||
PowerSaver();
|
||||
void addScreenTimer();
|
||||
void setScreenBlanking(bool state);
|
||||
|
||||
static PowerSaver *instance;
|
||||
bool screenState;
|
||||
unsigned int screenTimeout;
|
||||
SDL_TimerID screenTimer;
|
||||
|
||||
void setScreenBlanking( bool state );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user