author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 30 | 5dc02b23752f |
child 37 | 758a864f9613 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
0 | 8 |
** |
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "qapplication_p.h" |
|
43 |
#include "qsessionmanager.h" |
|
44 |
#include "qevent.h" |
|
45 |
#include "qsymbianevent.h" |
|
46 |
#include "qeventdispatcher_s60_p.h" |
|
47 |
#include "qwidget.h" |
|
48 |
#include "qdesktopwidget.h" |
|
49 |
#include "private/qbackingstore_p.h" |
|
50 |
#include "qt_s60_p.h" |
|
51 |
#include "private/qevent_p.h" |
|
52 |
#include "qstring.h" |
|
53 |
#include "qdebug.h" |
|
54 |
#include "qimage.h" |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
55 |
#include "qcombobox.h" |
0 | 56 |
#include "private/qkeymapper_p.h" |
57 |
#include "private/qfont_p.h" |
|
58 |
#ifndef QT_NO_STYLE_S60 |
|
59 |
#include "private/qs60style_p.h" |
|
60 |
#endif |
|
61 |
#include "private/qwindowsurface_s60_p.h" |
|
62 |
#include "qpaintengine.h" |
|
63 |
#include "private/qmenubar_p.h" |
|
64 |
#include "private/qsoftkeymanager_p.h" |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
65 |
#ifdef QT_GRAPHICSSYSTEM_RUNTIME |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
66 |
#include "private/qgraphicssystem_runtime_p.h" |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
67 |
#endif |
0 | 68 |
|
69 |
#include "apgwgnam.h" // For CApaWindowGroupName |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
#include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility |
0 | 71 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
72 |
#if defined(Q_OS_SYMBIAN) |
0 | 73 |
# include <private/qs60mainapplication_p.h> |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
74 |
# include <centralrepository.h> |
23
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
75 |
# include "qs60mainappui.h" |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
76 |
# include "qinputcontext.h" |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
77 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
78 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
79 |
#if defined(Q_WS_S60) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
80 |
# if !defined(QT_NO_IM) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
81 |
# include <private/qcoefepinputcontext_p.h> |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
82 |
# endif |
0 | 83 |
#endif |
84 |
||
85 |
#include "private/qstylesheetstyle_p.h" |
|
86 |
||
87 |
#include <hal.h> |
|
88 |
#include <hal_data.h> |
|
89 |
||
90 |
QT_BEGIN_NAMESPACE |
|
91 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
92 |
// Goom Events through Window Server |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
93 |
static const int KGoomMemoryLowEvent = 0x10282DBF; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
94 |
static const int KGoomMemoryGoodEvent = 0x20026790; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
95 |
|
0 | 96 |
#if defined(QT_DEBUG) |
97 |
static bool appNoGrab = false; // Grabbing enabled |
|
98 |
#endif |
|
99 |
static bool app_do_modal = false; // modal mode |
|
100 |
Q_GLOBAL_STATIC(QS60Data, qt_s60Data); |
|
101 |
||
102 |
extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); |
|
103 |
extern QWidgetList *qt_modal_stack; // stack of modal widgets |
|
104 |
extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp |
|
105 |
||
106 |
QWidget *qt_button_down = 0; // widget got last button-down |
|
107 |
||
108 |
QSymbianControl *QSymbianControl::lastFocusedControl = 0; |
|
109 |
||
110 |
QS60Data* qGlobalS60Data() |
|
111 |
{ |
|
112 |
return qt_s60Data(); |
|
113 |
} |
|
114 |
||
115 |
bool qt_nograb() // application no-grab option |
|
116 |
{ |
|
117 |
#if defined(QT_DEBUG) |
|
118 |
return appNoGrab; |
|
119 |
#else |
|
120 |
return false; |
|
121 |
#endif |
|
122 |
} |
|
123 |
||
124 |
// Modified from http://www3.symbian.com/faq.nsf/0/0F1464EE96E737E780256D5E00503DD1?OpenDocument |
|
125 |
class QS60Beep : public CBase, public MMdaAudioToneObserver |
|
126 |
{ |
|
127 |
public: |
|
128 |
static QS60Beep* NewL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration); |
|
129 |
void Play(); |
|
130 |
~QS60Beep(); |
|
131 |
private: |
|
132 |
void ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration); |
|
133 |
void MatoPrepareComplete(TInt aError); |
|
134 |
void MatoPlayComplete(TInt aError); |
|
135 |
private: |
|
136 |
typedef enum |
|
137 |
{ |
|
138 |
EBeepNotPrepared, |
|
139 |
EBeepPrepared, |
|
140 |
EBeepPlaying |
|
141 |
} TBeepState; |
|
142 |
private: |
|
143 |
CMdaAudioToneUtility* iToneUtil; |
|
144 |
TBeepState iState; |
|
145 |
TInt iFrequency; |
|
146 |
TTimeIntervalMicroSeconds iDuration; |
|
147 |
}; |
|
148 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
static QS60Beep* qt_S60Beep = 0; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
|
0 | 151 |
QS60Beep::~QS60Beep() |
152 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
if (iToneUtil) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
switch (iState) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
case EBeepPlaying: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
iToneUtil->CancelPlay(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
break; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
case EBeepNotPrepared: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
iToneUtil->CancelPrepare(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
break; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
} |
0 | 163 |
delete iToneUtil; |
164 |
} |
|
165 |
||
166 |
QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) |
|
167 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
168 |
QS60Beep* self = new (ELeave) QS60Beep(); |
0 | 169 |
CleanupStack::PushL(self); |
170 |
self->ConstructL(aFrequency, aDuration); |
|
171 |
CleanupStack::Pop(); |
|
172 |
return self; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
} |
0 | 174 |
|
175 |
void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) |
|
176 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
iToneUtil = CMdaAudioToneUtility::NewL(*this); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
iState = EBeepNotPrepared; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
iFrequency = aFrequency; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
iDuration = aDuration; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
iToneUtil->PrepareToPlayTone(iFrequency, iDuration); |
0 | 182 |
} |
183 |
||
184 |
void QS60Beep::Play() |
|
185 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
if (iState == EBeepPlaying) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
iToneUtil->CancelPlay(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
iState = EBeepPrepared; |
0 | 189 |
} |
190 |
||
191 |
iToneUtil->Play(); |
|
192 |
iState = EBeepPlaying; |
|
193 |
} |
|
194 |
||
195 |
void QS60Beep::MatoPrepareComplete(TInt aError) |
|
196 |
{ |
|
197 |
if (aError == KErrNone) { |
|
198 |
iState = EBeepPrepared; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
199 |
Play(); |
0 | 200 |
} |
201 |
} |
|
202 |
||
203 |
void QS60Beep::MatoPlayComplete(TInt aError) |
|
204 |
{ |
|
205 |
Q_UNUSED(aError); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
206 |
iState = EBeepPrepared; |
0 | 207 |
} |
208 |
||
209 |
||
210 |
QHash<TInt, TUint> QApplicationPrivate::scanCodeCache; |
|
211 |
||
212 |
static Qt::KeyboardModifiers mapToQtModifiers(TUint s60Modifiers) |
|
213 |
{ |
|
214 |
Qt::KeyboardModifiers result = Qt::NoModifier; |
|
215 |
||
216 |
if (s60Modifiers & EModifierKeypad) |
|
217 |
result |= Qt::KeypadModifier; |
|
218 |
if (s60Modifiers & EModifierShift || s60Modifiers & EModifierLeftShift |
|
219 |
|| s60Modifiers & EModifierRightShift) |
|
220 |
result |= Qt::ShiftModifier; |
|
221 |
if (s60Modifiers & EModifierCtrl || s60Modifiers & EModifierLeftCtrl |
|
222 |
|| s60Modifiers & EModifierRightCtrl) |
|
223 |
result |= Qt::ControlModifier; |
|
224 |
if (s60Modifiers & EModifierAlt || s60Modifiers & EModifierLeftAlt |
|
225 |
|| s60Modifiers & EModifierRightAlt) |
|
226 |
result |= Qt::AltModifier; |
|
227 |
||
228 |
return result; |
|
229 |
} |
|
230 |
||
231 |
static void mapS60MouseEventTypeToQt(QEvent::Type *type, Qt::MouseButton *button, const TPointerEvent *pEvent) |
|
232 |
{ |
|
233 |
switch (pEvent->iType) { |
|
234 |
case TPointerEvent::EButton1Down: |
|
235 |
*type = QEvent::MouseButtonPress; |
|
236 |
*button = Qt::LeftButton; |
|
237 |
break; |
|
238 |
case TPointerEvent::EButton1Up: |
|
239 |
*type = QEvent::MouseButtonRelease; |
|
240 |
*button = Qt::LeftButton; |
|
241 |
break; |
|
242 |
case TPointerEvent::EButton2Down: |
|
243 |
*type = QEvent::MouseButtonPress; |
|
244 |
*button = Qt::MidButton; |
|
245 |
break; |
|
246 |
case TPointerEvent::EButton2Up: |
|
247 |
*type = QEvent::MouseButtonRelease; |
|
248 |
*button = Qt::MidButton; |
|
249 |
break; |
|
250 |
case TPointerEvent::EButton3Down: |
|
251 |
*type = QEvent::MouseButtonPress; |
|
252 |
*button = Qt::RightButton; |
|
253 |
break; |
|
254 |
case TPointerEvent::EButton3Up: |
|
255 |
*type = QEvent::MouseButtonRelease; |
|
256 |
*button = Qt::RightButton; |
|
257 |
break; |
|
258 |
case TPointerEvent::EDrag: |
|
259 |
*type = QEvent::MouseMove; |
|
260 |
*button = Qt::NoButton; |
|
261 |
break; |
|
262 |
case TPointerEvent::EMove: |
|
263 |
// Qt makes no distinction between move and drag |
|
264 |
*type = QEvent::MouseMove; |
|
265 |
*button = Qt::NoButton; |
|
266 |
break; |
|
267 |
default: |
|
268 |
*type = QEvent::None; |
|
269 |
*button = Qt::NoButton; |
|
270 |
break; |
|
271 |
} |
|
272 |
if (pEvent->iModifiers & EModifierDoubleClick){ |
|
273 |
*type = QEvent::MouseButtonDblClick; |
|
274 |
} |
|
275 |
||
276 |
if (*type == QEvent::MouseButtonPress || *type == QEvent::MouseButtonDblClick) |
|
277 |
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | (*button); |
|
278 |
else if (*type == QEvent::MouseButtonRelease) |
|
279 |
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~(*button)); |
|
280 |
||
281 |
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & Qt::MouseButtonMask; |
|
282 |
} |
|
283 |
||
284 |
//### Can be replaced with CAknLongTapDetector if animation is required. |
|
285 |
//NOTE: if CAknLongTapDetector is used make sure it gets variated out of 3.1 and 3.2,. |
|
286 |
//also MLongTapObserver needs to be changed to MAknLongTapDetectorCallBack if CAknLongTapDetector is used. |
|
287 |
class QLongTapTimer : public CTimer |
|
288 |
{ |
|
289 |
public: |
|
290 |
static QLongTapTimer* NewL(QAbstractLongTapObserver *observer); |
|
291 |
QLongTapTimer(QAbstractLongTapObserver *observer); |
|
292 |
void ConstructL(); |
|
293 |
public: |
|
294 |
void PointerEventL(const TPointerEvent &event); |
|
295 |
void RunL(); |
|
296 |
protected: |
|
297 |
private: |
|
298 |
QAbstractLongTapObserver *m_observer; |
|
299 |
TPointerEvent m_event; |
|
300 |
QPoint m_pressedCoordinates; |
|
301 |
int m_dragDistance; |
|
302 |
}; |
|
303 |
||
304 |
QLongTapTimer* QLongTapTimer::NewL(QAbstractLongTapObserver *observer) |
|
305 |
{ |
|
306 |
QLongTapTimer* self = new QLongTapTimer(observer); |
|
307 |
self->ConstructL(); |
|
308 |
return self; |
|
309 |
} |
|
310 |
void QLongTapTimer::ConstructL() |
|
311 |
{ |
|
312 |
CTimer::ConstructL(); |
|
313 |
} |
|
314 |
||
315 |
QLongTapTimer::QLongTapTimer(QAbstractLongTapObserver *observer):CTimer(CActive::EPriorityHigh) |
|
316 |
{ |
|
317 |
m_observer = observer; |
|
318 |
m_dragDistance = qApp->startDragDistance(); |
|
319 |
CActiveScheduler::Add(this); |
|
320 |
} |
|
321 |
||
322 |
void QLongTapTimer::PointerEventL(const TPointerEvent& event) |
|
323 |
{ |
|
324 |
if ( event.iType == TPointerEvent::EDrag || event.iType == TPointerEvent::EButtonRepeat) |
|
325 |
{ |
|
326 |
QPoint diff(QPoint(event.iPosition.iX,event.iPosition.iY) - m_pressedCoordinates); |
|
327 |
if (diff.manhattanLength() < m_dragDistance) |
|
328 |
return; |
|
329 |
} |
|
330 |
Cancel(); |
|
331 |
m_event = event; |
|
332 |
if (event.iType == TPointerEvent::EButton1Down) |
|
333 |
{ |
|
334 |
m_pressedCoordinates = QPoint(event.iPosition.iX,event.iPosition.iY); |
|
335 |
// must be same as KLongTapDelay in aknlongtapdetector.h |
|
336 |
After(800000); |
|
337 |
} |
|
338 |
} |
|
339 |
void QLongTapTimer::RunL() |
|
340 |
{ |
|
341 |
if (m_observer) |
|
342 |
m_observer->HandleLongTapEventL(m_event.iPosition, m_event.iParentPosition); |
|
343 |
} |
|
344 |
||
345 |
QSymbianControl::QSymbianControl(QWidget *w) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
346 |
: CCoeControl() |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
347 |
, qwidget(w) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
348 |
, m_longTapDetector(0) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
349 |
, m_ignoreFocusChanged(0) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
, m_symbianPopupIsOpen(0) |
0 | 351 |
{ |
352 |
} |
|
353 |
||
354 |
void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) |
|
355 |
{ |
|
356 |
if (!desktop) |
|
357 |
{ |
|
358 |
if (isWindowOwning or !qwidget->parentWidget()) |
|
359 |
CreateWindowL(S60->windowGroup()); |
|
360 |
else |
|
361 |
/** |
|
362 |
* TODO: in order to avoid creating windows for all ancestors of |
|
363 |
* this widget up to the root window, the parameter passed to |
|
364 |
* CreateWindowL should be |
|
365 |
* qwidget->parentWidget()->effectiveWinId(). However, if we do |
|
366 |
* this, then we need to take care of re-parenting when a window |
|
367 |
* is created for a widget between this one and the root window. |
|
368 |
*/ |
|
369 |
CreateWindowL(qwidget->parentWidget()->winId()); |
|
370 |
||
371 |
// Necessary in order to be able to track the activation status of |
|
372 |
// the control's window |
|
373 |
qwidget->d_func()->createExtra(); |
|
374 |
||
375 |
SetFocusing(true); |
|
376 |
m_longTapDetector = QLongTapTimer::NewL(this); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
377 |
m_doubleClickTimer.invalidate(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
378 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
379 |
DrawableWindow()->SetPointerGrab(ETrue); |
0 | 380 |
} |
381 |
} |
|
382 |
||
383 |
QSymbianControl::~QSymbianControl() |
|
384 |
{ |
|
385 |
if (S60->curWin == this) |
|
386 |
S60->curWin = 0; |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
387 |
if (!QApplicationPrivate::is_app_closing) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
388 |
QT_TRY { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
389 |
setFocusSafely(false); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
390 |
} QT_CATCH(const std::exception&) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
391 |
// ignore exceptions, nothing can be done |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
392 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
393 |
} |
0 | 394 |
S60->appUi()->RemoveFromStack(this); |
395 |
delete m_longTapDetector; |
|
396 |
} |
|
397 |
||
398 |
void QSymbianControl::setWidget(QWidget *w) |
|
399 |
{ |
|
400 |
qwidget = w; |
|
401 |
} |
|
402 |
void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ) |
|
403 |
{ |
|
404 |
QWidget *alienWidget; |
|
405 |
QPoint widgetPos = QPoint(aPenEventLocation.iX, aPenEventLocation.iY); |
|
406 |
QPoint globalPos = QPoint(aPenEventScreenLocation.iX,aPenEventScreenLocation.iY); |
|
407 |
alienWidget = qwidget->childAt(widgetPos); |
|
408 |
if (!alienWidget) |
|
409 |
alienWidget = qwidget; |
|
410 |
||
411 |
#if !defined(QT_NO_CONTEXTMENU) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
412 |
QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier); |
0 | 413 |
qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent); |
414 |
#endif |
|
415 |
} |
|
416 |
||
417 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
|
418 |
void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) |
|
419 |
{ |
|
420 |
QApplicationPrivate *d = QApplicationPrivate::instance(); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
421 |
QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
422 |
qreal pressure; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
423 |
if(d->pressureSupported |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
424 |
&& event->Pressure() > 0) //workaround for misconfigured HAL |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
425 |
pressure = event->Pressure() / qreal(d->maxTouchPressure); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
426 |
else |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
427 |
pressure = qreal(1.0); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
428 |
processTouchEvent(event->PointerNumber(), event->iType, screenPos, pressure); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
429 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
430 |
#endif |
0 | 431 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
432 |
void QSymbianControl::processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
433 |
{ |
0 | 434 |
QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget); |
435 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
436 |
QApplicationPrivate *d = QApplicationPrivate::instance(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
437 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
438 |
QList<QTouchEvent::TouchPoint> points = d->appAllTouchPoints; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
439 |
while (points.count() <= pointerNumber) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
440 |
points.append(QTouchEvent::TouchPoint(points.count())); |
0 | 441 |
|
442 |
Qt::TouchPointStates allStates = 0; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
443 |
for (int i = 0; i < points.count(); ++i) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
444 |
QTouchEvent::TouchPoint &touchPoint = points[i]; |
0 | 445 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
446 |
if (touchPoint.id() == pointerNumber) { |
0 | 447 |
Qt::TouchPointStates state; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
448 |
switch (type) { |
0 | 449 |
case TPointerEvent::EButton1Down: |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
450 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
0 | 451 |
case TPointerEvent::EEnterHighPressure: |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
452 |
#endif |
0 | 453 |
state = Qt::TouchPointPressed; |
454 |
break; |
|
455 |
case TPointerEvent::EButton1Up: |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
456 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
0 | 457 |
case TPointerEvent::EExitCloseProximity: |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
458 |
#endif |
0 | 459 |
state = Qt::TouchPointReleased; |
460 |
break; |
|
461 |
case TPointerEvent::EDrag: |
|
462 |
state = Qt::TouchPointMoved; |
|
463 |
break; |
|
464 |
default: |
|
465 |
// how likely is this to happen? |
|
466 |
state = Qt::TouchPointStationary; |
|
467 |
break; |
|
468 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
469 |
if (pointerNumber == 0) |
0 | 470 |
state |= Qt::TouchPointPrimary; |
471 |
touchPoint.setState(state); |
|
472 |
||
473 |
touchPoint.setScreenPos(screenPos); |
|
474 |
touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), |
|
475 |
screenPos.y() / screenGeometry.height())); |
|
476 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
477 |
touchPoint.setPressure(pressure); |
0 | 478 |
} else if (touchPoint.state() != Qt::TouchPointReleased) { |
479 |
// all other active touch points should be marked as stationary |
|
480 |
touchPoint.setState(Qt::TouchPointStationary); |
|
481 |
} |
|
482 |
||
483 |
allStates |= touchPoint.state(); |
|
484 |
} |
|
485 |
||
486 |
if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) { |
|
487 |
// all touch points released |
|
488 |
d->appAllTouchPoints.clear(); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
489 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
490 |
d->appAllTouchPoints = points; |
0 | 491 |
} |
492 |
||
493 |
QApplicationPrivate::translateRawTouchEvent(qwidget, |
|
494 |
QTouchEvent::TouchScreen, |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
495 |
points); |
0 | 496 |
} |
497 |
||
498 |
void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) |
|
499 |
{ |
|
500 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
|
501 |
if (pEvent.IsAdvancedPointerEvent()) { |
|
502 |
const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent(); |
|
503 |
translateAdvancedPointerEvent(advancedPointerEvent); |
|
504 |
if (advancedPointerEvent->PointerNumber() != 0) { |
|
505 |
// only send mouse events for the first touch point |
|
506 |
return; |
|
507 |
} |
|
508 |
} |
|
509 |
#endif |
|
510 |
||
511 |
m_longTapDetector->PointerEventL(pEvent); |
|
512 |
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); |
|
513 |
} |
|
514 |
||
515 |
void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) |
|
516 |
{ |
|
517 |
QMouseEvent::Type type; |
|
518 |
Qt::MouseButton button; |
|
519 |
mapS60MouseEventTypeToQt(&type, &button, &pEvent); |
|
520 |
Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); |
|
521 |
||
522 |
QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); |
|
523 |
TPoint controlScreenPos = PositionRelativeToScreen(); |
|
524 |
QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
525 |
S60->lastCursorPos = globalPos; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
526 |
S60->lastPointerEventPos = widgetPos; |
0 | 527 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
528 |
QWidget *mouseGrabber = QWidget::mouseGrabber(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
529 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
530 |
QWidget *popupWidget = qApp->activePopupWidget(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
QWidget *popupReceiver = 0; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
532 |
if (popupWidget) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
533 |
QWidget *popupChild = popupWidget->childAt(popupWidget->mapFromGlobal(globalPos)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
popupReceiver = popupChild ? popupChild : popupWidget; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
536 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
537 |
if (mouseGrabber) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
if (popupReceiver) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
sendMouseEvent(popupReceiver, type, globalPos, button, modifiers); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
540 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
541 |
sendMouseEvent(mouseGrabber, type, globalPos, button, modifiers); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
// No Enter/Leave events in grabbing mode. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
544 |
return; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
545 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
|
0 | 547 |
QWidget *widgetUnderPointer = qwidget->childAt(widgetPos); |
548 |
if (!widgetUnderPointer) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
549 |
widgetUnderPointer = qwidget; |
0 | 550 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
551 |
QApplicationPrivate::dispatchEnterLeave(widgetUnderPointer, S60->lastPointerEventTarget); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
552 |
S60->lastPointerEventTarget = widgetUnderPointer; |
0 | 553 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
554 |
QWidget *receiver; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
555 |
if (!popupReceiver && S60->mousePressTarget && type != QEvent::MouseButtonPress) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
556 |
receiver = S60->mousePressTarget; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
557 |
if (type == QEvent::MouseButtonRelease) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
558 |
S60->mousePressTarget = 0; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
559 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
560 |
receiver = popupReceiver ? popupReceiver : widgetUnderPointer; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
if (type == QEvent::MouseButtonPress) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
562 |
S60->mousePressTarget = receiver; |
0 | 563 |
} |
564 |
||
565 |
#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS) |
|
566 |
if (S60->brokenPointerCursors) |
|
567 |
qt_symbian_move_cursor_sprite(); |
|
568 |
#endif |
|
569 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
570 |
//Generate single touch event for S60 5.0 (has touchscreen, does not have advanced pointers) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
571 |
#ifndef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
572 |
if (S60->hasTouchscreen) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
573 |
processTouchEvent(0, pEvent.iType, QPointF(globalPos), 1.0); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
574 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
575 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
576 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
577 |
sendMouseEvent(receiver, type, globalPos, button, modifiers); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
|
23
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
580 |
#ifdef Q_WS_S60 |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
581 |
void QSymbianControl::HandleStatusPaneSizeChange() |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
582 |
{ |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
583 |
QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi()); |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
584 |
s60AppUi->HandleStatusPaneSizeChange(); |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
585 |
} |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
586 |
#endif |
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
587 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
588 |
void QSymbianControl::sendMouseEvent( |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
QWidget *receiver, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
QEvent::Type type, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
const QPoint &globalPos, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
592 |
Qt::MouseButton button, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
Qt::KeyboardModifiers modifiers) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
594 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
Q_ASSERT(receiver); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
596 |
QMouseEvent mEvent(type, receiver->mapFromGlobal(globalPos), globalPos, |
0 | 597 |
button, QApplicationPrivate::mouse_buttons, modifiers); |
598 |
QEventDispatcherS60 *dispatcher; |
|
599 |
// It is theoretically possible for someone to install a different event dispatcher. |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |
if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(receiver->d_func()->threadData->eventDispatcher)) != 0) { |
0 | 601 |
if (dispatcher->excludeUserInputEvents()) { |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
602 |
dispatcher->saveInputEvent(this, receiver, new QMouseEvent(mEvent)); |
0 | 603 |
return; |
604 |
} |
|
605 |
} |
|
606 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
607 |
sendMouseEvent(receiver, &mEvent); |
0 | 608 |
} |
609 |
||
610 |
bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent) |
|
611 |
{ |
|
612 |
return qt_sendSpontaneousEvent(widget, mEvent); |
|
613 |
} |
|
614 |
||
615 |
TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type) |
|
616 |
{ |
|
617 |
TKeyResponse r = EKeyWasNotConsumed; |
|
618 |
QT_TRYCATCH_LEAVING(r = OfferKeyEvent(keyEvent, type)); |
|
619 |
return r; |
|
620 |
} |
|
621 |
||
622 |
TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCode type) |
|
623 |
{ |
|
624 |
switch (type) { |
|
625 |
//case EEventKeyDown: // <-- Intentionally left out. See below. |
|
626 |
case EEventKeyUp: |
|
627 |
case EEventKey: |
|
628 |
{ |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
629 |
#ifndef QT_NO_CURSOR |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
630 |
if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
631 |
//translate keys to pointer |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
632 |
if ((keyEvent.iScanCode >= EStdKeyLeftArrow && keyEvent.iScanCode <= EStdKeyDownArrow) || |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
633 |
(keyEvent.iScanCode >= EStdKeyDevice10 && keyEvent.iScanCode <= EStdKeyDevice13) || |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
634 |
keyEvent.iScanCode == EStdKeyDevice3) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
635 |
QPoint pos = QCursor::pos(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
636 |
TPointerEvent fakeEvent; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
637 |
fakeEvent.iType = (TPointerEvent::TType)(-1); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
638 |
fakeEvent.iModifiers = keyEvent.iModifiers; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
639 |
TInt x = pos.x(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
640 |
TInt y = pos.y(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
641 |
if (type == EEventKeyUp) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
642 |
S60->virtualMouseAccelTimeout.start(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
643 |
switch (keyEvent.iScanCode) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
644 |
case EStdKeyLeftArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
645 |
S60->virtualMousePressedKeys &= ~QS60Data::Left; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
646 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
647 |
case EStdKeyRightArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
648 |
S60->virtualMousePressedKeys &= ~QS60Data::Right; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
649 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
650 |
case EStdKeyUpArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
651 |
S60->virtualMousePressedKeys &= ~QS60Data::Up; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
652 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
653 |
case EStdKeyDownArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
654 |
S60->virtualMousePressedKeys &= ~QS60Data::Down; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
655 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
656 |
// diagonal keys (named aliases don't exist in 3.1 SDK) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
657 |
case EStdKeyDevice10: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
658 |
S60->virtualMousePressedKeys &= ~QS60Data::LeftUp; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
659 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
660 |
case EStdKeyDevice11: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
661 |
S60->virtualMousePressedKeys &= ~QS60Data::RightUp; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
662 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
663 |
case EStdKeyDevice12: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
664 |
S60->virtualMousePressedKeys &= ~QS60Data::RightDown; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
665 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
666 |
case EStdKeyDevice13: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
667 |
S60->virtualMousePressedKeys &= ~QS60Data::LeftDown; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
668 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
669 |
case EStdKeyDevice3: //select |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
670 |
if (S60->virtualMousePressedKeys & QS60Data::Select) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
671 |
fakeEvent.iType = TPointerEvent::EButton1Up; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
672 |
S60->virtualMousePressedKeys &= ~QS60Data::Select; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
673 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
674 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
675 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
676 |
else if (type == EEventKey) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
677 |
int dx = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
678 |
int dy = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
679 |
if (keyEvent.iScanCode != EStdKeyDevice3) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
680 |
m_doubleClickTimer.invalidate(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
681 |
//reset mouse accelleration after a short time with no moves |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
682 |
const int maxTimeBetweenKeyEventsMs = 500; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
683 |
if (S60->virtualMouseAccelTimeout.isValid() && |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
684 |
S60->virtualMouseAccelTimeout.hasExpired(maxTimeBetweenKeyEventsMs)) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
685 |
S60->virtualMouseAccelDX = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
686 |
S60->virtualMouseAccelDY = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
687 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
688 |
S60->virtualMouseAccelTimeout.invalidate(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
689 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
690 |
switch (keyEvent.iScanCode) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
691 |
case EStdKeyLeftArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
692 |
S60->virtualMousePressedKeys |= QS60Data::Left; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
693 |
dx = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
694 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
695 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
696 |
case EStdKeyRightArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
697 |
S60->virtualMousePressedKeys |= QS60Data::Right; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
698 |
dx = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
699 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
700 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
701 |
case EStdKeyUpArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
702 |
S60->virtualMousePressedKeys |= QS60Data::Up; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
703 |
dy = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
704 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
705 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
706 |
case EStdKeyDownArrow: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
707 |
S60->virtualMousePressedKeys |= QS60Data::Down; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
708 |
dy = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
709 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
710 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
711 |
case EStdKeyDevice10: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
712 |
S60->virtualMousePressedKeys |= QS60Data::LeftUp; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
713 |
dx = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
714 |
dy = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
715 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
716 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
717 |
case EStdKeyDevice11: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
718 |
S60->virtualMousePressedKeys |= QS60Data::RightUp; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
719 |
dx = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
720 |
dy = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
721 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
722 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
723 |
case EStdKeyDevice12: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
724 |
S60->virtualMousePressedKeys |= QS60Data::RightDown; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
725 |
dx = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
726 |
dy = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
727 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
728 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
729 |
case EStdKeyDevice13: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
730 |
S60->virtualMousePressedKeys |= QS60Data::LeftDown; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
731 |
dx = -1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
732 |
dy = 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
733 |
fakeEvent.iType = TPointerEvent::EMove; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
734 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
735 |
case EStdKeyDevice3: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
736 |
// Platform bug. If you start pressing several keys simultaneously (for |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
737 |
// example for drag'n'drop), Symbian starts producing spurious up and |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
738 |
// down messages for some keys. Therefore, make sure we have a clean slate |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
739 |
// of pressed keys before starting a new button press. |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
740 |
if (S60->virtualMousePressedKeys & QS60Data::Select) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
741 |
return EKeyWasConsumed; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
742 |
} else { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
743 |
S60->virtualMousePressedKeys |= QS60Data::Select; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
744 |
fakeEvent.iType = TPointerEvent::EButton1Down; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
745 |
if (m_doubleClickTimer.isValid() |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
746 |
&& !m_doubleClickTimer.hasExpired(QApplication::doubleClickInterval())) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
747 |
fakeEvent.iModifiers |= EModifierDoubleClick; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
748 |
m_doubleClickTimer.invalidate(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
749 |
} else { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
750 |
m_doubleClickTimer.start(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
751 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
752 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
753 |
break; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
754 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
755 |
if (dx) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
756 |
int cdx = S60->virtualMouseAccelDX; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
757 |
//reset accel on change of sign, else double accel |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
758 |
if (dx * cdx <= 0) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
759 |
cdx = dx; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
760 |
else |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
761 |
cdx *= 4; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
762 |
//cap accelleration |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
763 |
if (dx * cdx > S60->virtualMouseMaxAccel) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
764 |
cdx = dx * S60->virtualMouseMaxAccel; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
765 |
//move mouse position |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
766 |
x += cdx; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
767 |
S60->virtualMouseAccelDX = cdx; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
768 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
769 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
770 |
if (dy) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
771 |
int cdy = S60->virtualMouseAccelDY; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
772 |
if (dy * cdy <= 0) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
773 |
cdy = dy; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
774 |
else |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
775 |
cdy *= 4; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
776 |
if (dy * cdy > S60->virtualMouseMaxAccel) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
777 |
cdy = dy * S60->virtualMouseMaxAccel; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
778 |
y += cdy; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
779 |
S60->virtualMouseAccelDY = cdy; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
780 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
781 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
782 |
//clip to screen size (window server allows a sprite hotspot to be outside the screen) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
783 |
if (x < 0) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
784 |
x = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
785 |
else if (x >= S60->screenWidthInPixels) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
786 |
x = S60->screenWidthInPixels - 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
787 |
if (y < 0) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
788 |
y = 0; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
789 |
else if (y >= S60->screenHeightInPixels) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
790 |
y = S60->screenHeightInPixels - 1; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
791 |
TPoint epos(x, y); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
792 |
TPoint cpos = epos - PositionRelativeToScreen(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
793 |
fakeEvent.iPosition = cpos; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
794 |
fakeEvent.iParentPosition = epos; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
795 |
if(fakeEvent.iType != -1) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
796 |
HandlePointerEvent(fakeEvent); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
797 |
return EKeyWasConsumed; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
798 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
799 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
800 |
#endif |
0 | 801 |
// S60 has a confusing way of delivering key events. There are three types of |
802 |
// events: EKeyEvent, EKeyEventDown and EKeyEventUp. When a key is pressed, the |
|
803 |
// two first events are generated. When releasing the key, the last one is |
|
804 |
// generated. |
|
805 |
// Because S60 does not generate keysyms for EKeyEventDown and EKeyEventUp events, |
|
806 |
// we need to do some special tricks to map it to the Qt way. First, we completely |
|
807 |
// discard EKeyEventDown events, since they are redundant. Second, since |
|
808 |
// EKeyEventUp does not give us a keysym, we need to cache the keysyms from |
|
809 |
// the EKeyEvent events. This is what resolveS60ScanCode does. |
|
810 |
||
811 |
||
812 |
// ### hackish way to send Qt application to background when pressing right softkey |
|
813 |
/* |
|
814 |
if( keyEvent.iScanCode == EStdKeyDevice1 ) { |
|
815 |
S60->window_group->SetOrdinalPosition(-1); |
|
816 |
qApp->setActiveWindow(0); |
|
817 |
return EKeyWasNotConsumed; |
|
818 |
} |
|
819 |
*/ |
|
820 |
||
821 |
TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, |
|
822 |
keyEvent.iCode); |
|
823 |
int keyCode; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
824 |
if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
825 |
keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
826 |
} else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { |
0 | 827 |
// Normal characters keys. |
828 |
keyCode = s60Keysym; |
|
829 |
} else { |
|
830 |
// Special S60 keys. |
|
831 |
keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym); |
|
832 |
} |
|
833 |
||
834 |
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); |
|
835 |
QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode, |
|
836 |
mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
837 |
(keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); |
0 | 838 |
// WId wid = reinterpret_cast<RWindowGroup *>(keyEvent.Handle())->Child(); |
839 |
// if (!wid) |
|
840 |
// Could happen if window isn't shown yet. |
|
841 |
// return EKeyWasNotConsumed; |
|
842 |
QWidget *widget; |
|
843 |
widget = QWidget::keyboardGrabber(); |
|
844 |
if (!widget) { |
|
845 |
if (QApplicationPrivate::popupWidgets != 0) { |
|
846 |
widget = QApplication::activePopupWidget()->focusWidget(); |
|
847 |
if (!widget) { |
|
848 |
widget = QApplication::activePopupWidget(); |
|
849 |
} |
|
850 |
} else { |
|
851 |
widget = QApplicationPrivate::focus_widget; |
|
852 |
if (!widget) { |
|
853 |
widget = qwidget; |
|
854 |
} |
|
855 |
} |
|
856 |
} |
|
857 |
||
858 |
QEventDispatcherS60 *dispatcher; |
|
859 |
// It is theoretically possible for someone to install a different event dispatcher. |
|
860 |
if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widget->d_func()->threadData->eventDispatcher)) != 0) { |
|
861 |
if (dispatcher->excludeUserInputEvents()) { |
|
862 |
dispatcher->saveInputEvent(this, widget, new QKeyEventEx(qKeyEvent)); |
|
863 |
return EKeyWasConsumed; |
|
864 |
} |
|
865 |
} |
|
866 |
return sendKeyEvent(widget, &qKeyEvent); |
|
867 |
} |
|
868 |
} |
|
869 |
return EKeyWasNotConsumed; |
|
870 |
} |
|
871 |
||
872 |
void QSymbianControl::sendInputEvent(QWidget *widget, QInputEvent *inputEvent) |
|
873 |
{ |
|
874 |
switch (inputEvent->type()) { |
|
875 |
case QEvent::KeyPress: |
|
876 |
case QEvent::KeyRelease: |
|
877 |
sendKeyEvent(widget, static_cast<QKeyEvent *>(inputEvent)); |
|
878 |
break; |
|
879 |
case QEvent::MouseButtonDblClick: |
|
880 |
case QEvent::MouseButtonPress: |
|
881 |
case QEvent::MouseButtonRelease: |
|
882 |
case QEvent::MouseMove: |
|
883 |
sendMouseEvent(widget, static_cast<QMouseEvent *>(inputEvent)); |
|
884 |
break; |
|
885 |
default: |
|
886 |
// Shouldn't get here. |
|
887 |
Q_ASSERT_X(0 == 1, "QSymbianControl::sendInputEvent()", "inputEvent->type() is unknown"); |
|
888 |
break; |
|
889 |
} |
|
890 |
} |
|
891 |
||
892 |
TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) |
|
893 |
{ |
|
894 |
#if !defined(QT_NO_IM) && defined(Q_WS_S60) |
|
895 |
if (widget && widget->isEnabled() && widget->testAttribute(Qt::WA_InputMethodEnabled)) { |
|
896 |
QInputContext *qic = widget->inputContext(); |
|
897 |
if (qic && qic->filterEvent(keyEvent)) |
|
898 |
return EKeyWasConsumed; |
|
899 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
900 |
#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN) |
0 | 901 |
|
902 |
if (widget && qt_sendSpontaneousEvent(widget, keyEvent)) |
|
903 |
if (keyEvent->isAccepted()) |
|
904 |
return EKeyWasConsumed; |
|
905 |
||
906 |
return EKeyWasNotConsumed; |
|
907 |
} |
|
908 |
||
909 |
#if !defined(QT_NO_IM) && defined(Q_WS_S60) |
|
910 |
TCoeInputCapabilities QSymbianControl::InputCapabilities() const |
|
911 |
{ |
|
912 |
QWidget *w = 0; |
|
913 |
||
914 |
if (qwidget->hasFocus()) |
|
915 |
w = qwidget; |
|
916 |
else |
|
917 |
w = qwidget->focusWidget(); |
|
918 |
||
919 |
QCoeFepInputContext *ic; |
|
920 |
if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled) |
|
921 |
&& (ic = qobject_cast<QCoeFepInputContext *>(w->inputContext()))) { |
|
922 |
return ic->inputCapabilities(); |
|
923 |
} else { |
|
924 |
return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0); |
|
925 |
} |
|
926 |
} |
|
927 |
#endif |
|
928 |
||
929 |
void QSymbianControl::Draw(const TRect& controlRect) const |
|
930 |
{ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
931 |
// Set flag to avoid calling DrawNow in window surface |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
932 |
QWidget *window = qwidget->window(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
933 |
Q_ASSERT(window); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
934 |
QTLWExtra *topExtra = window->d_func()->maybeTopData(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
935 |
Q_ASSERT(topExtra); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
936 |
if (!topExtra->inExpose) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
937 |
topExtra->inExpose = true; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
938 |
QRect exposeRect = qt_TRect2QRect(controlRect); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
939 |
qwidget->d_func()->syncBackingStore(exposeRect); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
940 |
topExtra->inExpose = false; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
941 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
942 |
|
0 | 943 |
QWindowSurface *surface = qwidget->windowSurface(); |
944 |
QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL; |
|
945 |
||
946 |
if (!engine) |
|
947 |
return; |
|
948 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
949 |
const bool sendNativePaintEvents = qwidget->d_func()->extraData()->receiveNativePaintEvents; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
950 |
if (sendNativePaintEvents) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
951 |
const QRect r = qt_TRect2QRect(controlRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
952 |
QMetaObject::invokeMethod(qwidget, "beginNativePaintEvent", Qt::DirectConnection, Q_ARG(QRect, r)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
953 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
|
0 | 955 |
// Map source rectangle into coordinates of the backing store. |
956 |
const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY); |
|
957 |
const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase); |
|
958 |
const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size()); |
|
959 |
||
960 |
if (engine->type() == QPaintEngine::Raster) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
961 |
QS60WindowSurface *s60Surface; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
962 |
#ifdef QT_GRAPHICSSYSTEM_RUNTIME |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
963 |
if (QApplicationPrivate::runtime_graphics_system) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
964 |
QRuntimeWindowSurface *rtSurface = |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
965 |
static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface()); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
966 |
s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
967 |
} else |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
968 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
969 |
s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
970 |
|
0 | 971 |
CFbsBitmap *bitmap = s60Surface->symbianBitmap(); |
972 |
CWindowGc &gc = SystemGc(); |
|
973 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
974 |
switch(qwidget->d_func()->extraData()->nativePaintMode) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
975 |
case QWExtra::Disable: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
976 |
// Do nothing |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
977 |
break; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
978 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
979 |
case QWExtra::Blit: |
0 | 980 |
if (qwidget->d_func()->isOpaque) |
981 |
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
|
982 |
gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
983 |
break; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
984 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
985 |
case QWExtra::ZeroFill: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
986 |
if (Window().DisplayMode() == EColor16MA) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
987 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
988 |
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
989 |
gc.SetBrushColor(TRgb::Color16MA(0)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
990 |
gc.Clear(controlRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
991 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
992 |
gc.SetBrushColor(TRgb(0x000000)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
993 |
gc.Clear(controlRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
994 |
}; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
995 |
break; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
996 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
997 |
default: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
998 |
Q_ASSERT(false); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
999 |
} |
0 | 1000 |
} |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1001 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1002 |
if (sendNativePaintEvents) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1003 |
const QRect r = qt_TRect2QRect(controlRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1004 |
// The draw ops aren't actually sent to WSERV until the graphics |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1005 |
// context is deactivated, which happens in the function calling |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1006 |
// this one. We therefore delay the delivery of endNativePaintEvent, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1007 |
// to ensure that drawing has completed by the time the widget |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1008 |
// receives the event. Note that, if the widget needs to ensure |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1009 |
// that the draw ops have actually been executed into the output |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1010 |
// framebuffer, a call to RWsSession::Flush is required in the |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1011 |
// endNativePaintEvent implementation. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1012 |
QMetaObject::invokeMethod(qwidget, "endNativePaintEvent", Qt::QueuedConnection, Q_ARG(QRect, r)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1013 |
} |
0 | 1014 |
} |
1015 |
||
1016 |
void QSymbianControl::SizeChanged() |
|
1017 |
{ |
|
1018 |
CCoeControl::SizeChanged(); |
|
1019 |
||
1020 |
QSize oldSize = qwidget->size(); |
|
1021 |
QSize newSize(Size().iWidth, Size().iHeight); |
|
1022 |
||
1023 |
if (oldSize != newSize) { |
|
1024 |
QRect cr = qwidget->geometry(); |
|
1025 |
cr.setSize(newSize); |
|
1026 |
qwidget->data->crect = cr; |
|
1027 |
if (qwidget->isVisible()) { |
|
1028 |
QTLWExtra *tlwExtra = qwidget->d_func()->maybeTopData(); |
|
1029 |
bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt(); |
|
1030 |
if (!slowResize && tlwExtra) |
|
1031 |
tlwExtra->inTopLevelResize = true; |
|
1032 |
QResizeEvent e(newSize, oldSize); |
|
1033 |
qt_sendSpontaneousEvent(qwidget, &e); |
|
1034 |
if (!qwidget->testAttribute(Qt::WA_StaticContents)) |
|
1035 |
qwidget->d_func()->syncBackingStore(); |
|
1036 |
if (!slowResize && tlwExtra) |
|
1037 |
tlwExtra->inTopLevelResize = false; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1038 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1039 |
QResizeEvent *e = new QResizeEvent(newSize, oldSize); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1040 |
QApplication::postEvent(qwidget, e); |
0 | 1041 |
} |
1042 |
} |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1043 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1044 |
// CCoeControl::SetExtent calls SizeChanged, but does not call |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1045 |
// PositionChanged, so we call it here to ensure that the widget's |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1046 |
// position is updated. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1047 |
PositionChanged(); |
0 | 1048 |
} |
1049 |
||
1050 |
void QSymbianControl::PositionChanged() |
|
1051 |
{ |
|
1052 |
CCoeControl::PositionChanged(); |
|
1053 |
||
1054 |
QPoint oldPos = qwidget->geometry().topLeft(); |
|
1055 |
QPoint newPos(Position().iX, Position().iY); |
|
1056 |
||
1057 |
if (oldPos != newPos) { |
|
1058 |
QRect cr = qwidget->geometry(); |
|
1059 |
cr.moveTopLeft(newPos); |
|
1060 |
qwidget->data->crect = cr; |
|
1061 |
QTLWExtra *top = qwidget->d_func()->maybeTopData(); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1062 |
if (top && (qwidget->windowState() & (~Qt::WindowActive)) == Qt::WindowNoState) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1063 |
top->normalGeometry.moveTopLeft(newPos); |
0 | 1064 |
if (qwidget->isVisible()) { |
1065 |
QMoveEvent e(newPos, oldPos); |
|
1066 |
qt_sendSpontaneousEvent(qwidget, &e); |
|
1067 |
} else { |
|
1068 |
QMoveEvent * e = new QMoveEvent(newPos, oldPos); |
|
1069 |
QApplication::postEvent(qwidget, e); |
|
1070 |
} |
|
1071 |
} |
|
1072 |
} |
|
1073 |
||
1074 |
void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) |
|
1075 |
{ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1076 |
if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) |
0 | 1077 |
return; |
1078 |
||
1079 |
// Popups never get focused, but still receive the FocusChanged when they are hidden. |
|
1080 |
if (QApplicationPrivate::popupWidgets != 0 |
|
1081 |
|| (qwidget->windowType() & Qt::Popup) == Qt::Popup) |
|
1082 |
return; |
|
1083 |
||
1084 |
if (IsFocused() && IsVisible()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1085 |
if (m_symbianPopupIsOpen) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1086 |
QWidget *fw = QApplication::focusWidget(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1087 |
if (fw) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1088 |
QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1089 |
QCoreApplication::sendEvent(fw, &event); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1090 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1091 |
m_symbianPopupIsOpen = false; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1092 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1093 |
|
0 | 1094 |
QApplication::setActiveWindow(qwidget->window()); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1095 |
qwidget->d_func()->setWindowIcon_sys(true); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1096 |
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); |
0 | 1097 |
#ifdef Q_WS_S60 |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1098 |
// If widget is fullscreen/minimized, hide status pane and button container otherwise show them. |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1099 |
CEikStatusPane *statusPane = S60->statusPane(); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1100 |
CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1101 |
TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1102 |
if (statusPane) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1103 |
statusPane->MakeVisible(visible); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1104 |
if (buttonGroup) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1105 |
// Visibility |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1106 |
const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1107 |
const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1108 |
buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint)); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1109 |
} |
0 | 1110 |
#endif |
1111 |
} else if (QApplication::activeWindow() == qwidget->window()) { |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1112 |
if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1113 |
QWidget *fw = QApplication::focusWidget(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1114 |
if (fw) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1115 |
QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1116 |
QCoreApplication::sendEvent(fw, &event); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1117 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1118 |
m_symbianPopupIsOpen = true; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1119 |
return; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1120 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1121 |
|
0 | 1122 |
QApplication::setActiveWindow(0); |
1123 |
} |
|
1124 |
// else { We don't touch the active window unless we were explicitly activated or deactivated } |
|
1125 |
} |
|
1126 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1127 |
void QSymbianControl::handleClientAreaChange() |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1128 |
{ |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1129 |
const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1130 |
if (qwidget->isFullScreen() && !cbaVisibilityHint) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1131 |
SetExtentToWholeScreen(); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1132 |
} else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1133 |
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1134 |
SetExtent(r.iTl, r.Size()); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1135 |
} else if (!qwidget->isMinimized()) { // Normal geometry |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1136 |
if (!qwidget->testAttribute(Qt::WA_Resized)) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1137 |
qwidget->adjustSize(); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1138 |
qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1139 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1140 |
if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1141 |
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1142 |
SetPosition(r.iTl); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1143 |
qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1144 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1145 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1146 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1147 |
|
0 | 1148 |
void QSymbianControl::HandleResourceChange(int resourceType) |
1149 |
{ |
|
1150 |
switch (resourceType) { |
|
1151 |
case KInternalStatusPaneChange: |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1152 |
handleClientAreaChange(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1153 |
if (IsFocused() && IsVisible()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1154 |
qwidget->d_func()->setWindowIcon_sys(true); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1155 |
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1156 |
} |
0 | 1157 |
break; |
1158 |
case KUidValueCoeFontChangeEvent: |
|
1159 |
// font change event |
|
1160 |
break; |
|
1161 |
#ifdef Q_WS_S60 |
|
1162 |
case KEikDynamicLayoutVariantSwitch: |
|
1163 |
{ |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1164 |
handleClientAreaChange(); |
0 | 1165 |
break; |
1166 |
} |
|
1167 |
#endif |
|
1168 |
default: |
|
1169 |
break; |
|
1170 |
} |
|
1171 |
||
1172 |
CCoeControl::HandleResourceChange(resourceType); |
|
1173 |
||
1174 |
} |
|
1175 |
void QSymbianControl::CancelLongTapTimer() |
|
1176 |
{ |
|
1177 |
m_longTapDetector->Cancel(); |
|
1178 |
} |
|
1179 |
||
1180 |
TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) |
|
1181 |
{ |
|
1182 |
if (id.iUid == ETypeId) |
|
1183 |
return id.MakePtr(this); |
|
1184 |
||
1185 |
return CCoeControl::MopSupplyObject(id); |
|
1186 |
} |
|
1187 |
||
1188 |
void QSymbianControl::setFocusSafely(bool focus) |
|
1189 |
{ |
|
1190 |
// The stack hack in here is very unfortunate, but it is the only way to ensure proper |
|
1191 |
// focus in Symbian. If this is not executed, the control which happens to be on |
|
1192 |
// the top of the stack may randomly be assigned focus by Symbian, for example |
|
1193 |
// when creating new windows (specifically in CCoeAppUi::HandleStackChanged()). |
|
1194 |
if (focus) { |
|
1195 |
S60->appUi()->RemoveFromStack(this); |
|
1196 |
// Symbian doesn't automatically remove focus from the last focused control, so we need to |
|
1197 |
// remember it and clear focus ourselves. |
|
1198 |
if (lastFocusedControl && lastFocusedControl != this) |
|
1199 |
lastFocusedControl->SetFocus(false); |
|
1200 |
QT_TRAP_THROWING(S60->appUi()->AddToStackL(this, |
|
1201 |
ECoeStackPriorityDefault + 1, ECoeStackFlagStandard)); // Note the + 1 |
|
1202 |
lastFocusedControl = this; |
|
1203 |
this->SetFocus(true); |
|
1204 |
} else { |
|
1205 |
S60->appUi()->RemoveFromStack(this); |
|
1206 |
QT_TRAP_THROWING(S60->appUi()->AddToStackL(this, |
|
1207 |
ECoeStackPriorityDefault, ECoeStackFlagStandard)); |
|
1208 |
if(this == lastFocusedControl) |
|
1209 |
lastFocusedControl = 0; |
|
1210 |
this->SetFocus(false); |
|
1211 |
} |
|
1212 |
} |
|
1213 |
||
1214 |
/*! |
|
1215 |
\typedef QApplication::QS60MainApplicationFactory |
|
1216 |
\since 4.6 |
|
1217 |
||
1218 |
This is a typedef for a pointer to a function with the following |
|
1219 |
signature: |
|
1220 |
||
1221 |
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 47 |
|
1222 |
||
1223 |
\sa QApplication::QApplication() |
|
1224 |
*/ |
|
1225 |
||
1226 |
/*! |
|
1227 |
\since 4.6 |
|
1228 |
||
1229 |
Creates an application using the application factory given in |
|
1230 |
\a factory, and using \a argc command line arguments in \a argv. |
|
1231 |
\a factory can be leaving, but the error will be converted to a |
|
1232 |
standard exception. |
|
1233 |
||
1234 |
This function is only available on S60. |
|
1235 |
*/ |
|
1236 |
QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv) |
|
1237 |
: QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) |
|
1238 |
{ |
|
1239 |
Q_D(QApplication); |
|
1240 |
S60->s60ApplicationFactory = factory; |
|
1241 |
d->construct(); |
|
1242 |
} |
|
1243 |
||
1244 |
QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int _internal) |
|
1245 |
: QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) |
|
1246 |
{ |
|
1247 |
Q_D(QApplication); |
|
1248 |
S60->s60ApplicationFactory = factory; |
|
1249 |
d->construct(); |
|
1250 |
QApplicationPrivate::app_compile_version = _internal; |
|
1251 |
} |
|
1252 |
||
1253 |
void qt_init(QApplicationPrivate * /* priv */, int) |
|
1254 |
{ |
|
1255 |
if (!CCoeEnv::Static()) { |
|
1256 |
// The S60 framework creates a new trap handler which will render any existing traps |
|
1257 |
// invalid as long as it is active. This means that all code in main() that occurs after |
|
1258 |
// the QApplication construction needs to be surrounded by a new trap, despite having |
|
1259 |
// an outer one already. To avoid this, we save the original trap handler here, and set |
|
1260 |
// it back after the S60 framework is constructed. Then we restore it right before the S60 |
|
1261 |
// framework destruction. |
|
1262 |
TTrapHandler *origTrapHandler = User::TrapHandler(); |
|
1263 |
||
1264 |
// The S60 framework has not been initalized. We need to do it. |
|
1265 |
TApaApplicationFactory factory(S60->s60ApplicationFactory ? |
|
1266 |
S60->s60ApplicationFactory : newS60Application); |
|
1267 |
CApaCommandLine* commandLine = 0; |
|
1268 |
TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); |
|
1269 |
// After this construction, CEikonEnv will be available from CEikonEnv::Static(). |
|
1270 |
// (much like our qApp). |
|
1271 |
CEikonEnv* coe = new CEikonEnv; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1272 |
//not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1273 |
if(err == KErrNone) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1274 |
TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine)); |
0 | 1275 |
delete commandLine; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1276 |
if(err != KErrNone) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1277 |
qWarning() << "qt_init: Eikon application construct failed (" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1278 |
<< err |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1279 |
<< "), maybe missing resource file on S60 3.1?"; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1280 |
delete coe; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1281 |
qt_symbian_throwIfError(err); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1282 |
} |
0 | 1283 |
|
1284 |
S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler); |
|
1285 |
||
1286 |
S60->qtOwnsS60Environment = true; |
|
1287 |
} else { |
|
1288 |
S60->qtOwnsS60Environment = false; |
|
1289 |
} |
|
1290 |
||
1291 |
#ifdef QT_NO_DEBUG |
|
1292 |
if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty()) |
|
1293 |
#endif |
|
1294 |
S60->wsSession().SetAutoFlush(ETrue); |
|
1295 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1296 |
#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1297 |
TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL()); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1298 |
#endif |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1299 |
|
0 | 1300 |
S60->updateScreenSize(); |
1301 |
||
1302 |
||
1303 |
TDisplayMode mode = S60->screenDevice()->DisplayMode(); |
|
1304 |
S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode); |
|
1305 |
||
1306 |
//NB: RWsSession::GetColorModeList tells you what window modes are supported, |
|
1307 |
//not what bitmap formats. |
|
1308 |
if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2) |
|
1309 |
S60->supportsPremultipliedAlpha = 0; |
|
1310 |
else |
|
1311 |
S60->supportsPremultipliedAlpha = 1; |
|
1312 |
||
1313 |
RProcess me; |
|
1314 |
TSecureId securId = me.SecureId(); |
|
1315 |
S60->uid = securId.operator TUid(); |
|
1316 |
||
1317 |
// enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app, |
|
1318 |
// and for dimming behind modal windows |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1319 |
S60->windowGroup().EnableFocusChangeEvents(); |
0 | 1320 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1321 |
//Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) |
0 | 1322 |
const TInt KMachineUidSamsungI8510 = 0x2000C51E; |
1323 |
// HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95). |
|
1324 |
// But we know that S60 systems below 5.0 did not support touch. |
|
1325 |
static const bool touchIsUnsupportedOnSystem = |
|
1326 |
QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 |
|
1327 |
|| QSysInfo::s60Version() == QSysInfo::SV_S60_3_2; |
|
1328 |
TInt machineUID; |
|
1329 |
TInt mouse; |
|
1330 |
TInt touch; |
|
1331 |
TInt err; |
|
1332 |
err = HAL::Get(HALData::EMouse, mouse); |
|
1333 |
if (err != KErrNone) |
|
1334 |
mouse = 0; |
|
1335 |
err = HAL::Get(HALData::EMachineUid, machineUID); |
|
1336 |
if (err != KErrNone) |
|
1337 |
machineUID = 0; |
|
1338 |
err = HAL::Get(HALData::EPen, touch); |
|
1339 |
if (err != KErrNone || touchIsUnsupportedOnSystem) |
|
1340 |
touch = 0; |
|
1341 |
#ifdef __WINS__ |
|
1342 |
if(QSysInfo::symbianVersion() <= QSysInfo::SV_9_4) { |
|
1343 |
//for symbian SDK emulator, force values to match typical devices. |
|
1344 |
mouse = 0; |
|
1345 |
touch = touchIsUnsupportedOnSystem ? 0 : 1; |
|
1346 |
} |
|
1347 |
#endif |
|
1348 |
if (mouse || machineUID == KMachineUidSamsungI8510) { |
|
1349 |
S60->hasTouchscreen = false; |
|
1350 |
S60->virtualMouseRequired = false; |
|
1351 |
} |
|
1352 |
else if (!touch) { |
|
1353 |
S60->hasTouchscreen = false; |
|
1354 |
S60->virtualMouseRequired = true; |
|
1355 |
} |
|
1356 |
else { |
|
1357 |
S60->hasTouchscreen = true; |
|
1358 |
S60->virtualMouseRequired = false; |
|
1359 |
} |
|
1360 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1361 |
S60->avkonComponentsSupportTransparency = false; |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1362 |
S60->menuBeingConstructed = false; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1363 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1364 |
#ifdef Q_WS_S60 |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1365 |
TUid KCRUidAvkon = { 0x101F876E }; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1366 |
TUint32 KAknAvkonTransparencyEnabled = 0x0000000D; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1367 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1368 |
CRepository* repository = 0; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1369 |
TRAP(err, repository = CRepository::NewL(KCRUidAvkon)); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1370 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1371 |
if(err == KErrNone) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1372 |
TInt value = 0; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1373 |
err = repository->Get(KAknAvkonTransparencyEnabled, value); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1374 |
if(err == KErrNone) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1375 |
S60->avkonComponentsSupportTransparency = (value==1) ? true : false; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1376 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1377 |
} |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1378 |
#endif |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1379 |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1380 |
#ifdef QT_KEYPAD_NAVIGATION |
0 | 1381 |
if (touch) { |
1382 |
QApplicationPrivate::navigationMode = Qt::NavigationModeNone; |
|
1383 |
} else { |
|
1384 |
QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; |
|
1385 |
} |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1386 |
#endif |
0 | 1387 |
|
1388 |
#ifndef QT_NO_CURSOR |
|
1389 |
//Check if window server pointer cursors are supported or not |
|
1390 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
1391 |
//In generic binary, use the HAL and OS version |
|
1392 |
//Any other known good phones should be added here. |
|
1393 |
if (machineUID == KMachineUidSamsungI8510 || (QSysInfo::symbianVersion() != QSysInfo::SV_9_4 |
|
1394 |
&& QSysInfo::symbianVersion() != QSysInfo::SV_9_3 && QSysInfo::symbianVersion() |
|
1395 |
!= QSysInfo::SV_9_2)) { |
|
1396 |
S60->brokenPointerCursors = false; |
|
1397 |
qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup()); |
|
1398 |
} |
|
1399 |
else |
|
1400 |
S60->brokenPointerCursors = true; |
|
1401 |
#endif |
|
1402 |
||
1403 |
if (S60->mouseInteractionEnabled) { |
|
1404 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
1405 |
if (S60->brokenPointerCursors) { |
|
1406 |
qt_symbian_set_pointer_sprite(Qt::ArrowCursor); |
|
1407 |
qt_symbian_show_pointer_sprite(); |
|
1408 |
} |
|
1409 |
else |
|
1410 |
#endif |
|
1411 |
S60->wsSession().SetPointerCursorMode(EPointerCursorNormal); |
|
1412 |
} |
|
1413 |
#endif |
|
1414 |
||
1415 |
QFont systemFont; |
|
1416 |
systemFont.setFamily(systemFont.defaultFamily()); |
|
1417 |
QApplicationPrivate::setSystemFont(systemFont); |
|
1418 |
||
1419 |
/* |
|
1420 |
### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag |
|
1421 |
int argc = priv->argc; |
|
1422 |
char **argv = priv->argv; |
|
1423 |
||
1424 |
// Get command line params |
|
1425 |
int j = argc ? 1 : 0; |
|
1426 |
for (int i=1; i<argc; i++) { |
|
1427 |
if (argv[i] && *argv[i] != '-') { |
|
1428 |
argv[j++] = argv[i]; |
|
1429 |
continue; |
|
1430 |
} |
|
1431 |
||
1432 |
#if defined(QT_DEBUG) |
|
1433 |
if (qstrcmp(argv[i], "-nograb") == 0) |
|
1434 |
appNoGrab = !appNoGrab; |
|
1435 |
else |
|
1436 |
#endif // QT_DEBUG |
|
1437 |
; |
|
1438 |
} |
|
1439 |
*/ |
|
1440 |
||
1441 |
// Register WId with the metatype system. This is to enable |
|
1442 |
// QWidgetPrivate::create_sys to used delayed slot invokation in order |
|
1443 |
// to destroy WId objects during reparenting. |
|
1444 |
qRegisterMetaType<WId>("WId"); |
|
1445 |
} |
|
1446 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1447 |
extern void qt_cleanup_symbianFontDatabaseExtras(); // qfontdatabase_s60.cpp |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1448 |
|
0 | 1449 |
/***************************************************************************** |
1450 |
qt_cleanup() - cleans up when the application is finished |
|
1451 |
*****************************************************************************/ |
|
1452 |
void qt_cleanup() |
|
1453 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1454 |
if(qt_S60Beep) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1455 |
delete qt_S60Beep; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1456 |
qt_S60Beep = 0; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1457 |
} |
0 | 1458 |
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1459 |
QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1460 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1461 |
qt_cleanup_symbianFontDatabaseExtras(); |
0 | 1462 |
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there |
1463 |
||
1464 |
// It's important that this happens here, before the event dispatcher gets |
|
1465 |
// deleted, because the input context needs the event loop one last time before |
|
1466 |
// it dies. |
|
1467 |
delete QApplicationPrivate::inputContext; |
|
1468 |
QApplicationPrivate::inputContext = 0; |
|
1469 |
||
1470 |
//Change mouse pointer back |
|
1471 |
S60->wsSession().SetPointerCursorMode(EPointerCursorNone); |
|
1472 |
||
1473 |
if (S60->qtOwnsS60Environment) { |
|
1474 |
// Restore the S60 framework trap handler. See qt_init(). |
|
1475 |
User::SetTrapHandler(S60->s60InstalledTrapHandler); |
|
1476 |
||
1477 |
CEikonEnv* coe = CEikonEnv::Static(); |
|
1478 |
coe->PrepareToExit(); |
|
1479 |
// The CEikonEnv itself is destroyed in here. |
|
1480 |
coe->DestroyEnvironment(); |
|
1481 |
} |
|
1482 |
} |
|
1483 |
||
1484 |
void QApplicationPrivate::initializeWidgetPaletteHash() |
|
1485 |
{ |
|
1486 |
// TODO: Implement QApplicationPrivate::initializeWidgetPaletteHash() |
|
1487 |
// Possibly a task fot the S60Style guys |
|
1488 |
} |
|
1489 |
||
1490 |
void QApplicationPrivate::createEventDispatcher() |
|
1491 |
{ |
|
1492 |
Q_Q(QApplication); |
|
1493 |
eventDispatcher = new QEventDispatcherS60(q); |
|
1494 |
} |
|
1495 |
||
1496 |
QString QApplicationPrivate::appName() const |
|
1497 |
{ |
|
1498 |
return QCoreApplicationPrivate::appName(); |
|
1499 |
} |
|
1500 |
||
1501 |
bool QApplicationPrivate::modalState() |
|
1502 |
{ |
|
1503 |
return app_do_modal; |
|
1504 |
} |
|
1505 |
||
1506 |
void QApplicationPrivate::enterModal_sys(QWidget *widget) |
|
1507 |
{ |
|
1508 |
if (widget) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1509 |
static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(ETrue); |
0 | 1510 |
// Modal partial screen dialogs (like queries) capture pointer events. |
1511 |
// ### FixMe: Add specialized behaviour for fullscreen modal dialogs |
|
1512 |
widget->effectiveWinId()->SetGloballyCapturing(ETrue); |
|
1513 |
widget->effectiveWinId()->SetPointerCapture(ETrue); |
|
1514 |
} |
|
1515 |
if (!qt_modal_stack) |
|
1516 |
qt_modal_stack = new QWidgetList; |
|
1517 |
qt_modal_stack->insert(0, widget); |
|
1518 |
app_do_modal = true; |
|
1519 |
} |
|
1520 |
||
1521 |
void QApplicationPrivate::leaveModal_sys(QWidget *widget) |
|
1522 |
{ |
|
1523 |
if (widget) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1524 |
static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(EFalse); |
0 | 1525 |
// ### FixMe: Add specialized behaviour for fullscreen modal dialogs |
1526 |
widget->effectiveWinId()->SetGloballyCapturing(EFalse); |
|
1527 |
widget->effectiveWinId()->SetPointerCapture(EFalse); |
|
1528 |
} |
|
1529 |
if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { |
|
1530 |
if (qt_modal_stack->isEmpty()) { |
|
1531 |
delete qt_modal_stack; |
|
1532 |
qt_modal_stack = 0; |
|
1533 |
} |
|
1534 |
} |
|
1535 |
app_do_modal = qt_modal_stack != 0; |
|
1536 |
} |
|
1537 |
||
1538 |
void QApplicationPrivate::openPopup(QWidget *popup) |
|
1539 |
{ |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1540 |
if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1541 |
static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(ETrue); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1542 |
|
0 | 1543 |
if (!QApplicationPrivate::popupWidgets) |
1544 |
QApplicationPrivate::popupWidgets = new QWidgetList; |
|
1545 |
QApplicationPrivate::popupWidgets->append(popup); |
|
1546 |
||
1547 |
// Cancel focus widget pointer capture and long tap timer |
|
1548 |
if (QApplication::focusWidget()) { |
|
1549 |
static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer(); |
|
1550 |
QApplication::focusWidget()->effectiveWinId()->SetPointerCapture(false); |
|
1551 |
} |
|
1552 |
||
1553 |
if (!qt_nograb()) { |
|
1554 |
// Cancel pointer capture and long tap timer for earlier popup |
|
1555 |
int popupCount = QApplicationPrivate::popupWidgets->count(); |
|
1556 |
if (popupCount > 1) { |
|
1557 |
QWidget* prevPopup = QApplicationPrivate::popupWidgets->at(popupCount-2); |
|
1558 |
static_cast<QSymbianControl*>(prevPopup->effectiveWinId())->CancelLongTapTimer(); |
|
1559 |
prevPopup->effectiveWinId()->SetPointerCapture(false); |
|
1560 |
} |
|
1561 |
||
1562 |
// Enable pointer capture for this (topmost) popup |
|
1563 |
Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); |
|
1564 |
WId id = popup->effectiveWinId(); |
|
1565 |
id->SetPointerCapture(true); |
|
1566 |
} |
|
1567 |
||
1568 |
// popups are not focus-handled by the window system (the first |
|
1569 |
// popup grabbed the keyboard), so we have to do that manually: A |
|
1570 |
// new popup gets the focus |
|
1571 |
QWidget *fw = popup->focusWidget(); |
|
1572 |
if (fw) { |
|
1573 |
fw->setFocus(Qt::PopupFocusReason); |
|
1574 |
} else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup |
|
1575 |
fw = QApplication::focusWidget(); |
|
1576 |
if (fw) { |
|
1577 |
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); |
|
1578 |
q_func()->sendEvent(fw, &e); |
|
1579 |
} |
|
1580 |
} |
|
1581 |
} |
|
1582 |
||
1583 |
void QApplicationPrivate::closePopup(QWidget *popup) |
|
1584 |
{ |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1585 |
if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1586 |
static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(EFalse); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1587 |
|
0 | 1588 |
if (!QApplicationPrivate::popupWidgets) |
1589 |
return; |
|
1590 |
QApplicationPrivate::popupWidgets->removeAll(popup); |
|
1591 |
||
1592 |
// Cancel pointer capture and long tap for this popup |
|
1593 |
WId id = popup->effectiveWinId(); |
|
1594 |
id->SetPointerCapture(false); |
|
1595 |
static_cast<QSymbianControl*>(id)->CancelLongTapTimer(); |
|
1596 |
||
1597 |
if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup |
|
1598 |
delete QApplicationPrivate::popupWidgets; |
|
1599 |
QApplicationPrivate::popupWidgets = 0; |
|
1600 |
if (!qt_nograb()) { // grabbing not disabled |
|
1601 |
Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); |
|
1602 |
if (QWidgetPrivate::mouseGrabber != 0) |
|
1603 |
QWidgetPrivate::mouseGrabber->grabMouse(); |
|
1604 |
||
1605 |
if (QWidgetPrivate::keyboardGrabber != 0) |
|
1606 |
QWidgetPrivate::keyboardGrabber->grabKeyboard(); |
|
1607 |
||
1608 |
QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget() |
|
1609 |
: q_func()->focusWidget(); |
|
1610 |
if (fw) { |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1611 |
if(fw->window()->isModal()) // restore pointer capture for modal window |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1612 |
fw->effectiveWinId()->SetPointerCapture(true); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1613 |
|
0 | 1614 |
if (fw != q_func()->focusWidget()) { |
1615 |
fw->setFocus(Qt::PopupFocusReason); |
|
1616 |
} else { |
|
1617 |
QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); |
|
1618 |
q_func()->sendEvent(fw, &e); |
|
1619 |
} |
|
1620 |
} |
|
1621 |
} |
|
1622 |
} else { |
|
1623 |
||
1624 |
// popups are not focus-handled by the window system (the |
|
1625 |
// first popup grabbed the keyboard), so we have to do that |
|
1626 |
// manually: A popup was closed, so the previous popup gets |
|
1627 |
// the focus. |
|
1628 |
QWidget* aw = QApplicationPrivate::popupWidgets->last(); |
|
1629 |
if (QWidget *fw = QApplication::focusWidget()) { |
|
1630 |
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); |
|
1631 |
q_func()->sendEvent(fw, &e); |
|
1632 |
} |
|
1633 |
||
1634 |
// Enable pointer capture for previous popup |
|
1635 |
if (aw) { |
|
1636 |
aw->effectiveWinId()->SetPointerCapture(true); |
|
1637 |
} |
|
1638 |
} |
|
1639 |
} |
|
1640 |
||
1641 |
QWidget * QApplication::topLevelAt(QPoint const& point) |
|
1642 |
{ |
|
1643 |
QWidget *found = 0; |
|
1644 |
int lowestZ = INT_MAX; |
|
1645 |
QWidgetList list = QApplication::topLevelWidgets(); |
|
1646 |
for (int i = 0; i < list.count(); ++i) { |
|
1647 |
QWidget *widget = list.at(i); |
|
1648 |
if (widget->isVisible() && !(widget->windowType() == Qt::Desktop)) { |
|
1649 |
Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created)); |
|
1650 |
if (widget->geometry().adjusted(0,0,1,1).contains(point)) { |
|
1651 |
// At this point we know there is a Qt widget under the point. |
|
1652 |
// Now we need to make sure it is the top most in the z-order. |
|
1653 |
RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow(); |
|
1654 |
int z = window->OrdinalPosition(); |
|
1655 |
if (z < lowestZ) { |
|
1656 |
lowestZ = z; |
|
1657 |
found = widget; |
|
1658 |
} |
|
1659 |
} |
|
1660 |
} |
|
1661 |
} |
|
1662 |
return found; |
|
1663 |
} |
|
1664 |
||
1665 |
void QApplication::alert(QWidget * /* widget */, int /* duration */) |
|
1666 |
{ |
|
1667 |
// TODO: Implement QApplication::alert(QWidget *widget, int duration) |
|
1668 |
} |
|
1669 |
||
1670 |
int QApplication::doubleClickInterval() |
|
1671 |
{ |
|
1672 |
TTimeIntervalMicroSeconds32 us; |
|
1673 |
TInt distance; |
|
1674 |
S60->wsSession().GetDoubleClickSettings(us, distance); |
|
1675 |
return (us.Int() / 1000); |
|
1676 |
} |
|
1677 |
||
1678 |
void QApplication::setDoubleClickInterval(int ms) |
|
1679 |
{ |
|
1680 |
TTimeIntervalMicroSeconds32 newUs( ms * 1000); |
|
1681 |
TTimeIntervalMicroSeconds32 us; |
|
1682 |
TInt distance; |
|
1683 |
S60->wsSession().GetDoubleClickSettings(us, distance); |
|
1684 |
if (us != newUs) |
|
1685 |
S60->wsSession().SetDoubleClick(newUs, distance); |
|
1686 |
} |
|
1687 |
||
1688 |
int QApplication::keyboardInputInterval() |
|
1689 |
{ |
|
1690 |
return QApplicationPrivate::keyboard_input_time; |
|
1691 |
} |
|
1692 |
||
1693 |
void QApplication::setKeyboardInputInterval(int ms) |
|
1694 |
{ |
|
1695 |
QApplicationPrivate::keyboard_input_time = ms; |
|
1696 |
} |
|
1697 |
||
1698 |
int QApplication::cursorFlashTime() |
|
1699 |
{ |
|
1700 |
return QApplicationPrivate::cursor_flash_time; |
|
1701 |
} |
|
1702 |
||
1703 |
void QApplication::setCursorFlashTime(int msecs) |
|
1704 |
{ |
|
1705 |
QApplicationPrivate::cursor_flash_time = msecs; |
|
1706 |
} |
|
1707 |
||
1708 |
void QApplication::beep() |
|
1709 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1710 |
if (!qt_S60Beep) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1711 |
TInt frequency = 880; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1712 |
TTimeIntervalMicroSeconds duration(500000); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1713 |
TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1714 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1715 |
if (qt_S60Beep) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1716 |
qt_S60Beep->Play(); |
0 | 1717 |
} |
1718 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1719 |
static inline bool callSymbianEventFilters(const QSymbianEvent *event) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1720 |
{ |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1721 |
long unused; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1722 |
return qApp->filterEvent(const_cast<QSymbianEvent *>(event), &unused); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1723 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1724 |
|
0 | 1725 |
/*! |
1726 |
\warning This function is only available on Symbian. |
|
1727 |
\since 4.6 |
|
1728 |
||
1729 |
This function processes an individual Symbian event |
|
1730 |
\a event. It returns 1 if the event was handled, 0 if |
|
1731 |
the \a event was not handled, and -1 if the event was |
|
1732 |
not handled because the event is not known to Qt. |
|
1733 |
*/ |
|
1734 |
||
1735 |
int QApplication::symbianProcessEvent(const QSymbianEvent *event) |
|
1736 |
{ |
|
1737 |
Q_D(QApplication); |
|
1738 |
||
1739 |
QScopedLoopLevelCounter counter(d->threadData); |
|
1740 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1741 |
if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1742 |
return 1; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1743 |
|
0 | 1744 |
QWidget *w = qApp ? qApp->focusWidget() : 0; |
1745 |
if (w) { |
|
1746 |
QInputContext *ic = w->inputContext(); |
|
1747 |
if (ic && ic->symbianFilterEvent(w, event)) |
|
1748 |
return 1; |
|
1749 |
} |
|
1750 |
||
1751 |
if (symbianEventFilter(event)) |
|
1752 |
return 1; |
|
1753 |
||
1754 |
switch (event->type()) { |
|
1755 |
case QSymbianEvent::WindowServerEvent: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1756 |
return d->symbianProcessWsEvent(event); |
0 | 1757 |
case QSymbianEvent::CommandEvent: |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1758 |
return d->symbianHandleCommand(event); |
0 | 1759 |
case QSymbianEvent::ResourceChangeEvent: |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1760 |
return d->symbianResourceChange(event); |
0 | 1761 |
default: |
1762 |
return -1; |
|
1763 |
} |
|
1764 |
} |
|
1765 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1766 |
int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent) |
0 | 1767 |
{ |
1768 |
// Qt event handling. Handle some events regardless of if the handle is in our |
|
1769 |
// widget map or not. |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1770 |
const TWsEvent *event = symbianEvent->windowServerEvent(); |
0 | 1771 |
CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle()); |
1772 |
const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control); |
|
1773 |
switch (event->Type()) { |
|
1774 |
case EEventPointerEnter: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1775 |
if (controlInMap) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1776 |
callSymbianEventFilters(symbianEvent); |
0 | 1777 |
return 1; // Qt::Enter will be generated in HandlePointerL |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1778 |
} |
0 | 1779 |
break; |
1780 |
case EEventPointerExit: |
|
1781 |
if (controlInMap) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1782 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1783 |
return 1; |
0 | 1784 |
if (S60) { |
1785 |
// mouseEvent outside our window, send leave event to last focused widget |
|
1786 |
QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos, |
|
1787 |
Qt::NoButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); |
|
1788 |
if (S60->lastPointerEventTarget) |
|
1789 |
qt_sendSpontaneousEvent(S60->lastPointerEventTarget,&mEvent); |
|
1790 |
S60->lastPointerEventTarget = 0; |
|
1791 |
} |
|
1792 |
return 1; |
|
1793 |
} |
|
1794 |
break; |
|
1795 |
case EEventScreenDeviceChanged: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1796 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1797 |
return 1; |
0 | 1798 |
if (S60) |
1799 |
S60->updateScreenSize(); |
|
1800 |
if (qt_desktopWidget) { |
|
1801 |
QSize oldSize = qt_desktopWidget->size(); |
|
1802 |
qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels); |
|
1803 |
qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels); |
|
1804 |
QResizeEvent e(qt_desktopWidget->size(), oldSize); |
|
1805 |
QApplication::sendEvent(qt_desktopWidget, &e); |
|
1806 |
} |
|
1807 |
return 0; // Propagate to CONE |
|
1808 |
case EEventWindowVisibilityChanged: |
|
1809 |
if (controlInMap) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1810 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1811 |
return 1; |
0 | 1812 |
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); |
1813 |
QWidget *w = QWidgetPrivate::mapper->value(control); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1814 |
QWidget *const window = w->window(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1815 |
if (!window->d_func()->maybeTopData()) |
0 | 1816 |
break; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1817 |
QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; |
0 | 1818 |
if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1819 |
backingStore.widgetHidden(w); |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1820 |
// In order to ensure that any resources used by the window surface |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1821 |
// are immediately freed, we flush the WSERV command buffer. |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1822 |
S60->wsSession().Flush(); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1823 |
} else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1824 |
if (backingStore.data()) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1825 |
backingStore.widgetShown(w); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1826 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1827 |
// Create backing store with an initial reference count of 1 |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1828 |
backingStore.create(window); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1829 |
backingStore.widgetShown(w); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1830 |
w->d_func()->invalidateBuffer(w->rect()); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1831 |
w->repaint(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1832 |
} |
0 | 1833 |
} |
1834 |
return 1; |
|
1835 |
} |
|
1836 |
break; |
|
1837 |
case EEventFocusGained: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1838 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1839 |
return 1; |
0 | 1840 |
#ifndef QT_NO_CURSOR |
1841 |
//re-enable mouse interaction |
|
1842 |
if (S60->mouseInteractionEnabled) { |
|
1843 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
1844 |
if (S60->brokenPointerCursors) |
|
1845 |
qt_symbian_show_pointer_sprite(); |
|
1846 |
else |
|
1847 |
#endif |
|
1848 |
S60->wsSession().SetPointerCursorMode(EPointerCursorNormal); |
|
1849 |
} |
|
1850 |
#endif |
|
1851 |
break; |
|
1852 |
case EEventFocusLost: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1853 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1854 |
return 1; |
0 | 1855 |
#ifndef QT_NO_CURSOR |
1856 |
//disable mouse as may be moving to application that does not support it |
|
1857 |
if (S60->mouseInteractionEnabled) { |
|
1858 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
1859 |
if (S60->brokenPointerCursors) |
|
1860 |
qt_symbian_hide_pointer_sprite(); |
|
1861 |
else |
|
1862 |
#endif |
|
1863 |
S60->wsSession().SetPointerCursorMode(EPointerCursorNone); |
|
1864 |
} |
|
1865 |
#endif |
|
1866 |
break; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1867 |
case KGoomMemoryLowEvent: |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1868 |
#ifdef QT_DEBUG |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1869 |
qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryLowEvent"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1870 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1871 |
if (callSymbianEventFilters(symbianEvent)) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1872 |
return 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1873 |
#ifdef QT_GRAPHICSSYSTEM_RUNTIME |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1874 |
if(QApplicationPrivate::runtime_graphics_system) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1875 |
bool switchToSwRendering(false); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1876 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1877 |
foreach (QWidget *w, QApplication::topLevelWidgets()) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1878 |
if(w->d_func()->topData()->backingStore) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1879 |
switchToSwRendering = true; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1880 |
break; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1881 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1882 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1883 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1884 |
if (switchToSwRendering) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1885 |
QRuntimeGraphicsSystem *gs = |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1886 |
static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1887 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1888 |
uint memoryUsage = gs->memoryUsage(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1889 |
uint memoryForFullscreen = ( S60->screenDepth / 8 ) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1890 |
* S60->screenWidthInPixels |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1891 |
* S60->screenHeightInPixels; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1892 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1893 |
S60->memoryLimitForHwRendering = memoryUsage - memoryForFullscreen; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1894 |
gs->setGraphicsSystem(QLatin1String("raster")); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1895 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1896 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1897 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1898 |
break; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1899 |
case KGoomMemoryGoodEvent: |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1900 |
#ifdef QT_DEBUG |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1901 |
qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryGoodEvent"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1902 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1903 |
if (callSymbianEventFilters(symbianEvent)) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1904 |
return 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1905 |
#ifdef QT_GRAPHICSSYSTEM_RUNTIME |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1906 |
if(QApplicationPrivate::runtime_graphics_system) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1907 |
QRuntimeGraphicsSystem *gs = |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1908 |
static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1909 |
gs->setGraphicsSystem(QLatin1String("openvg"), S60->memoryLimitForHwRendering); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1910 |
S60->memoryLimitForHwRendering = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1911 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1912 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1913 |
break; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1914 |
default: |
0 | 1915 |
break; |
1916 |
} |
|
1917 |
||
1918 |
if (!controlInMap) |
|
1919 |
return -1; |
|
1920 |
||
1921 |
return 0; |
|
1922 |
} |
|
1923 |
||
1924 |
/*! |
|
1925 |
\warning This virtual function is only available on Symbian. |
|
1926 |
\since 4.6 |
|
1927 |
||
1928 |
If you create an application that inherits QApplication and reimplement |
|
1929 |
this function, you get direct access to events that the are received |
|
1930 |
from Symbian. The events are passed in the \a event parameter. |
|
1931 |
||
1932 |
Return true if you want to stop the event from being processed. Return |
|
1933 |
false for normal event dispatching. The default implementation returns |
|
1934 |
false, and does nothing with \a event. |
|
1935 |
*/ |
|
1936 |
bool QApplication::symbianEventFilter(const QSymbianEvent *event) |
|
1937 |
{ |
|
1938 |
Q_UNUSED(event); |
|
1939 |
return false; |
|
1940 |
} |
|
1941 |
||
1942 |
/*! |
|
1943 |
\warning This function is only available on Symbian. |
|
1944 |
\since 4.6 |
|
1945 |
||
1946 |
Handles \a{command}s which are typically handled by |
|
1947 |
CAknAppUi::HandleCommandL(). Qts Ui integration into Symbian is |
|
1948 |
partially achieved by deriving from CAknAppUi. Currently, exit, |
|
1949 |
menu and softkey commands are handled. |
|
1950 |
||
1951 |
\sa s60EventFilter(), s60ProcessEvent() |
|
1952 |
*/ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1953 |
int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent) |
0 | 1954 |
{ |
1955 |
Q_Q(QApplication); |
|
1956 |
int ret = 0; |
|
1957 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1958 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1959 |
return 1; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1960 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1961 |
int command = symbianEvent->command(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1962 |
|
0 | 1963 |
switch (command) { |
1964 |
#ifdef Q_WS_S60 |
|
1965 |
case EAknSoftkeyExit: { |
|
1966 |
QCloseEvent ev; |
|
1967 |
QApplication::sendSpontaneousEvent(q, &ev); |
|
1968 |
if (ev.isAccepted()) { |
|
1969 |
q->quit(); |
|
1970 |
ret = 1; |
|
1971 |
} |
|
1972 |
break; |
|
1973 |
} |
|
1974 |
#endif |
|
1975 |
case EEikCmdExit: |
|
1976 |
q->quit(); |
|
1977 |
ret = 1; |
|
1978 |
break; |
|
1979 |
default: |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1980 |
#ifdef Q_WS_S60 |
0 | 1981 |
bool handled = QSoftKeyManager::handleCommand(command); |
1982 |
if (handled) |
|
1983 |
ret = 1; |
|
1984 |
else |
|
1985 |
ret = QMenuBarPrivate::symbianCommands(command); |
|
1986 |
#endif |
|
1987 |
break; |
|
1988 |
} |
|
1989 |
||
1990 |
return ret; |
|
1991 |
} |
|
1992 |
||
1993 |
/*! |
|
1994 |
\warning This function is only available on Symbian. |
|
1995 |
\since 4.6 |
|
1996 |
||
1997 |
Handles the resource change specified by \a type. |
|
1998 |
||
1999 |
Currently, KEikDynamicLayoutVariantSwitch and |
|
2000 |
KAknsMessageSkinChange are handled. |
|
2001 |
*/ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2002 |
int QApplicationPrivate::symbianResourceChange(const QSymbianEvent *symbianEvent) |
0 | 2003 |
{ |
2004 |
int ret = 0; |
|
2005 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2006 |
int type = symbianEvent->resourceChangeType(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2007 |
|
0 | 2008 |
switch (type) { |
2009 |
#ifdef Q_WS_S60 |
|
2010 |
case KEikDynamicLayoutVariantSwitch: |
|
2011 |
{ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2012 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2013 |
return 1; |
0 | 2014 |
if (S60) |
2015 |
S60->updateScreenSize(); |
|
2016 |
||
2017 |
#ifndef QT_NO_STYLE_S60 |
|
2018 |
QS60Style *s60Style = 0; |
|
2019 |
||
2020 |
#ifndef QT_NO_STYLE_STYLESHEET |
|
2021 |
QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style()); |
|
2022 |
if (proxy) |
|
2023 |
s60Style = qobject_cast<QS60Style*>(proxy->baseStyle()); |
|
2024 |
else |
|
2025 |
#endif |
|
2026 |
s60Style = qobject_cast<QS60Style*>(QApplication::style()); |
|
2027 |
||
2028 |
if (s60Style) { |
|
2029 |
s60Style->d_func()->handleDynamicLayoutVariantSwitch(); |
|
2030 |
ret = 1; |
|
2031 |
} |
|
2032 |
#endif |
|
2033 |
} |
|
2034 |
break; |
|
2035 |
||
2036 |
#ifndef QT_NO_STYLE_S60 |
|
2037 |
case KAknsMessageSkinChange: |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2038 |
if (callSymbianEventFilters(symbianEvent)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
2039 |
return 1; |
0 | 2040 |
if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) { |
2041 |
s60Style->d_func()->handleSkinChange(); |
|
2042 |
ret = 1; |
|
2043 |
} |
|
2044 |
break; |
|
2045 |
#endif |
|
2046 |
#endif // Q_WS_S60 |
|
2047 |
default: |
|
2048 |
break; |
|
2049 |
} |
|
2050 |
||
2051 |
return ret; |
|
2052 |
} |
|
2053 |
||
2054 |
#ifndef QT_NO_WHEELEVENT |
|
2055 |
int QApplication::wheelScrollLines() |
|
2056 |
{ |
|
2057 |
return QApplicationPrivate::wheel_scroll_lines; |
|
2058 |
} |
|
2059 |
||
2060 |
void QApplication::setWheelScrollLines(int n) |
|
2061 |
{ |
|
2062 |
QApplicationPrivate::wheel_scroll_lines = n; |
|
2063 |
} |
|
2064 |
#endif //QT_NO_WHEELEVENT |
|
2065 |
||
2066 |
bool QApplication::isEffectEnabled(Qt::UIEffect /* effect */) |
|
2067 |
{ |
|
2068 |
// TODO: Implement QApplication::isEffectEnabled(Qt::UIEffect effect) |
|
2069 |
return false; |
|
2070 |
} |
|
2071 |
||
2072 |
void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */) |
|
2073 |
{ |
|
2074 |
// TODO: Implement QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) |
|
2075 |
} |
|
2076 |
||
2077 |
TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) |
|
2078 |
{ |
|
2079 |
if (keysym) { |
|
2080 |
// If keysym is specified, cache it. |
|
2081 |
scanCodeCache.insert(scanCode, keysym); |
|
2082 |
return keysym; |
|
2083 |
} else { |
|
2084 |
// If not, retrieve the cached version. |
|
2085 |
return scanCodeCache[scanCode]; |
|
2086 |
} |
|
2087 |
} |
|
2088 |
||
2089 |
void QApplicationPrivate::initializeMultitouch_sys() |
|
2090 |
{ |
|
2091 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2092 |
if (HAL::Get(HALData::EPointer3DPressureSupported, pressureSupported) != KErrNone) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2093 |
pressureSupported = 0; |
0 | 2094 |
if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) |
2095 |
maxTouchPressure = KMaxTInt; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2096 |
#else |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2097 |
pressureSupported = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2098 |
maxTouchPressure = KMaxTInt; |
0 | 2099 |
#endif |
2100 |
} |
|
2101 |
||
2102 |
void QApplicationPrivate::cleanupMultitouch_sys() |
|
2103 |
{ } |
|
2104 |
||
2105 |
#ifndef QT_NO_SESSIONMANAGER |
|
2106 |
QSessionManager::QSessionManager(QApplication * /* app */, QString & /* id */, QString& /* key */) |
|
2107 |
{ |
|
2108 |
||
2109 |
} |
|
2110 |
||
2111 |
QSessionManager::~QSessionManager() |
|
2112 |
{ |
|
2113 |
||
2114 |
} |
|
2115 |
||
2116 |
bool QSessionManager::allowsInteraction() |
|
2117 |
{ |
|
2118 |
return false; |
|
2119 |
} |
|
2120 |
||
2121 |
void QSessionManager::cancel() |
|
2122 |
{ |
|
2123 |
||
2124 |
} |
|
2125 |
#endif //QT_NO_SESSIONMANAGER |
|
2126 |
||
2127 |
#ifdef QT_KEYPAD_NAVIGATION |
|
2128 |
/* |
|
2129 |
* Show/Hide the mouse cursor depending on phone type and chosen mode |
|
2130 |
*/ |
|
2131 |
void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode) |
|
2132 |
{ |
|
2133 |
#ifndef QT_NO_CURSOR |
|
2134 |
const bool wasCursorOn = (QApplicationPrivate::navigationMode == Qt::NavigationModeCursorAuto |
|
2135 |
&& !S60->hasTouchscreen) |
|
2136 |
|| QApplicationPrivate::navigationMode == Qt::NavigationModeCursorForceVisible; |
|
2137 |
const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto |
|
2138 |
&& !S60->hasTouchscreen) |
|
2139 |
|| mode == Qt::NavigationModeCursorForceVisible; |
|
2140 |
||
2141 |
if (!wasCursorOn && isCursorOn) { |
|
2142 |
//Show the cursor, when changing from another mode to cursor mode |
|
2143 |
qt_symbian_set_cursor_visible(true); |
|
2144 |
} |
|
2145 |
else if (wasCursorOn && !isCursorOn) { |
|
2146 |
//Hide the cursor, when leaving cursor mode |
|
2147 |
qt_symbian_set_cursor_visible(false); |
|
2148 |
} |
|
2149 |
#endif |
|
2150 |
QApplicationPrivate::navigationMode = mode; |
|
2151 |
} |
|
2152 |
#endif |
|
2153 |
||
2154 |
#ifndef QT_NO_CURSOR |
|
2155 |
/***************************************************************************** |
|
2156 |
QApplication cursor stack |
|
2157 |
*****************************************************************************/ |
|
2158 |
||
2159 |
void QApplication::setOverrideCursor(const QCursor &cursor) |
|
2160 |
{ |
|
2161 |
qApp->d_func()->cursor_list.prepend(cursor); |
|
2162 |
qt_symbian_setGlobalCursor(cursor); |
|
2163 |
} |
|
2164 |
||
2165 |
void QApplication::restoreOverrideCursor() |
|
2166 |
{ |
|
2167 |
if (qApp->d_func()->cursor_list.isEmpty()) |
|
2168 |
return; |
|
2169 |
qApp->d_func()->cursor_list.removeFirst(); |
|
2170 |
||
2171 |
if (!qApp->d_func()->cursor_list.isEmpty()) { |
|
2172 |
qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first()); |
|
2173 |
} |
|
2174 |
else { |
|
2175 |
//determine which widget has focus |
|
2176 |
QWidget *w = QApplication::widgetAt(QCursor::pos()); |
|
2177 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
2178 |
if (S60->brokenPointerCursors) { |
|
2179 |
qt_symbian_set_pointer_sprite(w ? w->cursor() : Qt::ArrowCursor); |
|
2180 |
} |
|
2181 |
else |
|
2182 |
#endif |
|
2183 |
{ |
|
2184 |
//because of the internals of window server, we need to force the cursor |
|
2185 |
//to be set in all child windows too, otherwise when the cursor is over |
|
2186 |
//the child window it may show a widget cursor or arrow cursor instead, |
|
2187 |
//depending on construction order. |
|
2188 |
QListIterator<WId> iter(QWidgetPrivate::mapper->uniqueKeys()); |
|
2189 |
while (iter.hasNext()) { |
|
2190 |
CCoeControl *ctrl = iter.next(); |
|
2191 |
if(ctrl->OwnsWindow()) { |
|
2192 |
ctrl->DrawableWindow()->ClearPointerCursor(); |
|
2193 |
} |
|
2194 |
} |
|
2195 |
if (w) |
|
2196 |
qt_symbian_setWindowCursor(w->cursor(), w->effectiveWinId()); |
|
2197 |
else |
|
2198 |
qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup()); |
|
2199 |
} |
|
2200 |
} |
|
2201 |
} |
|
2202 |
||
2203 |
#endif // QT_NO_CURSOR |
|
2204 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2205 |
QS60ThreadLocalData::QS60ThreadLocalData() |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2206 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2207 |
CCoeEnv *env = CCoeEnv::Static(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2208 |
if (env) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2209 |
//if this is the UI thread, share objects owned by CONE |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2210 |
usingCONEinstances = true; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2211 |
wsSession = env->WsSession(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2212 |
screenDevice = env->ScreenDevice(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2213 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2214 |
else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2215 |
usingCONEinstances = false; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2216 |
qt_symbian_throwIfError(wsSession.Connect(qt_s60GetRFs())); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2217 |
screenDevice = new CWsScreenDevice(wsSession); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2218 |
screenDevice->Construct(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2219 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2220 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2221 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2222 |
QS60ThreadLocalData::~QS60ThreadLocalData() |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2223 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2224 |
if (!usingCONEinstances) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2225 |
delete screenDevice; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2226 |
wsSession.Close(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2227 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2228 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
2229 |
|
0 | 2230 |
QT_END_NAMESPACE |