From 1b6a3549317fd895965f0ac22d08e640b94eb741 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 21 Sep 2004 18:56:53 +0000 Subject: 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 --- (limited to 'libopie2/opiecore') 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 @@ -34,6 +34,7 @@ #include #include #include +#include /* OPIE */ #include @@ -315,23 +316,17 @@ 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; } @@ -369,3 +364,20 @@ int SIMpad::displayBrightnessResolution() const return 255; // All SIMpad models share the same display } + +/* + * 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; +} diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index dbcbbb4..c25b911 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h @@ -65,6 +65,8 @@ protected: int m_power_timer; OLedState m_leds [2]; +private: + static void updateAllWidgets(); }; struct s_button { -- cgit v0.9.0.2