summaryrefslogtreecommitdiff
path: root/packages/qte/qte-2.3.12/suspend-resume-hooks.patch
blob: 34e6ba213367c537c62faebd51177e7816b016ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Suspend/Resume hooks for QScreen and usage from QApplication
Manuel Teira <manuel.teira@telefonica.net>

#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- qt-2.3.10/src/kernel/qgfx_qws.h~suspend-resume-hooks
+++ qt-2.3.10/src/kernel/qgfx_qws.h
@@ -192,6 +192,8 @@
     virtual int pixmapLinestepAlignment() { return 64; }
 
     virtual void sync() {}
+    virtual void prepareToSuspend() {}
+    virtual void prepareToResume() {}
     virtual bool onCard(unsigned char *) const;
     virtual bool onCard(unsigned char *, ulong& out_offset) const;
 
--- qt-2.3.10/src/kernel/qapplication_qws.cpp~suspend-resume-hooks
+++ qt-2.3.10/src/kernel/qapplication_qws.cpp
@@ -480,6 +480,7 @@
     int region_offset_window;
 #ifndef QT_NO_COP
     QWSQCopMessageEvent *qcop_response;
+    bool manageAPMMessage( QWSQCopMessageEvent *e );
 #endif
     QWSEvent* current_event;
     QValueList<int> unused_identifiers;
@@ -840,7 +841,7 @@
 	    QWSQCopMessageEvent *pe = (QWSQCopMessageEvent*)e;
 	    if ( pe->simpleData.is_response ) {
 		qcop_response = pe;
-	    } else {
+	    } else if ( !manageAPMMessage( pe ) ) {
 		queue.append(e);
 	    }
 #endif
@@ -851,6 +852,26 @@
     }
 }
 
+#ifndef QT_NO_COP
+bool QWSDisplayData::manageAPMMessage( QWSQCopMessageEvent *e )
+{
+    if ( e->channel.data() != QCString( "QPE/System" ) ) {
+	return FALSE;
+    }
+    if ( e->message.data() == QCString( "aboutToSuspend()" ) ) {
+	if ( qt_screen ) qt_screen->prepareToSuspend();
+	delete e;
+	return TRUE;
+    }
+    if ( e->message.data() == QCString( "returnFromSuspend()" ) ) {
+	if ( qt_screen ) qt_screen->prepareToResume();
+	delete e;
+	return TRUE;
+    }
+    return FALSE;
+}
+#endif
+
 void QWSDisplayData::offsetPendingExpose( int window, const QPoint &offset )
 {
     if ( offset.isNull() )