author | zecke <zecke> | 2004-09-21 18:56:53 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-21 18:56:53 (UTC) |
commit | 1b6a3549317fd895965f0ac22d08e640b94eb741 (patch) (side-by-side diff) | |
tree | 9898c5238c2f76d2a5af5afa913eb141bd0d37b2 /libopie2/opiecore/device/odevice_simpad.cpp | |
parent | 95b81f3c2c9ae5f48f9aeca4dafea9400f9bb3f0 (diff) | |
download | opie-1b6a3549317fd895965f0ac22d08e640b94eb741.zip opie-1b6a3549317fd895965f0ac22d08e640b94eb741.tar.gz opie-1b6a3549317fd895965f0ac22d08e640b94eb741.tar.bz2 |
SIMpad:
-Update all Widgets if we suspended the device. We implement
it by iterating over QApplication::allWidgets and calling
QWidget::update(). This approach should be more reliable
than the system and echo hack
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 4ae3c4f..ebf0cbb 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp @@ -35,4 +35,5 @@ #include <qtextstream.h> #include <qwindowsystem_qws.h> +#include <qwidgetlist.h> /* OPIE */ @@ -316,21 +317,15 @@ void SIMpad::playAlarmSound() bool SIMpad::suspend() // Must override because SIMpad does NOT have apm { - qDebug( "ODevice for SIMpad: suspend()" ); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; - /* - * we need to save the screen content - * then go to suspend using ODevice::suspend - * and finally restore the screen content - */ - (void)::system( "cat /dev/fb/0 > /tmp/.buffer" ); bool res = ODevice::suspend(); /* - * restore + * restore the screen content if we really + * supended the device */ if ( res ) - ::system( "cat /tmp/.buffer > /dev/fb/0" ); + updateAllWidgets(); return res; @@ -370,2 +365,19 @@ int SIMpad::displayBrightnessResolution() const } + +/* + * The MQ200 DRAM content is lost during suspend + * so we will just repaint every widget on resume + */ +void SIMpad::updateAllWidgets() { + QWidgetList *list = QApplication::allWidgets(); + QWidgetListIt it( *list ); + QWidget *wid; + + while ((wid=it.current()) != 0 ) { + wid->update(); + ++it; + } + + delete list; +} |