author | kergoth <kergoth> | 2003-04-21 17:15:01 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-21 17:15:01 (UTC) |
commit | b3ec819dfed40b05b2bea1b1392de774bc1f572d (patch) (unidiff) | |
tree | c0e30307ba6623f49cda10ce35e7f3323b4062f8 /libopie/odevice.cpp | |
parent | eecb4b6d3c22466f273c3498b6370b1e1c67c726 (diff) | |
download | opie-b3ec819dfed40b05b2bea1b1392de774bc1f572d.zip opie-b3ec819dfed40b05b2bea1b1392de774bc1f572d.tar.gz opie-b3ec819dfed40b05b2bea1b1392de774bc1f572d.tar.bz2 |
Final fix for the suspend bug
-rw-r--r-- | libopie/odevice.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 501b601..62e3569 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -55,10 +55,8 @@ | |||
55 | using namespace Opie; | 55 | using namespace Opie; |
56 | 56 | ||
57 | class ODeviceData { | 57 | class ODeviceData { |
58 | public: | 58 | public: |
59 | bool m_qwsserver : 1; | ||
60 | |||
61 | QString m_vendorstr; | 59 | QString m_vendorstr; |
62 | OVendor m_vendor; | 60 | OVendor m_vendor; |
63 | 61 | ||
64 | QString m_modelstr; | 62 | QString m_modelstr; |
@@ -238,10 +236,12 @@ static QCString makeChannel ( const char *str ) | |||
238 | else | 236 | else |
239 | return str; | 237 | return str; |
240 | } | 238 | } |
241 | 239 | ||
242 | 240 | static inline bool isQWS() | |
243 | 241 | { | |
242 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | ||
243 | } | ||
244 | 244 | ||
245 | ODevice *ODevice::inst ( ) | 245 | ODevice *ODevice::inst ( ) |
246 | { | 246 | { |
247 | static ODevice *dev = 0; | 247 | static ODevice *dev = 0; |
@@ -270,10 +270,8 @@ ODevice *ODevice::inst ( ) | |||
270 | ODevice::ODevice ( ) | 270 | ODevice::ODevice ( ) |
271 | { | 271 | { |
272 | d = new ODeviceData; | 272 | d = new ODeviceData; |
273 | 273 | ||
274 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | ||
275 | |||
276 | d-> m_modelstr = "Unknown"; | 274 | d-> m_modelstr = "Unknown"; |
277 | d-> m_model = Model_Unknown; | 275 | d-> m_model = Model_Unknown; |
278 | d-> m_vendorstr = "Unknown"; | 276 | d-> m_vendorstr = "Unknown"; |
279 | d-> m_vendor = Vendor_Unknown; | 277 | d-> m_vendor = Vendor_Unknown; |
@@ -305,10 +303,8 @@ void ODevice::initButtons ( ) | |||
305 | { | 303 | { |
306 | if ( d-> m_buttons ) | 304 | if ( d-> m_buttons ) |
307 | return; | 305 | return; |
308 | 306 | ||
309 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | ||
310 | |||
311 | // Simulation uses iPAQ 3660 device buttons | 307 | // Simulation uses iPAQ 3660 device buttons |
312 | 308 | ||
313 | qDebug ( "init Buttons" ); | 309 | qDebug ( "init Buttons" ); |
314 | d-> m_buttons = new QValueList <ODeviceButton>; | 310 | d-> m_buttons = new QValueList <ODeviceButton>; |
@@ -358,9 +354,9 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ ) | |||
358 | * @return if the device got suspended | 354 | * @return if the device got suspended |
359 | */ | 355 | */ |
360 | bool ODevice::suspend ( ) | 356 | bool ODevice::suspend ( ) |
361 | { | 357 | { |
362 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 358 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
363 | return false; | 359 | return false; |
364 | 360 | ||
365 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 361 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
366 | return false; | 362 | return false; |
@@ -806,11 +802,9 @@ void iPAQ::initButtons ( ) | |||
806 | { | 802 | { |
807 | if ( d-> m_buttons ) | 803 | if ( d-> m_buttons ) |
808 | return; | 804 | return; |
809 | 805 | ||
810 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 806 | if ( isQWS( ) ) |
811 | |||
812 | if ( d-> m_qwsserver ) | ||
813 | QWSServer::setKeyboardFilter ( this ); | 807 | QWSServer::setKeyboardFilter ( this ); |
814 | 808 | ||
815 | d-> m_buttons = new QValueList <ODeviceButton>; | 809 | d-> m_buttons = new QValueList <ODeviceButton>; |
816 | 810 | ||
@@ -1206,10 +1200,8 @@ void Zaurus::initButtons ( ) | |||
1206 | { | 1200 | { |
1207 | if ( d-> m_buttons ) | 1201 | if ( d-> m_buttons ) |
1208 | return; | 1202 | return; |
1209 | 1203 | ||
1210 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | ||
1211 | |||
1212 | d-> m_buttons = new QValueList <ODeviceButton>; | 1204 | d-> m_buttons = new QValueList <ODeviceButton>; |
1213 | 1205 | ||
1214 | struct z_button * pz_buttons; | 1206 | struct z_button * pz_buttons; |
1215 | int buttoncount; | 1207 | int buttoncount; |