summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c154689..ba9db71 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -327,19 +327,35 @@ static bool networkOnline()
}
class QPEScreenSaver : public QWSScreenSaver
{
+private:
+ int LcdOn;
public:
QPEScreenSaver()
{
+ int fd;
+
+ LcdOn = TRUE;
+ // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
+ fd=open("/dev/fb0",O_RDWR);
+ if (fd != -1) { ioctl(fd,FBIOBLANK,VESA_NO_BLANKING); close(fd); }
}
void restore()
{
+ if (!LcdOn) // We must have turned it off
+ {
+ int fd;
+ fd=open("/dev/fb0",O_RDWR);
+ if (fd != -1) { ioctl(fd,FBIOBLANK,VESA_NO_BLANKING); close(fd); }
+ }
setBacklight(-1);
}
bool save(int level)
{
+ int fd;
+
switch ( level ) {
case 0:
if ( disable_suspend > 0 && dim_on ) {
if (backlight() > 1)
@@ -353,12 +369,23 @@ public:
}
return TRUE;
break;
case 2:
- if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) {
- QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
- return TRUE;
- }
+ Config config( "qpe" );
+ config.setGroup( "Screensaver" );
+ if (config.readNumEntry("LcdOffOnly",0) != 0) // We're only turning off the LCD
+ {
+ fd=open("/dev/fb0",O_RDWR);
+ if (fd != -1) { ioctl(fd,FBIOBLANK,VESA_POWERDOWN); close(fd); }
+ LcdOn = FALSE;
+ }
+ else // We're going to suspend the whole machine
+ {
+ if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) {
+ QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
+ return TRUE;
+ }
+ }
break;
}
return FALSE;
}