author | zecke <zecke> | 2005-04-16 22:00:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-04-16 22:00:51 (UTC) |
commit | 632d3e87a7e2cf6efecb676987d622e937ecafb8 (patch) (unidiff) | |
tree | 6689c8549e494841108217daa21913ec27565720 /x11/libqpe-x11 | |
parent | 790b371e6c7ed9da76eafb8a5b2e5d5458b320d8 (diff) | |
download | opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.zip opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.tar.gz opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.tar.bz2 |
Opie/X11:
Minor updates to build a recent Opie version for usage with
the X Window System
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 26 | ||||
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.h | 8 | ||||
-rw-r--r-- | x11/libqpe-x11/qt/qwindowsystem_qws.h | 3 |
3 files changed, 26 insertions, 11 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index 73e7ce4..c49f3ad 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp | |||
@@ -1,796 +1,806 @@ | |||
1 | #define QTOPIA_INTERNAL_LANGLIST | 1 | #define QTOPIA_INTERNAL_LANGLIST |
2 | 2 | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <sys/file.h> | 6 | #include <sys/file.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include <qdir.h> | 9 | #include <qdir.h> |
10 | #include <qdialog.h> | 10 | #include <qdialog.h> |
11 | #include <qdragobject.h> | 11 | #include <qdragobject.h> |
12 | #include <qevent.h> | 12 | #include <qevent.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qlist.h> | 14 | #include <qlist.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qtextcodec.h> | 16 | #include <qtextcodec.h> |
17 | #include <qpalette.h> | 17 | #include <qpalette.h> |
18 | #include <qptrdict.h> | 18 | #include <qptrdict.h> |
19 | #include <qregexp.h> | 19 | #include <qregexp.h> |
20 | #include <qtimer.h> | 20 | #include <qtimer.h> |
21 | 21 | ||
22 | #include <qpe/custom.h> | 22 | #include <qpe/custom.h> |
23 | #include <qpe/alarmserver.h> | 23 | #include <qpe/alarmserver.h> |
24 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qpe/qpemenubar.h> | 25 | #include <qpe/qpemenubar.h> |
26 | #include <qpe/textcodecinterface.h> | 26 | #include <qpe/textcodecinterface.h> |
27 | #include <qpe/imagecodecinterface.h> | 27 | #include <qpe/imagecodecinterface.h> |
28 | #include <qpe/qlibrary.h> | 28 | #include <qpe/qlibrary.h> |
29 | #include <qpe/qpestyle.h> | 29 | #include <qpe/qpestyle.h> |
30 | #include <qpe/styleinterface.h> | 30 | #include <qpe/styleinterface.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/network.h> | 34 | #include <qpe/network.h> |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/timestring.h> | 37 | #include <qpe/timestring.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | 39 | ||
40 | 40 | ||
41 | #include <X11/Xlib.h> | 41 | #include <X11/Xlib.h> |
42 | #include <X11/Xutil.h> | 42 | #include <X11/Xutil.h> |
43 | 43 | ||
44 | const int XKeyPress = KeyPress; | 44 | const int XKeyPress = KeyPress; |
45 | const int XKeyRelease = KeyRelease; | 45 | const int XKeyRelease = KeyRelease; |
46 | #undef KeyPress | 46 | #undef KeyPress |
47 | #undef KeyRelease | 47 | #undef KeyRelease |
48 | 48 | ||
49 | namespace { | 49 | namespace { |
50 | struct QCopRec{ | 50 | struct QCopRec{ |
51 | QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar ) | 51 | QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar ) |
52 | : channel(ch), message(msg), data(ar) { | 52 | : channel(ch), message(msg), data(ar) { |
53 | 53 | ||
54 | } | 54 | } |
55 | QCString channel; | 55 | QCString channel; |
56 | QCString message; | 56 | QCString message; |
57 | QByteArray data; | 57 | QByteArray data; |
58 | }; | 58 | }; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | class QPEApplication::Private { | 62 | class QPEApplication::Private { |
63 | public: | 63 | public: |
64 | Private(); | 64 | Private(); |
65 | ~Private(); | 65 | ~Private(); |
66 | void enqueueQCop( const QCString& ch, const QCString& msg, | 66 | void enqueueQCop( const QCString& ch, const QCString& msg, |
67 | const QByteArray& ); | 67 | const QByteArray& ); |
68 | void sendQCopQ(); | 68 | void sendQCopQ(); |
69 | static void show_mx(QWidget* mw, bool nomaximize ); | 69 | static void show_mx(QWidget* mw, bool nomaximize ); |
70 | void show( QWidget* mw, bool nomax ); | 70 | void show( QWidget* mw, bool nomax ); |
71 | void loadTextCodecs(); | 71 | void loadTextCodecs(); |
72 | void loadImageCodecs(); | 72 | void loadImageCodecs(); |
73 | 73 | ||
74 | int kbgrabber; | 74 | int kbgrabber; |
75 | int presstimer; | 75 | int presstimer; |
76 | 76 | ||
77 | bool rightpressed : 1; | 77 | bool rightpressed : 1; |
78 | bool kbregrab : 1; | 78 | bool kbregrab : 1; |
79 | bool notbusysent : 1; | 79 | bool notbusysent : 1; |
80 | bool preloaded : 1; | 80 | bool preloaded : 1; |
81 | bool forceshow : 1; | 81 | bool forceshow : 1; |
82 | bool nomaximize : 1; | 82 | bool nomaximize : 1; |
83 | bool keep_running : 1; | 83 | bool keep_running : 1; |
84 | 84 | ||
85 | QWidget* presswidget; | 85 | QWidget* presswidget; |
86 | QPoint presspos; | 86 | QPoint presspos; |
87 | QWidget* qpe_main_widget; | 87 | QWidget* qpe_main_widget; |
88 | QString appName; | 88 | QString appName; |
89 | QString styleName; | 89 | QString styleName; |
90 | QString decorationName; | 90 | QString decorationName; |
91 | Atom wm_delete_window; | 91 | Atom wm_delete_window; |
92 | Atom wm_take_focus; | 92 | Atom wm_take_focus; |
93 | Atom wm_context_help; | 93 | Atom wm_context_help; |
94 | Atom wm_context_accept; | 94 | Atom wm_context_accept; |
95 | Atom wm_protocols; | 95 | Atom wm_protocols; |
96 | 96 | ||
97 | private: | 97 | private: |
98 | QList<QCopRec> qcopq; | 98 | QList<QCopRec> qcopq; |
99 | }; | 99 | }; |
100 | QPEApplication::Private::~Private() { | 100 | QPEApplication::Private::~Private() { |
101 | } | 101 | } |
102 | QPEApplication::Private::Private() | 102 | QPEApplication::Private::Private() |
103 | : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), | 103 | : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), |
104 | preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), | 104 | preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), |
105 | presswidget( 0 ), qpe_main_widget(0 ) { | 105 | presswidget( 0 ), qpe_main_widget(0 ) { |
106 | 106 | ||
107 | qcopq.setAutoDelete( TRUE ); | 107 | qcopq.setAutoDelete( TRUE ); |
108 | } | 108 | } |
109 | void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg, | 109 | void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg, |
110 | const QByteArray& ar ) { | 110 | const QByteArray& ar ) { |
111 | qcopq.append( new QCopRec(chan, msg, ar ) ); | 111 | qcopq.append( new QCopRec(chan, msg, ar ) ); |
112 | } | 112 | } |
113 | void QPEApplication::Private::sendQCopQ() { | 113 | void QPEApplication::Private::sendQCopQ() { |
114 | QCopRec* r; | 114 | QCopRec* r; |
115 | for ( r = qcopq.first(); r; r = qcopq.next() ) { | 115 | for ( r = qcopq.first(); r; r = qcopq.next() ) { |
116 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 116 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
117 | } | 117 | } |
118 | qcopq.clear(); | 118 | qcopq.clear(); |
119 | } | 119 | } |
120 | void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) { | 120 | void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) { |
121 | if (mw->layout() && mw->inherits("QDialog") ) { | 121 | if (mw->layout() && mw->inherits("QDialog") ) { |
122 | QPEApplication::showDialog( (QDialog*)mw, nomaximize ); | 122 | QPEApplication::showDialog( (QDialog*)mw, nomaximize ); |
123 | }else { | 123 | }else { |
124 | if (!nomaximize ) | 124 | if (!nomaximize ) |
125 | mw->showMaximized(); | 125 | mw->showMaximized(); |
126 | else | 126 | else |
127 | mw->show(); | 127 | mw->show(); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | void QPEApplication::Private::show( QWidget* mw, bool nomax ) { | 130 | void QPEApplication::Private::show( QWidget* mw, bool nomax ) { |
131 | nomaximize = nomax; | 131 | nomaximize = nomax; |
132 | qpe_main_widget = mw; | 132 | qpe_main_widget = mw; |
133 | 133 | ||
134 | sendQCopQ(); | 134 | sendQCopQ(); |
135 | 135 | ||
136 | if ( preloaded ) { | 136 | if ( preloaded ) { |
137 | if (forceshow ) | 137 | if (forceshow ) |
138 | show_mx(mw, nomax ); | 138 | show_mx(mw, nomax ); |
139 | }else if ( keep_running ) | 139 | }else if ( keep_running ) |
140 | show_mx( mw, nomax ); | 140 | show_mx( mw, nomax ); |
141 | } | 141 | } |
142 | void QPEApplication::Private::loadTextCodecs() { | 142 | void QPEApplication::Private::loadTextCodecs() { |
143 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; | 143 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; |
144 | QDir dir( path, "lib*.so" ); | 144 | QDir dir( path, "lib*.so" ); |
145 | QStringList list = dir.entryList(); | 145 | QStringList list = dir.entryList(); |
146 | QStringList::Iterator it; | 146 | QStringList::Iterator it; |
147 | for ( it = list.begin(); it != list.end(); ++it ) { | 147 | for ( it = list.begin(); it != list.end(); ++it ) { |
148 | TextCodecInterface *iface = 0; | 148 | TextCodecInterface *iface = 0; |
149 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 149 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
150 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 150 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
151 | QValueList<int> mibs = iface->mibEnums(); | 151 | QValueList<int> mibs = iface->mibEnums(); |
152 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 152 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
153 | (void)iface->createForMib(*i); | 153 | (void)iface->createForMib(*i); |
154 | // ### it exists now; need to remember if we can delete it | 154 | // ### it exists now; need to remember if we can delete it |
155 | } | 155 | } |
156 | } | 156 | } |
157 | else { | 157 | else { |
158 | lib->unload(); | 158 | lib->unload(); |
159 | delete lib; | 159 | delete lib; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | void QPEApplication::Private::loadImageCodecs() { | 163 | void QPEApplication::Private::loadImageCodecs() { |
164 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; | 164 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; |
165 | QDir dir( path, "lib*.so" ); | 165 | QDir dir( path, "lib*.so" ); |
166 | QStringList list = dir.entryList(); | 166 | QStringList list = dir.entryList(); |
167 | QStringList::Iterator it; | 167 | QStringList::Iterator it; |
168 | for ( it = list.begin(); it != list.end(); ++it ) { | 168 | for ( it = list.begin(); it != list.end(); ++it ) { |
169 | ImageCodecInterface *iface = 0; | 169 | ImageCodecInterface *iface = 0; |
170 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 170 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
171 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 171 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
172 | QStringList formats = iface->keys(); | 172 | QStringList formats = iface->keys(); |
173 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 173 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
174 | (void)iface->installIOHandler(*i); | 174 | (void)iface->installIOHandler(*i); |
175 | // ### it exists now; need to remember if we can delete it | 175 | // ### it exists now; need to remember if we can delete it |
176 | } | 176 | } |
177 | } | 177 | } |
178 | else { | 178 | else { |
179 | lib->unload(); | 179 | lib->unload(); |
180 | delete lib; | 180 | delete lib; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | // The Help System hook | 185 | // The Help System hook |
186 | namespace { | 186 | namespace { |
187 | class ResourceMimeFactory : public QMimeSourceFactory | 187 | class ResourceMimeFactory : public QMimeSourceFactory |
188 | { | 188 | { |
189 | public: | 189 | public: |
190 | ResourceMimeFactory(); | 190 | ResourceMimeFactory(); |
191 | ~ResourceMimeFactory(); | 191 | ~ResourceMimeFactory(); |
192 | const QMimeSource* data( const QString& abs_name )const; | 192 | const QMimeSource* data( const QString& abs_name )const; |
193 | }; | 193 | }; |
194 | ResourceMimeFactory::ResourceMimeFactory() | 194 | ResourceMimeFactory::ResourceMimeFactory() |
195 | { | 195 | { |
196 | setFilePath( Global::helpPath() ); | 196 | setFilePath( Global::helpPath() ); |
197 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 197 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
198 | } | 198 | } |
199 | ResourceMimeFactory::~ResourceMimeFactory() { | 199 | ResourceMimeFactory::~ResourceMimeFactory() { |
200 | } | 200 | } |
201 | 201 | ||
202 | const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const | 202 | const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const |
203 | { | 203 | { |
204 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 204 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
205 | if ( !r ) { | 205 | if ( !r ) { |
206 | int sl = abs_name.length(); | 206 | int sl = abs_name.length(); |
207 | do { | 207 | do { |
208 | sl = abs_name.findRev( '/', sl - 1 ); | 208 | sl = abs_name.findRev( '/', sl - 1 ); |
209 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 209 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
210 | int dot = name.findRev( '.' ); | 210 | int dot = name.findRev( '.' ); |
211 | if ( dot >= 0 ) | 211 | if ( dot >= 0 ) |
212 | name = name.left( dot ); | 212 | name = name.left( dot ); |
213 | QImage img = Resource::loadImage( name ); | 213 | QImage img = Resource::loadImage( name ); |
214 | if ( !img.isNull() ) | 214 | if ( !img.isNull() ) |
215 | r = new QImageDrag( img ); | 215 | r = new QImageDrag( img ); |
216 | } | 216 | } |
217 | while ( !r && sl > 0 ); | 217 | while ( !r && sl > 0 ); |
218 | } | 218 | } |
219 | return r; | 219 | return r; |
220 | }; | 220 | }; |
221 | }; | 221 | }; |
222 | // QPEApplication | 222 | // QPEApplication |
223 | QPEApplication::~QPEApplication() { | 223 | QPEApplication::~QPEApplication() { |
224 | qWarning("~QPEApplication"); | 224 | qWarning("~QPEApplication"); |
225 | ungrabKeyboard(); | 225 | ungrabKeyboard(); |
226 | qWarning("UngrabKeyboard"); | 226 | qWarning("UngrabKeyboard"); |
227 | 227 | ||
228 | // delete m_sys; | 228 | // delete m_sys; |
229 | // delete m_pid; | 229 | // delete m_pid; |
230 | 230 | ||
231 | delete d; | 231 | delete d; |
232 | } | 232 | } |
233 | QPEApplication::QPEApplication(int &arg, char** argv, Type t) | 233 | QPEApplication::QPEApplication(int &arg, char** argv, Type t) |
234 | : QApplication( arg, argv, t ) { | 234 | : QApplication( arg, argv, t ) { |
235 | d = new Private; | 235 | d = new Private; |
236 | d->loadTextCodecs(); | 236 | d->loadTextCodecs(); |
237 | d->loadImageCodecs(); | 237 | d->loadImageCodecs(); |
238 | 238 | ||
239 | // Init X-Atom | 239 | // Init X-Atom |
240 | Atom *atoms[5]; | 240 | Atom *atoms[5]; |
241 | Atom atoms_re[5]; | 241 | Atom atoms_re[5]; |
242 | char* names[5]; | 242 | char* names[5]; |
243 | int n = 0; | 243 | int n = 0; |
244 | atoms[n] = &d->wm_delete_window; | 244 | atoms[n] = &d->wm_delete_window; |
245 | names[n++] = "WM_DELETE_WINDOW"; | 245 | names[n++] = "WM_DELETE_WINDOW"; |
246 | 246 | ||
247 | atoms[n] = &d->wm_take_focus; | 247 | atoms[n] = &d->wm_take_focus; |
248 | names[n++] = "WM_TAKE_FOCUS"; | 248 | names[n++] = "WM_TAKE_FOCUS"; |
249 | 249 | ||
250 | atoms[n] = &d->wm_context_help; | 250 | atoms[n] = &d->wm_context_help; |
251 | names[n++] = "_NET_WM_CONTEXT_HELP"; | 251 | names[n++] = "_NET_WM_CONTEXT_HELP"; |
252 | 252 | ||
253 | atoms[n] = &d->wm_context_accept; | 253 | atoms[n] = &d->wm_context_accept; |
254 | names[n++] = "_NET_WM_CONTEXT_ACCEPT"; | 254 | names[n++] = "_NET_WM_CONTEXT_ACCEPT"; |
255 | 255 | ||
256 | atoms[n] = &d->wm_protocols; | 256 | atoms[n] = &d->wm_protocols; |
257 | names[n++] = "WM_PROTOCOLS"; | 257 | names[n++] = "WM_PROTOCOLS"; |
258 | 258 | ||
259 | XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); | 259 | XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); |
260 | // now copy the values over to the properties | 260 | // now copy the values over to the properties |
261 | for (int i = 0; i < n; i++ ) | 261 | for (int i = 0; i < n; i++ ) |
262 | *atoms[i] = atoms_re[i]; | 262 | *atoms[i] = atoms_re[i]; |
263 | // done with X11 Stuff | 263 | // done with X11 Stuff |
264 | 264 | ||
265 | int dw = desktop()->width(); | 265 | int dw = desktop()->width(); |
266 | if ( dw < 200 ) { | 266 | if ( dw < 200 ) { |
267 | setFont( QFont( "helvetica", 8 ) ); | 267 | setFont( QFont( "helvetica", 8 ) ); |
268 | AppLnk::setSmallIconSize( 10 ); | 268 | AppLnk::setSmallIconSize( 10 ); |
269 | AppLnk::setBigIconSize( 28 ); | 269 | AppLnk::setBigIconSize( 28 ); |
270 | }else if ( dw > 600 ) { | 270 | }else if ( dw > 600 ) { |
271 | setFont( QFont( "helvetica", 12 ) ); | 271 | setFont( QFont( "helvetica", 12 ) ); |
272 | AppLnk::setSmallIconSize( 24 ); | 272 | AppLnk::setSmallIconSize( 24 ); |
273 | AppLnk::setBigIconSize( 48 ); | 273 | AppLnk::setBigIconSize( 48 ); |
274 | }else if ( dw > 200 ) { | 274 | }else if ( dw > 200 ) { |
275 | setFont( QFont( "helvetica", 10 ) ); | 275 | setFont( QFont( "helvetica", 10 ) ); |
276 | AppLnk::setSmallIconSize( 16 ); | 276 | AppLnk::setSmallIconSize( 16 ); |
277 | AppLnk::setBigIconSize( 32 ); | 277 | AppLnk::setBigIconSize( 32 ); |
278 | } | 278 | } |
279 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 279 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
280 | 280 | ||
281 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); | 281 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); |
282 | 282 | ||
283 | QString qcopfn( "/tmp/qcop-msg-" ); | 283 | QString qcopfn( "/tmp/qcop-msg-" ); |
284 | qcopfn += QString( argv[0] ); // append command name to the QCOP name | 284 | qcopfn += QString( argv[0] ); // append command name to the QCOP name |
285 | QFile file( qcopfn ); | 285 | QFile file( qcopfn ); |
286 | if (file.open(IO_ReadOnly ) ) { | 286 | if (file.open(IO_ReadOnly ) ) { |
287 | flock( file.handle(), LOCK_EX ); | 287 | flock( file.handle(), LOCK_EX ); |
288 | } | 288 | } |
289 | 289 | ||
290 | /* Hmmm damn we need to make the parent 0l otherwise it get's deleted | 290 | /* Hmmm damn we need to make the parent 0l otherwise it get's deleted |
291 | * past the QApplication | 291 | * past the QApplication |
292 | */ | 292 | */ |
293 | m_sys = new QCopChannel( "QPE/System", 0l); | 293 | m_sys = new QCopChannel( "QPE/System", 0l); |
294 | connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ), | 294 | connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ), |
295 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); | 295 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); |
296 | 296 | ||
297 | // private channel QPE/Application/appname | 297 | // private channel QPE/Application/appname |
298 | QCString channel = QCString( argv[0] ); | 298 | QCString channel = QCString( argv[0] ); |
299 | channel.replace( QRegExp( ".*/"), "" ); | 299 | channel.replace( QRegExp( ".*/"), "" ); |
300 | d->appName = channel; | 300 | d->appName = channel; |
301 | channel = "QPE/Application/"+ channel; | 301 | channel = "QPE/Application/"+ channel; |
302 | m_pid = new QCopChannel( channel, 0l ); | 302 | m_pid = new QCopChannel( channel, 0l ); |
303 | connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ), | 303 | connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ), |
304 | this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); | 304 | this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); |
305 | 305 | ||
306 | // read the Pre QCOP Stuff from the file | 306 | // read the Pre QCOP Stuff from the file |
307 | if ( file.isOpen() ) { | 307 | if ( file.isOpen() ) { |
308 | d->keep_running = FALSE; | 308 | d->keep_running = FALSE; |
309 | QDataStream ds( &file ); | 309 | QDataStream ds( &file ); |
310 | QCString chanel, message; | 310 | QCString chanel, message; |
311 | QByteArray data; | 311 | QByteArray data; |
312 | while (!ds.atEnd() ) { | 312 | while (!ds.atEnd() ) { |
313 | ds >> chanel >> message >> data; | 313 | ds >> chanel >> message >> data; |
314 | d->enqueueQCop( chanel, message, data ); | 314 | d->enqueueQCop( chanel, message, data ); |
315 | } | 315 | } |
316 | flock( file.handle(), LOCK_UN ); | 316 | flock( file.handle(), LOCK_UN ); |
317 | file.close(); | 317 | file.close(); |
318 | file.remove(); | 318 | file.remove(); |
319 | } | 319 | } |
320 | 320 | ||
321 | // read in some stuff from the command line | 321 | // read in some stuff from the command line |
322 | // we do not have setArgs so we need to take | 322 | // we do not have setArgs so we need to take |
323 | // care of that | 323 | // care of that |
324 | for ( int a = 0; a < arg; a++ ) { | 324 | for ( int a = 0; a < arg; a++ ) { |
325 | if ( qstrcmp( argv[a], "-preload" ) == 0 ) { | 325 | if ( qstrcmp( argv[a], "-preload" ) == 0 ) { |
326 | d->preloaded = TRUE; | 326 | d->preloaded = TRUE; |
327 | }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { | 327 | }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { |
328 | d->preloaded = TRUE; | 328 | d->preloaded = TRUE; |
329 | d->forceshow = TRUE; | 329 | d->forceshow = TRUE; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | initTranslations(); | 332 | initTranslations(); |
333 | applyStyle(); | 333 | applyStyle(); |
334 | 334 | ||
335 | if ( type() == GuiServer ) | 335 | if ( type() == GuiServer ) |
336 | ; | 336 | ; |
337 | 337 | ||
338 | installEventFilter( this ); | 338 | installEventFilter( this ); |
339 | QPEMenuToolFocusManager::initialize(); | 339 | QPEMenuToolFocusManager::initialize(); |
340 | } | 340 | } |
341 | void QPEApplication::initTranslations() { | 341 | void QPEApplication::initTranslations() { |
342 | // Translations add it | 342 | // Translations add it |
343 | QStringList langs = Global::languageList(); | 343 | QStringList langs = Global::languageList(); |
344 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 344 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
345 | QString lang = *it; | 345 | QString lang = *it; |
346 | 346 | ||
347 | QTranslator * trans; | 347 | QTranslator * trans; |
348 | QString tfn; | 348 | QString tfn; |
349 | 349 | ||
350 | trans = new QTranslator( this ); | 350 | trans = new QTranslator( this ); |
351 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 351 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
352 | if ( trans->load( tfn ) ) | 352 | if ( trans->load( tfn ) ) |
353 | installTranslator( trans ); | 353 | installTranslator( trans ); |
354 | else | 354 | else |
355 | delete trans; | 355 | delete trans; |
356 | 356 | ||
357 | trans = new QTranslator( this ); | 357 | trans = new QTranslator( this ); |
358 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; | 358 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; |
359 | if ( trans->load( tfn ) ) | 359 | if ( trans->load( tfn ) ) |
360 | installTranslator( trans ); | 360 | installTranslator( trans ); |
361 | else | 361 | else |
362 | delete trans; | 362 | delete trans; |
363 | } | 363 | } |
364 | } | 364 | } |
365 | QString QPEApplication::qpeDir() { | 365 | QString QPEApplication::qpeDir() { |
366 | const char * base = getenv( "OPIEDIR" ); | 366 | const char * base = getenv( "OPIEDIR" ); |
367 | if ( base ) | 367 | if ( base ) |
368 | return QString( base ) + "/"; | 368 | return QString( base ) + "/"; |
369 | 369 | ||
370 | return QString( "../" ); | 370 | return QString( "../" ); |
371 | } | 371 | } |
372 | QString QPEApplication::documentDir() { | 372 | QString QPEApplication::documentDir() { |
373 | const char* base = getenv( "HOME"); | 373 | const char* base = getenv( "HOME"); |
374 | if ( base ) | 374 | if ( base ) |
375 | return QString( base ) + "/Documents"; | 375 | return QString( base ) + "/Documents"; |
376 | 376 | ||
377 | return QString( "../Documents" ); | 377 | return QString( "../Documents" ); |
378 | } | 378 | } |
379 | void QPEApplication::applyStyle() { | 379 | void QPEApplication::applyStyle() { |
380 | Config config( "qpe" ); | 380 | Config config( "qpe" ); |
381 | 381 | ||
382 | config.setGroup( "Appearance" ); | 382 | config.setGroup( "Appearance" ); |
383 | 383 | ||
384 | // Widget style | 384 | // Widget style |
385 | QString style = config.readEntry( "Style", "Light" ); | 385 | QString style = config.readEntry( "Style", "Light" ); |
386 | internalSetStyle( style ); | 386 | internalSetStyle( style ); |
387 | 387 | ||
388 | // Colors | 388 | // Colors |
389 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 389 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
390 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 390 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
391 | QPalette pal( btncolor, bgcolor ); | 391 | QPalette pal( btncolor, bgcolor ); |
392 | QString color = config.readEntry( "Highlight", "#800000" ); | 392 | QString color = config.readEntry( "Highlight", "#800000" ); |
393 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 393 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
394 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 394 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
395 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 395 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
396 | color = config.readEntry( "Text", "#000000" ); | 396 | color = config.readEntry( "Text", "#000000" ); |
397 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 397 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
398 | color = config.readEntry( "ButtonText", "#000000" ); | 398 | color = config.readEntry( "ButtonText", "#000000" ); |
399 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 399 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
400 | color = config.readEntry( "Base", "#FFFFFF" ); | 400 | color = config.readEntry( "Base", "#FFFFFF" ); |
401 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 401 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
402 | 402 | ||
403 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 403 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
404 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 404 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
405 | 405 | ||
406 | setPalette( pal, TRUE ); | 406 | setPalette( pal, TRUE ); |
407 | 407 | ||
408 | 408 | ||
409 | 409 | ||
410 | // Font | 410 | // Font |
411 | QString ff = config.readEntry( "FontFamily", font().family() ); | 411 | QString ff = config.readEntry( "FontFamily", font().family() ); |
412 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 412 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
413 | setFont( QFont(ff, fs) ); | 413 | setFont( QFont(ff, fs) ); |
414 | } | 414 | } |
415 | int QPEApplication::defaultRotation() { | 415 | int QPEApplication::defaultRotation() { |
416 | return 0; | 416 | return 0; |
417 | } | 417 | } |
418 | void QPEApplication::setDefaultRotation(int r ) { | 418 | void QPEApplication::setDefaultRotation(int) { |
419 | 419 | ||
420 | } | 420 | } |
421 | void QPEApplication::grabKeyboard() { | 421 | void QPEApplication::grabKeyboard() { |
422 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; | 422 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; |
423 | if ( qApp->type() == QApplication::GuiServer ) | 423 | if ( qApp->type() == QApplication::GuiServer ) |
424 | d->kbgrabber = 0; | 424 | d->kbgrabber = 0; |
425 | else { | 425 | else { |
426 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 426 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
427 | e << d->appName; | 427 | e << d->appName; |
428 | 428 | ||
429 | d->kbgrabber = 2; // me | 429 | d->kbgrabber = 2; // me |
430 | } | 430 | } |
431 | } | 431 | } |
432 | void QPEApplication::ungrabKeyboard() { | 432 | void QPEApplication::ungrabKeyboard() { |
433 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; | 433 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; |
434 | if ( d->kbgrabber == 2 ) { | 434 | if ( d->kbgrabber == 2 ) { |
435 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 435 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
436 | e << QString::null; | 436 | e << QString::null; |
437 | 437 | ||
438 | d->kbregrab = FALSE; | 438 | d->kbregrab = FALSE; |
439 | d->kbgrabber = 0; | 439 | d->kbgrabber = 0; |
440 | } | 440 | } |
441 | } | 441 | } |
442 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { | 442 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { |
443 | d->show(wid, b ); | 443 | d->show(wid, b ); |
444 | } | 444 | } |
445 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { | 445 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { |
446 | if ( mw && argc() == 2 ) | 446 | if ( mw && argc() == 2 ) |
447 | Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); | 447 | Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); |
448 | 448 | ||
449 | d->show(mw, m ); | 449 | d->show(mw, m ); |
450 | } | 450 | } |
451 | void QPEApplication::showDialog( QDialog* d, bool nomax ) { | 451 | void QPEApplication::showDialog( QDialog* d, bool nomax ) { |
452 | showWidget( d, nomax ); | ||
453 | } | ||
454 | int QPEApplication::execDialog( QDialog* d, bool nomax) { | ||
455 | showDialog(d,nomax); | ||
456 | return d->exec(); | ||
457 | } | ||
458 | |||
459 | void QPEApplication::showWidget( QWidget* d, bool nomax ) { | ||
452 | QSize sh = d->sizeHint(); | 460 | QSize sh = d->sizeHint(); |
453 | int w = QMAX(sh.width(),d->width()); | 461 | int w = QMAX(sh.width(),d->width()); |
454 | int h = QMAX(sh.height(),d->height()); | 462 | int h = QMAX(sh.height(),d->height()); |
455 | if ( !nomax | 463 | if ( !nomax |
456 | && ( w > qApp->desktop()->width()*3/4 | 464 | && ( w > qApp->desktop()->width()*3/4 |
457 | || h > qApp->desktop()->height()*3/4 ) ) | 465 | || h > qApp->desktop()->height()*3/4 ) ) |
458 | { | 466 | { |
459 | d->showMaximized(); | 467 | d->showMaximized(); |
460 | } else { | 468 | } else { |
461 | d->resize(w,h); | 469 | d->resize(w,h); |
462 | d->show(); | 470 | d->show(); |
463 | } | 471 | } |
464 | } | 472 | } |
465 | int QPEApplication::execDialog( QDialog* d, bool nomax) { | 473 | |
466 | showDialog(d,nomax); | ||
467 | return d->exec(); | ||
468 | } | ||
469 | void QPEApplication::setKeepRunning() { | 474 | void QPEApplication::setKeepRunning() { |
470 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 475 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
471 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 476 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
472 | qpeApp->d->keep_running = TRUE; | 477 | qpeApp->d->keep_running = TRUE; |
473 | } | 478 | } |
474 | } | 479 | } |
475 | bool QPEApplication::keepRunning()const { | 480 | bool QPEApplication::keepRunning()const { |
476 | return d->keep_running; | 481 | return d->keep_running; |
477 | } | 482 | } |
478 | bool QPEApplication::keyboardGrabbed()const { | 483 | bool QPEApplication::keyboardGrabbed()const { |
479 | return d->kbgrabber; | 484 | return d->kbgrabber; |
480 | } | 485 | } |
481 | int QPEApplication::exec() { | 486 | int QPEApplication::exec() { |
482 | /* now send the QCOP stuff gotten from the file */ | 487 | /* now send the QCOP stuff gotten from the file */ |
483 | d->sendQCopQ(); | 488 | d->sendQCopQ(); |
484 | 489 | ||
485 | if ( d->keep_running ) { | 490 | if ( d->keep_running ) { |
486 | qWarning("going to exec"); | 491 | qWarning("going to exec"); |
487 | int a = QApplication::exec(); | 492 | int a = QApplication::exec(); |
488 | qWarning("left"); | 493 | qWarning("left"); |
489 | return a; | 494 | return a; |
490 | } | 495 | } |
491 | 496 | ||
492 | { | 497 | { |
493 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 498 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
494 | e << d->appName; | 499 | e << d->appName; |
495 | } | 500 | } |
496 | qWarning("processing events!"); | 501 | qWarning("processing events!"); |
497 | processEvents(); | 502 | processEvents(); |
498 | return 0; | 503 | return 0; |
499 | } | 504 | } |
500 | void QPEApplication::internalSetStyle( const QString& ) { | 505 | void QPEApplication::internalSetStyle( const QString& ) { |
501 | 506 | ||
502 | } | 507 | } |
503 | void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) { | 508 | void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) { |
504 | qWarning("QPEApplication::systemMessage( %s )", chan.data() ); | 509 | qWarning("QPEApplication::systemMessage( %s )", chan.data() ); |
505 | } | 510 | } |
506 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& ) { | 511 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& ) { |
507 | if ( msg == "flush()" ) { | 512 | if ( msg == "flush()" ) { |
508 | emit flush(); | 513 | emit flush(); |
509 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 514 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
510 | e << d->appName; | 515 | e << d->appName; |
511 | }else if ( msg == "reload()" ) { | 516 | }else if ( msg == "reload()" ) { |
512 | emit reload(); | 517 | emit reload(); |
513 | } | 518 | } |
514 | 519 | ||
515 | } | 520 | } |
516 | void QPEApplication::timerEvent( QTimerEvent* e ) { | 521 | void QPEApplication::timerEvent( QTimerEvent* e ) { |
517 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 522 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
518 | // Right pressed | 523 | // Right pressed |
519 | postEvent( d->presswidget, | 524 | postEvent( d->presswidget, |
520 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 525 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
521 | RightButton, LeftButton ) ); | 526 | RightButton, LeftButton ) ); |
522 | killTimer( d->presstimer ); | 527 | killTimer( d->presstimer ); |
523 | d->presstimer = 0; | 528 | d->presstimer = 0; |
524 | } | 529 | } |
525 | } | 530 | } |
526 | 531 | ||
527 | // InputMethods Hints | 532 | // InputMethods Hints |
528 | namespace { | 533 | namespace { |
529 | static QPtrDict<void>* inputMethodDict = 0; | 534 | static QPtrDict<void>* inputMethodDict = 0; |
530 | static void createInputMethodDict(){ | 535 | static void createInputMethodDict(){ |
531 | if ( !inputMethodDict ) | 536 | if ( !inputMethodDict ) |
532 | inputMethodDict = new QPtrDict<void>; | 537 | inputMethodDict = new QPtrDict<void>; |
533 | } | 538 | } |
534 | 539 | ||
535 | static QPtrDict<void>* stylusDict = 0; | 540 | static QPtrDict<void>* stylusDict = 0; |
536 | static void createDict() { | 541 | static void createDict() { |
537 | if ( !stylusDict ) | 542 | if ( !stylusDict ) |
538 | stylusDict = new QPtrDict<void>; | 543 | stylusDict = new QPtrDict<void>; |
539 | } | 544 | } |
540 | }; | 545 | }; |
541 | 546 | ||
542 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { | 547 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { |
543 | createInputMethodDict(); | 548 | createInputMethodDict(); |
544 | if ( mode == Normal ) { | 549 | if ( mode == Normal ) { |
545 | inputMethodDict->remove | 550 | inputMethodDict->remove |
546 | ( w ); | 551 | ( w ); |
547 | }else { | 552 | }else { |
548 | inputMethodDict->insert( w, ( void* ) mode ); | 553 | inputMethodDict->insert( w, ( void* ) mode ); |
549 | } | 554 | } |
550 | } | 555 | } |
551 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) { | 556 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) { |
552 | if ( inputMethodDict && w ) | 557 | if ( inputMethodDict && w ) |
553 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 558 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
554 | return Normal; | 559 | return Normal; |
555 | } | 560 | } |
556 | 561 | ||
557 | 562 | ||
558 | void QPEApplication::removeSenderFromStylusDict() { | 563 | void QPEApplication::removeSenderFromStylusDict() { |
559 | stylusDict->remove( ( void* ) sender() ); | 564 | stylusDict->remove( ( void* ) sender() ); |
560 | if ( d->presswidget == sender() ) | 565 | if ( d->presswidget == sender() ) |
561 | d->presswidget = 0; | 566 | d->presswidget = 0; |
562 | } | 567 | } |
563 | void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { | 568 | void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { |
564 | createDict(); | 569 | createDict(); |
565 | if ( mode == LeftOnly ) { | 570 | if ( mode == LeftOnly ) { |
566 | stylusDict->remove | 571 | stylusDict->remove |
567 | ( w ); | 572 | ( w ); |
568 | w->removeEventFilter( qApp ); | 573 | w->removeEventFilter( qApp ); |
569 | }else { | 574 | }else { |
570 | stylusDict->insert( w, ( void* ) mode ); | 575 | stylusDict->insert( w, ( void* ) mode ); |
571 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 576 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
572 | w->installEventFilter( qApp ); | 577 | w->installEventFilter( qApp ); |
573 | } | 578 | } |
574 | } | 579 | } |
575 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { | 580 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { |
576 | if ( stylusDict ) | 581 | if ( stylusDict ) |
577 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 582 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
578 | return LeftOnly; | 583 | return LeftOnly; |
579 | } | 584 | } |
580 | 585 | ||
581 | // eventFilter...... | 586 | // eventFilter...... |
582 | bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { | 587 | bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { |
583 | /* | 588 | /* |
584 | * We want our WM to show Ok and a X button | 589 | * We want our WM to show Ok and a X button |
585 | * on dialogs | 590 | * on dialogs |
586 | * our part is to set the _NET_WM_CONTEXT_ACCEPT | 591 | * our part is to set the _NET_WM_CONTEXT_ACCEPT |
587 | * propery | 592 | * propery |
588 | * and then wait for a client message -zecke | 593 | * and then wait for a client message -zecke |
589 | * on show we will add the prop | 594 | * on show we will add the prop |
590 | */ | 595 | */ |
591 | if (o->inherits("QDialog") && e->type() == QEvent::Show ) { | 596 | if (o->inherits("QDialog") && e->type() == QEvent::Show ) { |
592 | QDialog* dialog = (QDialog*)o; | 597 | QDialog* dialog = (QDialog*)o; |
593 | Atom wm_prot[45]; | 598 | Atom wm_prot[45]; |
594 | int n = 0; | 599 | int n = 0; |
595 | wm_prot[n++] = d->wm_delete_window; | 600 | wm_prot[n++] = d->wm_delete_window; |
596 | wm_prot[n++] = d->wm_take_focus; | 601 | wm_prot[n++] = d->wm_take_focus; |
597 | wm_prot[n++] = d->wm_context_accept; | 602 | wm_prot[n++] = d->wm_context_accept; |
598 | if ( dialog->testWFlags( WStyle_ContextHelp ) ) | 603 | if ( dialog->testWFlags( WStyle_ContextHelp ) ) |
599 | wm_prot[n++] = d->wm_context_help; | 604 | wm_prot[n++] = d->wm_context_help; |
600 | XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n ); | 605 | XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n ); |
601 | return TRUE; // should be save | 606 | return TRUE; // should be save |
602 | } | 607 | } |
603 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 608 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
604 | QMouseEvent * me = ( QMouseEvent* ) e; | 609 | QMouseEvent * me = ( QMouseEvent* ) e; |
605 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 610 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
606 | switch (mode) { | 611 | switch (mode) { |
607 | case RightOnHold: | 612 | case RightOnHold: |
608 | switch ( me->type() ) { | 613 | switch ( me->type() ) { |
609 | case QEvent::MouseButtonPress: | 614 | case QEvent::MouseButtonPress: |
610 | if ( me->button() == LeftButton ) { | 615 | if ( me->button() == LeftButton ) { |
611 | d->presstimer = startTimer(500); // #### pref. | 616 | d->presstimer = startTimer(500); // #### pref. |
612 | d->presswidget = (QWidget*)o; | 617 | d->presswidget = (QWidget*)o; |
613 | d->presspos = me->pos(); | 618 | d->presspos = me->pos(); |
614 | d->rightpressed = FALSE; | 619 | d->rightpressed = FALSE; |
615 | } | 620 | } |
616 | break; | 621 | break; |
617 | case QEvent::MouseMove: | 622 | case QEvent::MouseMove: |
618 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 623 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
619 | killTimer(d->presstimer); | 624 | killTimer(d->presstimer); |
620 | d->presstimer = 0; | 625 | d->presstimer = 0; |
621 | } | 626 | } |
622 | break; | 627 | break; |
623 | case QEvent::MouseButtonRelease: | 628 | case QEvent::MouseButtonRelease: |
624 | if ( me->button() == LeftButton ) { | 629 | if ( me->button() == LeftButton ) { |
625 | if ( d->presstimer ) { | 630 | if ( d->presstimer ) { |
626 | killTimer(d->presstimer); | 631 | killTimer(d->presstimer); |
627 | d->presstimer = 0; | 632 | d->presstimer = 0; |
628 | } | 633 | } |
629 | if ( d->rightpressed && d->presswidget ) { | 634 | if ( d->rightpressed && d->presswidget ) { |
630 | // Right released | 635 | // Right released |
631 | postEvent( d->presswidget, | 636 | postEvent( d->presswidget, |
632 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 637 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
633 | RightButton, LeftButton + RightButton ) ); | 638 | RightButton, LeftButton + RightButton ) ); |
634 | // Left released, off-widget | 639 | // Left released, off-widget |
635 | postEvent( d->presswidget, | 640 | postEvent( d->presswidget, |
636 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 641 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
637 | LeftButton, LeftButton ) ); | 642 | LeftButton, LeftButton ) ); |
638 | postEvent( d->presswidget, | 643 | postEvent( d->presswidget, |
639 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 644 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
640 | LeftButton, LeftButton ) ); | 645 | LeftButton, LeftButton ) ); |
641 | d->rightpressed = FALSE; | 646 | d->rightpressed = FALSE; |
642 | return TRUE; // don't send the real Left release | 647 | return TRUE; // don't send the real Left release |
643 | } | 648 | } |
644 | } | 649 | } |
645 | break; | 650 | break; |
646 | default: | 651 | default: |
647 | break; | 652 | break; |
648 | } | 653 | } |
649 | break; | 654 | break; |
650 | default: | 655 | default: |
651 | ; | 656 | ; |
652 | } | 657 | } |
653 | } | 658 | } |
654 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 659 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
655 | QKeyEvent *ke = (QKeyEvent *)e; | 660 | QKeyEvent *ke = (QKeyEvent *)e; |
656 | if ( ke->key() == Key_Enter ) { | 661 | if ( ke->key() == Key_Enter ) { |
657 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 662 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
658 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 663 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
659 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 664 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
660 | return TRUE; | 665 | return TRUE; |
661 | } | 666 | } |
662 | } | 667 | } |
663 | } | 668 | } |
664 | return FALSE; | 669 | return FALSE; |
665 | } | 670 | } |
666 | 671 | ||
667 | // Quit stuff | 672 | // Quit stuff |
668 | void QPEApplication::restart() { | 673 | void QPEApplication::restart() { |
669 | 674 | ||
670 | } | 675 | } |
671 | void QPEApplication::shutdown() { | 676 | void QPEApplication::shutdown() { |
672 | 677 | ||
673 | } | 678 | } |
674 | void QPEApplication::tryQuit() { | 679 | void QPEApplication::tryQuit() { |
675 | qWarning("TryQuit!!"); | 680 | qWarning("TryQuit!!"); |
676 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 681 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
677 | return ; // Inside modal loop or konsole. Too hard to save state. | 682 | return ; // Inside modal loop or konsole. Too hard to save state. |
678 | { | 683 | { |
679 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 684 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
680 | e << d->appName; | 685 | e << d->appName; |
681 | } | 686 | } |
682 | processEvents(); | 687 | processEvents(); |
683 | 688 | ||
684 | quit(); | 689 | quit(); |
685 | } | 690 | } |
686 | void QPEApplication::hideOrQuit() { | 691 | void QPEApplication::hideOrQuit() { |
687 | qWarning("hide or close"); | 692 | qWarning("hide or close"); |
688 | processEvents(); | 693 | processEvents(); |
689 | qWarning("past processing"); | 694 | qWarning("past processing"); |
690 | 695 | ||
691 | // If we are a preloaded application we don't actually quit, so emit | 696 | // If we are a preloaded application we don't actually quit, so emit |
692 | // a System message indicating we're quasi-closing. | 697 | // a System message indicating we're quasi-closing. |
693 | if ( d->preloaded && d->qpe_main_widget ) | 698 | if ( d->preloaded && d->qpe_main_widget ) |
694 | 699 | ||
695 | { | 700 | { |
696 | qWarning("hiding"); | 701 | qWarning("hiding"); |
697 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 702 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
698 | e << d->appName; | 703 | e << d->appName; |
699 | d->qpe_main_widget->hide(); | 704 | d->qpe_main_widget->hide(); |
700 | } | 705 | } |
701 | else | 706 | else |
702 | quit(); | 707 | quit(); |
703 | } | 708 | } |
704 | 709 | ||
705 | /*! | 710 | /*! |
706 | \internal | 711 | \internal |
707 | */ | 712 | */ |
708 | void QPEApplication::prepareForTermination( bool willrestart ) | 713 | void QPEApplication::prepareForTermination( bool willrestart ) |
709 | { | 714 | { |
710 | if ( willrestart ) { | 715 | if ( willrestart ) { |
711 | // Draw a big wait icon, the image can be altered in later revisions | 716 | // Draw a big wait icon, the image can be altered in later revisions |
712 | // QWidget *d = QApplication::desktop(); | 717 | // QWidget *d = QApplication::desktop(); |
713 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 718 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
714 | QPixmap pix; | 719 | QPixmap pix; |
715 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 720 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
716 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 721 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
717 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 722 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
718 | lblWait->setPixmap( pix ); | 723 | lblWait->setPixmap( pix ); |
719 | lblWait->setAlignment( QWidget::AlignCenter ); | 724 | lblWait->setAlignment( QWidget::AlignCenter ); |
720 | lblWait->show(); | 725 | lblWait->show(); |
721 | lblWait->showMaximized(); | 726 | lblWait->showMaximized(); |
722 | } | 727 | } |
723 | #ifndef SINGLE_APP | 728 | #ifndef SINGLE_APP |
724 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 729 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
725 | } | 730 | } |
726 | processEvents(); // ensure the message goes out. | 731 | processEvents(); // ensure the message goes out. |
727 | sleep( 1 ); // You have 1 second to comply. | 732 | sleep( 1 ); // You have 1 second to comply. |
728 | #endif | 733 | #endif |
729 | } | 734 | } |
730 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { | 735 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { |
731 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); | 736 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); |
732 | if ( event->type == ClientMessage ) { | 737 | if ( event->type == ClientMessage ) { |
733 | if ( (event->xclient.message_type == d->wm_protocols) && | 738 | if ( (event->xclient.message_type == d->wm_protocols) && |
734 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { | 739 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { |
735 | qWarning("accepted!!!"); | 740 | qWarning("accepted!!!"); |
736 | /* | 741 | /* |
737 | * I'm not sure if we should use activeWidget | 742 | * I'm not sure if we should use activeWidget |
738 | * or activeModalWidget | 743 | * or activeModalWidget |
739 | * a QDialog could be not modal too | 744 | * a QDialog could be not modal too |
740 | */ | 745 | */ |
741 | if ( w->inherits("QDialog" ) ) { | 746 | if ( w->inherits("QDialog" ) ) { |
742 | qWarning("inherits QDialog!!!"); | 747 | qWarning("inherits QDialog!!!"); |
743 | QDialog* dia = (QDialog*)w; | 748 | QDialog* dia = (QDialog*)w; |
744 | /* | 749 | /* |
745 | * call it directly or via QTimer::singleShot? | 750 | * call it directly or via QTimer::singleShot? |
746 | */ | 751 | */ |
747 | QTimer::singleShot(0, dia, SLOT(accept() ) ); | 752 | QTimer::singleShot(0, dia, SLOT(accept() ) ); |
748 | return 0; | 753 | return 0; |
749 | } | 754 | } |
750 | 755 | ||
751 | } | 756 | } |
752 | } | 757 | } |
753 | return QApplication::x11ClientMessage(w, event, b ); | 758 | return QApplication::x11ClientMessage(w, event, b ); |
754 | } | 759 | } |
755 | 760 | ||
756 | #define KeyPress XKeyPress | 761 | #define KeyPress XKeyPress |
757 | #define KeyRelease XKeyRelease | 762 | #define KeyRelease XKeyRelease |
758 | 763 | ||
759 | #if defined(OPIE_NEW_MALLOC) | 764 | #if defined(OPIE_NEW_MALLOC) |
765 | #define likely(x) x | ||
760 | 766 | ||
761 | // The libraries with the skiff package (and possibly others) have | 767 | // The libraries with the skiff package (and possibly others) have |
762 | // completely useless implementations of builtin new and delete that | 768 | // completely useless implementations of builtin new and delete that |
763 | // use about 50% of your CPU. Here we revert to the simple libc | 769 | // use about 50% of your CPU. Here we revert to the simple libc |
764 | // functions. | 770 | // functions. |
765 | 771 | ||
766 | void* operator new[]( size_t size ) | 772 | void* operator new[]( size_t size ) |
767 | { | 773 | { |
768 | return malloc( size ); | 774 | return malloc( size ); |
769 | } | 775 | } |
770 | 776 | ||
771 | void* operator new( size_t size ) | 777 | void* operator new( size_t size ) |
772 | { | 778 | { |
773 | return malloc( size ); | 779 | return malloc( size ); |
774 | } | 780 | } |
775 | 781 | ||
776 | void operator delete[]( void* p ) | 782 | void operator delete[]( void* p ) |
777 | { | 783 | { |
784 | if ( likely(p) ) | ||
778 | free( p ); | 785 | free( p ); |
779 | } | 786 | } |
780 | 787 | ||
781 | void operator delete[]( void* p, size_t /*size*/ ) | 788 | void operator delete[]( void* p, size_t /*size*/ ) |
782 | { | 789 | { |
790 | if ( likely(p) ) | ||
783 | free( p ); | 791 | free( p ); |
784 | } | 792 | } |
785 | 793 | ||
786 | void operator delete( void* p ) | 794 | void operator delete( void* p ) |
787 | { | 795 | { |
796 | if ( likely(p) ) | ||
788 | free( p ); | 797 | free( p ); |
789 | } | 798 | } |
790 | 799 | ||
791 | void operator delete( void* p, size_t /*size*/ ) | 800 | void operator delete( void* p, size_t /*size*/ ) |
792 | { | 801 | { |
802 | if ( likely(p) ) | ||
793 | free( p ); | 803 | free( p ); |
794 | } | 804 | } |
795 | 805 | ||
796 | #endif | 806 | #endif |
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h index b1fc074..5521998 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.h +++ b/x11/libqpe-x11/qpe/qpeapplication.h | |||
@@ -1,105 +1,107 @@ | |||
1 | #ifndef OPIE_QPE_APPLICATION_H | 1 | #ifndef OPIE_QPE_APPLICATION_H |
2 | #define OPIE_QPE_APPLICATION_H | 2 | #define OPIE_QPE_APPLICATION_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * LGPLed | 5 | * LGPLed |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | #include <qevent.h> | 9 | #include <qevent.h> |
10 | 10 | #include <qtopia/timestring.h> | |
11 | #include <qpe/timestring.h> | 11 | #include <unistd.h> |
12 | #include <stdlib.h> | ||
12 | 13 | ||
13 | class QCopChannel; | 14 | class QCopChannel; |
14 | class QPEApplication : public QApplication { | 15 | class QPEApplication : public QApplication { |
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | public: | 17 | public: |
17 | QPEApplication(int& argc, char** argv, Type=GuiClient ); | 18 | QPEApplication(int& argc, char** argv, Type=GuiClient ); |
18 | ~QPEApplication(); | 19 | ~QPEApplication(); |
19 | 20 | ||
20 | 21 | ||
21 | static QString qpeDir(); | 22 | static QString qpeDir(); |
22 | static QString documentDir(); | 23 | static QString documentDir(); |
23 | void applyStyle(); | 24 | void applyStyle(); |
24 | 25 | ||
25 | static int defaultRotation(); | 26 | static int defaultRotation(); |
26 | static void setDefaultRotation( int r ); | 27 | static void setDefaultRotation( int r ); |
27 | static void grabKeyboard(); | 28 | static void grabKeyboard(); |
28 | static void ungrabKeyboard(); | 29 | static void ungrabKeyboard(); |
29 | 30 | ||
30 | enum StylusMode { | 31 | enum StylusMode { |
31 | LeftOnly, | 32 | LeftOnly, |
32 | RightOnHold | 33 | RightOnHold |
33 | }; | 34 | }; |
34 | static void setStylusOperation( QWidget*, StylusMode ); | 35 | static void setStylusOperation( QWidget*, StylusMode ); |
35 | static StylusMode stylusOperation( QWidget* ); | 36 | static StylusMode stylusOperation( QWidget* ); |
36 | 37 | ||
37 | enum InputMethodHint { | 38 | enum InputMethodHint { |
38 | Normal, | 39 | Normal, |
39 | AlwaysOff, | 40 | AlwaysOff, |
40 | AlwaysOn | 41 | AlwaysOn |
41 | }; | 42 | }; |
42 | static void setInputMethodHint( QWidget*, InputMethodHint ); | 43 | static void setInputMethodHint( QWidget*, InputMethodHint ); |
43 | static InputMethodHint inputMethodHint( QWidget* ); | 44 | static InputMethodHint inputMethodHint( QWidget* ); |
44 | 45 | ||
45 | void showMainWidget( QWidget*, bool nomax = FALSE ); | 46 | void showMainWidget( QWidget*, bool nomax = FALSE ); |
46 | void showMainDocumentWidget( QWidget*, bool nomax = FALSE ); | 47 | void showMainDocumentWidget( QWidget*, bool nomax = FALSE ); |
47 | 48 | ||
48 | static void showDialog( QDialog*, bool nomax = FALSE ); | 49 | static void showDialog( QDialog*, bool nomax = FALSE ); |
49 | static int execDialog( QDialog*, bool nomax = FALSE ); | 50 | static int execDialog ( QDialog*, bool nomax = FALSE ); |
51 | static void showWidget( QWidget*, bool nomax = FALSE ); | ||
50 | 52 | ||
51 | static void setKeepRunning(); | 53 | static void setKeepRunning(); |
52 | bool keepRunning()const; | 54 | bool keepRunning()const; |
53 | 55 | ||
54 | bool keyboardGrabbed()const; | 56 | bool keyboardGrabbed()const; |
55 | int exec(); | 57 | int exec(); |
56 | 58 | ||
57 | // QWS bits | 59 | // QWS bits |
58 | enum screenSaverHint { | 60 | enum screenSaverHint { |
59 | Disable = 0, | 61 | Disable = 0, |
60 | DisableLightOff = 1, | 62 | DisableLightOff = 1, |
61 | DisableSuspend = 2, | 63 | DisableSuspend = 2, |
62 | Enable = 100 | 64 | Enable = 100 |
63 | }; | 65 | }; |
64 | /* reimplemented for internal purposes */ | 66 | /* reimplemented for internal purposes */ |
65 | int x11ClientMessage( QWidget*, XEvent*, bool ); | 67 | int x11ClientMessage( QWidget*, XEvent*, bool ); |
66 | 68 | ||
67 | signals: | 69 | signals: |
68 | void clientMoused(); | 70 | void clientMoused(); |
69 | void timeChanged(); | 71 | void timeChanged(); |
70 | void clockChanged( bool pm ); | 72 | void clockChanged( bool pm ); |
71 | void micChanged( bool muted ); | 73 | void micChanged( bool muted ); |
72 | void volumeChanged( bool muted ); | 74 | void volumeChanged( bool muted ); |
73 | void appMessage( const QCString& msg, const QByteArray& data); | 75 | void appMessage( const QCString& msg, const QByteArray& data); |
74 | void weekChanged( bool startOnMonday ); | 76 | void weekChanged( bool startOnMonday ); |
75 | void dateFormatChanged( DateFormat ); | 77 | void dateFormatChanged( DateFormat ); |
76 | void flush(); | 78 | void flush(); |
77 | void reload(); | 79 | void reload(); |
78 | 80 | ||
79 | private: | 81 | private: |
80 | void initTranslations(); | 82 | void initTranslations(); |
81 | void internalSetStyle(const QString&); | 83 | void internalSetStyle(const QString&); |
82 | 84 | ||
83 | private slots: | 85 | private slots: |
84 | void hideOrQuit(); | 86 | void hideOrQuit(); |
85 | void systemMessage( const QCString&, const QByteArray& ); | 87 | void systemMessage( const QCString&, const QByteArray& ); |
86 | void pidMessage( const QCString&, const QByteArray& ); | 88 | void pidMessage( const QCString&, const QByteArray& ); |
87 | void removeSenderFromStylusDict(); | 89 | void removeSenderFromStylusDict(); |
88 | protected: | 90 | protected: |
89 | virtual void restart(); | 91 | virtual void restart(); |
90 | virtual void shutdown(); | 92 | virtual void shutdown(); |
91 | void prepareForTermination(bool willrestart); | 93 | void prepareForTermination(bool willrestart); |
92 | bool eventFilter( QObject*, QEvent* ); | 94 | bool eventFilter( QObject*, QEvent* ); |
93 | void timerEvent( QTimerEvent* ); | 95 | void timerEvent( QTimerEvent* ); |
94 | void raiseAppropriateWindow(); | 96 | void raiseAppropriateWindow(); |
95 | virtual void tryQuit(); | 97 | virtual void tryQuit(); |
96 | 98 | ||
97 | private: | 99 | private: |
98 | class Private; | 100 | class Private; |
99 | Private* d; | 101 | Private* d; |
100 | QCopChannel *m_sys; | 102 | QCopChannel *m_sys; |
101 | QCopChannel *m_pid; | 103 | QCopChannel *m_pid; |
102 | }; | 104 | }; |
103 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 105 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
104 | 106 | ||
105 | #endif | 107 | #endif |
diff --git a/x11/libqpe-x11/qt/qwindowsystem_qws.h b/x11/libqpe-x11/qt/qwindowsystem_qws.h index 88902c8..42470cd 100644 --- a/x11/libqpe-x11/qt/qwindowsystem_qws.h +++ b/x11/libqpe-x11/qt/qwindowsystem_qws.h | |||
@@ -1,37 +1,40 @@ | |||
1 | #ifndef OPIE_QWINDOWSYSTEM_H | 1 | #ifndef OPIE_QWINDOWSYSTEM_H |
2 | #define OPIE_QWINDOWSYSTEM_H | 2 | #define OPIE_QWINDOWSYSTEM_H |
3 | 3 | ||
4 | #include <qimage.h> | 4 | #include <qimage.h> |
5 | 5 | ||
6 | class QWSScreenSaver; | 6 | class QWSScreenSaver; |
7 | class QWSServer { | 7 | class QWSServer { |
8 | public: | 8 | public: |
9 | QWSServer(){} | 9 | QWSServer(){} |
10 | ~QWSServer(){} | 10 | ~QWSServer(){} |
11 | static void sendKeyEvent(int, int, int, bool, bool ) { } | 11 | static void sendKeyEvent(int, int, int, bool, bool ) { } |
12 | struct KeyboardFilter { | 12 | struct KeyboardFilter { |
13 | bool filter(int,int,int,bool,bool) { | ||
14 | return false; | ||
15 | } | ||
13 | }; | 16 | }; |
14 | static void setKeyboardFilter( KeyboardFilter* ) { | 17 | static void setKeyboardFilter( KeyboardFilter* ) { |
15 | 18 | ||
16 | } | 19 | } |
17 | static void setScreenSaver( QWSScreenSaver* ) { | 20 | static void setScreenSaver( QWSScreenSaver* ) { |
18 | 21 | ||
19 | } | 22 | } |
20 | static void setScreenSaverInterval( int ) { | 23 | static void setScreenSaverInterval( int ) { |
21 | 24 | ||
22 | } | 25 | } |
23 | static void setScreenSaverIntervals( int[] ) { | 26 | static void setScreenSaverIntervals( int[] ) { |
24 | 27 | ||
25 | } | 28 | } |
26 | static void screenSaverActivate( bool ) { | 29 | static void screenSaverActivate( bool ) { |
27 | 30 | ||
28 | } | 31 | } |
29 | static void setDesktopBackground( const QImage& ) { | 32 | static void setDesktopBackground( const QImage& ) { |
30 | 33 | ||
31 | } | 34 | } |
32 | 35 | ||
33 | }; | 36 | }; |
34 | struct QWSScreenSaver { | 37 | struct QWSScreenSaver { |
35 | }; | 38 | }; |
36 | 39 | ||
37 | #endif | 40 | #endif |