summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-17 03:20:37 (UTC)
committer llornkcor <llornkcor>2002-04-17 03:20:37 (UTC)
commit4db3abc59c27022211222187a48eb649460c5432 (patch) (side-by-side diff)
tree78fda069e80cadd5eb05c411c8cb5f2725dae6d9
parent530f334d28c6156c4a50ba072b6d638a507c9686 (diff)
downloadopie-4db3abc59c27022211222187a48eb649460c5432.zip
opie-4db3abc59c27022211222187a48eb649460c5432.tar.gz
opie-4db3abc59c27022211222187a48eb649460c5432.tar.bz2
LCD off(only) on suspend patch
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c154689..ba9db71 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -325,23 +325,39 @@ static bool networkOnline()
{
return Network::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)
setBacklight(1); // lowest non-off
}
@@ -351,16 +367,27 @@ public:
if ( disable_suspend > 1 && lightoff_on ) {
setBacklight(0); // off
}
return TRUE;
break;
case 2:
+ 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;
}
};