|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
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 #ifndef QAPPLICATION_P_H |
|
43 #define QAPPLICATION_P_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists for the convenience |
|
50 // of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp |
|
51 // and many other. This header file may change from version to version |
|
52 // without notice, or even be removed. |
|
53 // |
|
54 // We mean it. |
|
55 // |
|
56 |
|
57 #include "QtGui/qapplication.h" |
|
58 #include "QtGui/qevent.h" |
|
59 #include "QtGui/qfont.h" |
|
60 #include "QtGui/qcursor.h" |
|
61 #include "QtGui/qregion.h" |
|
62 #include "QtCore/qmutex.h" |
|
63 #include "QtCore/qtranslator.h" |
|
64 #include "QtCore/qbasictimer.h" |
|
65 #include "QtCore/qhash.h" |
|
66 #include "QtCore/qpointer.h" |
|
67 #include "private/qcoreapplication_p.h" |
|
68 #include "private/qshortcutmap_p.h" |
|
69 #include <private/qthread_p.h> |
|
70 #ifdef Q_WS_QWS |
|
71 #include "QtGui/qscreen_qws.h" |
|
72 #include <private/qgraphicssystem_qws_p.h> |
|
73 #endif |
|
74 #ifdef Q_OS_SYMBIAN |
|
75 #include <w32std.h> |
|
76 #endif |
|
77 |
|
78 QT_BEGIN_NAMESPACE |
|
79 |
|
80 class QClipboard; |
|
81 class QGraphicsScene; |
|
82 class QGraphicsSystem; |
|
83 class QInputContext; |
|
84 class QObject; |
|
85 class QWidget; |
|
86 class QSocketNotifier; |
|
87 class QGestureManager; |
|
88 |
|
89 extern bool qt_is_gui_used; |
|
90 #ifndef QT_NO_CLIPBOARD |
|
91 extern QClipboard *qt_clipboard; |
|
92 #endif |
|
93 |
|
94 #if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) |
|
95 extern QSysInfo::WinVersion qt_winver; |
|
96 enum { QT_TABLET_NPACKETQSIZE = 128 }; |
|
97 # ifdef Q_OS_WINCE |
|
98 extern DWORD qt_cever; |
|
99 # endif |
|
100 #elif defined (Q_OS_MAC) |
|
101 extern QSysInfo::MacVersion qt_macver; |
|
102 #endif |
|
103 #if defined(Q_WS_QWS) |
|
104 class QWSManager; |
|
105 class QDirectPainter; |
|
106 struct QWSServerCleaner { ~QWSServerCleaner(); }; |
|
107 #endif |
|
108 |
|
109 #ifndef QT_NO_TABLET |
|
110 struct QTabletDeviceData |
|
111 { |
|
112 #ifndef Q_WS_MAC |
|
113 int minPressure; |
|
114 int maxPressure; |
|
115 int minTanPressure; |
|
116 int maxTanPressure; |
|
117 int minX, maxX, minY, maxY, minZ, maxZ; |
|
118 inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int outExtentX, |
|
119 int outOriginY, int outExtentY) const; |
|
120 #endif |
|
121 |
|
122 #if defined(Q_WS_X11) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) |
|
123 QPointer<QWidget> widgetToGetPress; |
|
124 #endif |
|
125 |
|
126 #ifdef Q_WS_X11 |
|
127 int deviceType; |
|
128 enum { |
|
129 TOTAL_XINPUT_EVENTS = 64 |
|
130 }; |
|
131 void *device; |
|
132 int eventCount; |
|
133 long unsigned int eventList[TOTAL_XINPUT_EVENTS]; // XEventClass is in fact a long unsigned int |
|
134 |
|
135 int xinput_motion; |
|
136 int xinput_key_press; |
|
137 int xinput_key_release; |
|
138 int xinput_button_press; |
|
139 int xinput_button_release; |
|
140 int xinput_proximity_in; |
|
141 int xinput_proximity_out; |
|
142 #elif defined(Q_WS_WIN) |
|
143 qint64 llId; |
|
144 int currentDevice; |
|
145 int currentPointerType; |
|
146 #elif defined(Q_WS_MAC) |
|
147 quint64 tabletUniqueID; |
|
148 int tabletDeviceType; |
|
149 int tabletPointerType; |
|
150 int capabilityMask; |
|
151 #endif |
|
152 }; |
|
153 |
|
154 static inline int sign(int x) |
|
155 { |
|
156 return x >= 0 ? 1 : -1; |
|
157 } |
|
158 |
|
159 #ifndef Q_WS_MAC |
|
160 inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY, |
|
161 int outOriginX, int outExtentX, |
|
162 int outOriginY, int outExtentY) const |
|
163 { |
|
164 QPointF ret; |
|
165 |
|
166 if (sign(outExtentX) == sign(maxX)) |
|
167 ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX); |
|
168 else |
|
169 ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) |
|
170 + outOriginX); |
|
171 |
|
172 if (sign(outExtentY) == sign(maxY)) |
|
173 ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY); |
|
174 else |
|
175 ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) |
|
176 + outOriginY); |
|
177 |
|
178 return ret; |
|
179 } |
|
180 #endif |
|
181 |
|
182 typedef QList<QTabletDeviceData> QTabletDeviceDataList; |
|
183 QTabletDeviceDataList *qt_tablet_devices(); |
|
184 # if defined(Q_WS_MAC) |
|
185 typedef QHash<int, QTabletDeviceData> QMacTabletHash; |
|
186 QMacTabletHash *qt_mac_tablet_hash(); |
|
187 # endif |
|
188 #endif |
|
189 |
|
190 #ifdef QT3_SUPPORT |
|
191 extern "C" { |
|
192 typedef bool (*Ptrqt_tryAccelEvent)(QWidget *w, QKeyEvent *e); |
|
193 typedef bool (*Ptrqt_tryComposeUnicode)(QWidget *w, QKeyEvent *e); |
|
194 typedef bool (*Ptrqt_dispatchAccelEvent)(QWidget *w, QKeyEvent *e); |
|
195 } |
|
196 #endif |
|
197 |
|
198 #if defined(Q_WS_WIN) |
|
199 typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG); |
|
200 typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int); |
|
201 typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE); |
|
202 |
|
203 typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID); |
|
204 typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE); |
|
205 typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE); |
|
206 typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT); |
|
207 typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT); |
|
208 |
|
209 typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND); |
|
210 typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL); |
|
211 typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL); |
|
212 |
|
213 #ifndef WM_GESTURE |
|
214 # define WM_GESTURE 0x0119 |
|
215 |
|
216 # define GID_BEGIN 1 |
|
217 # define GID_END 2 |
|
218 # define GID_ZOOM 3 |
|
219 # define GID_PAN 4 |
|
220 # define GID_ROTATE 5 |
|
221 # define GID_TWOFINGERTAP 6 |
|
222 # define GID_ROLLOVER 7 |
|
223 |
|
224 typedef struct tagGESTUREINFO |
|
225 { |
|
226 UINT cbSize; |
|
227 DWORD dwFlags; |
|
228 DWORD dwID; |
|
229 HWND hwndTarget; |
|
230 POINTS ptsLocation; |
|
231 DWORD dwInstanceID; |
|
232 DWORD dwSequenceID; |
|
233 ULONGLONG ullArguments; |
|
234 UINT cbExtraArgs; |
|
235 } GESTUREINFO; |
|
236 |
|
237 # define GC_PAN 0x00000001 |
|
238 # define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002 |
|
239 # define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004 |
|
240 |
|
241 # define GC_ZOOM 0x00000001 |
|
242 # define GC_ROTATE 0x00000001 |
|
243 |
|
244 typedef struct tagGESTURECONFIG |
|
245 { |
|
246 DWORD dwID; |
|
247 DWORD dwWant; |
|
248 DWORD dwBlock; |
|
249 } GESTURECONFIG; |
|
250 |
|
251 # define GID_ROTATE_ANGLE_FROM_ARGUMENT(arg) ((((double)(arg) / 65535.0) * 4.0 * 3.14159265) - 2.0*3.14159265) |
|
252 |
|
253 #endif // WM_GESTURE |
|
254 |
|
255 #if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES) |
|
256 #undef GID_ZOOM |
|
257 #define GID_ZOOM 0xf000 |
|
258 #undef GID_ROTATE |
|
259 #define GID_ROTATE 0xf001 |
|
260 #undef GID_TWOFINGERTAP |
|
261 #define GID_TWOFINGERTAP 0xf002 |
|
262 #undef GID_ROLLOVER |
|
263 #define GID_ROLLOVER 0xf003 |
|
264 #endif |
|
265 |
|
266 #endif // Q_WS_WIN |
|
267 |
|
268 class QScopedLoopLevelCounter |
|
269 { |
|
270 QThreadData *threadData; |
|
271 public: |
|
272 QScopedLoopLevelCounter(QThreadData *threadData) |
|
273 : threadData(threadData) |
|
274 { ++threadData->loopLevel; } |
|
275 ~QScopedLoopLevelCounter() |
|
276 { --threadData->loopLevel; } |
|
277 }; |
|
278 |
|
279 typedef QHash<QByteArray, QFont> FontHash; |
|
280 FontHash *qt_app_fonts_hash(); |
|
281 |
|
282 typedef QHash<QByteArray, QPalette> PaletteHash; |
|
283 PaletteHash *qt_app_palettes_hash(); |
|
284 |
|
285 class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate |
|
286 { |
|
287 Q_DECLARE_PUBLIC(QApplication) |
|
288 public: |
|
289 QApplicationPrivate(int &argc, char **argv, QApplication::Type type); |
|
290 ~QApplicationPrivate(); |
|
291 |
|
292 #if defined(Q_WS_X11) |
|
293 #ifndef QT_NO_SETTINGS |
|
294 static bool x11_apply_settings(); |
|
295 #endif |
|
296 static void reset_instance_pointer(); |
|
297 #elif defined(Q_WS_QWS) |
|
298 static bool qws_apply_settings(); |
|
299 static QWidget *findWidget(const QObjectList&, const QPoint &, bool rec); |
|
300 #endif |
|
301 static bool quitOnLastWindowClosed; |
|
302 static void emitLastWindowClosed(); |
|
303 #ifdef Q_WS_WINCE |
|
304 static int autoMaximizeThreshold; |
|
305 #endif |
|
306 static bool autoSipEnabled; |
|
307 static QString desktopStyleKey(); |
|
308 |
|
309 static QGraphicsSystem *graphicsSystem() |
|
310 #if !defined(Q_WS_QWS) |
|
311 { return graphics_system; } |
|
312 #else |
|
313 { return QScreen::instance()->graphicsSystem(); } |
|
314 #endif |
|
315 |
|
316 void createEventDispatcher(); |
|
317 QString appName() const; |
|
318 static void dispatchEnterLeave(QWidget *enter, QWidget *leave); |
|
319 |
|
320 //modality |
|
321 static void enterModal(QWidget*); |
|
322 static void leaveModal(QWidget*); |
|
323 static void enterModal_sys(QWidget*); |
|
324 static void leaveModal_sys(QWidget*); |
|
325 static bool isBlockedByModal(QWidget *widget); |
|
326 static bool modalState(); |
|
327 static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0); |
|
328 #ifdef Q_WS_MAC |
|
329 static QWidget *tryModalHelper_sys(QWidget *top); |
|
330 bool canQuit(); |
|
331 #endif |
|
332 |
|
333 bool notify_helper(QObject *receiver, QEvent * e); |
|
334 |
|
335 void construct( |
|
336 #ifdef Q_WS_X11 |
|
337 Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0 |
|
338 #endif |
|
339 ); |
|
340 void initialize(); |
|
341 void process_cmdline(); |
|
342 |
|
343 #if defined(Q_WS_X11) |
|
344 static void x11_initialize_style(); |
|
345 #endif |
|
346 |
|
347 enum KeyPlatform { |
|
348 KB_Win = 1, |
|
349 KB_Mac = 2, |
|
350 KB_X11 = 4, |
|
351 KB_KDE = 8, |
|
352 KB_Gnome = 16, |
|
353 KB_CDE = 32, |
|
354 KB_S60 = 64, |
|
355 KB_All = 0xffff |
|
356 }; |
|
357 |
|
358 static uint currentPlatform(); |
|
359 bool inPopupMode() const; |
|
360 void closePopup(QWidget *popup); |
|
361 void openPopup(QWidget *popup); |
|
362 static void setFocusWidget(QWidget *focus, Qt::FocusReason reason); |
|
363 static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next); |
|
364 |
|
365 #ifndef QT_NO_SESSIONMANAGER |
|
366 QSessionManager *session_manager; |
|
367 QString session_id; |
|
368 QString session_key; |
|
369 bool is_session_restored; |
|
370 #endif |
|
371 |
|
372 #ifndef QT_NO_CURSOR |
|
373 QList<QCursor> cursor_list; |
|
374 #endif |
|
375 #ifndef QT_NO_GRAPHICSVIEW |
|
376 // Maintain a list of all scenes to ensure font and palette propagation to |
|
377 // all scenes. |
|
378 QList<QGraphicsScene *> scene_list; |
|
379 #endif |
|
380 |
|
381 QBasicTimer toolTipWakeUp, toolTipFallAsleep; |
|
382 QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos; |
|
383 QPointer<QWidget> toolTipWidget; |
|
384 #ifndef QT_NO_SHORTCUT |
|
385 QShortcutMap shortcutMap; |
|
386 #endif |
|
387 |
|
388 #ifdef QT3_SUPPORT |
|
389 bool qt_compat_used; |
|
390 bool qt_compat_resolved; |
|
391 Ptrqt_tryAccelEvent qt_tryAccelEvent; |
|
392 Ptrqt_tryComposeUnicode qt_tryComposeUnicode; |
|
393 Ptrqt_dispatchAccelEvent qt_dispatchAccelEvent; |
|
394 |
|
395 bool use_compat() { |
|
396 return qt_tryAccelEvent |
|
397 && qt_tryComposeUnicode |
|
398 && qt_dispatchAccelEvent; |
|
399 } |
|
400 #endif |
|
401 static QInputContext *inputContext; |
|
402 |
|
403 static Qt::MouseButtons mouse_buttons; |
|
404 static Qt::KeyboardModifiers modifier_buttons; |
|
405 |
|
406 static QSize app_strut; |
|
407 static QWidgetList *popupWidgets; |
|
408 static QStyle *app_style; |
|
409 static int app_cspec; |
|
410 static QPalette *app_pal; |
|
411 static QPalette *sys_pal; |
|
412 static QPalette *set_pal; |
|
413 static QGraphicsSystem *graphics_system; |
|
414 static QString graphics_system_name; |
|
415 |
|
416 private: |
|
417 static QFont *app_font; // private for a reason! Always use QApplication::font() instead! |
|
418 public: |
|
419 static QFont *sys_font; |
|
420 static QFont *set_font; |
|
421 static QWidget *main_widget; |
|
422 static QWidget *focus_widget; |
|
423 static QWidget *hidden_focus_widget; |
|
424 static QWidget *active_window; |
|
425 static QIcon *app_icon; |
|
426 static bool obey_desktop_settings; |
|
427 static int cursor_flash_time; |
|
428 static int mouse_double_click_time; |
|
429 static int keyboard_input_time; |
|
430 static int wheel_scroll_lines; |
|
431 |
|
432 static bool animate_ui; |
|
433 static bool animate_menu; |
|
434 static bool animate_tooltip; |
|
435 static bool animate_combo; |
|
436 static bool fade_menu; |
|
437 static bool fade_tooltip; |
|
438 static bool animate_toolbox; |
|
439 static bool widgetCount; // Coupled with -widgetcount switch |
|
440 static bool load_testability; // Coupled with -testability switch |
|
441 #ifdef Q_WS_MAC |
|
442 static bool native_modal_dialog_active; |
|
443 #endif |
|
444 #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) |
|
445 static bool inSizeMove; |
|
446 #endif |
|
447 |
|
448 static void setSystemPalette(const QPalette &pal); |
|
449 static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); |
|
450 static void initializeWidgetPaletteHash(); |
|
451 static void setSystemFont(const QFont &font); |
|
452 |
|
453 #if defined(Q_WS_X11) |
|
454 static void applyX11SpecificCommandLineArguments(QWidget *main_widget); |
|
455 #elif defined(Q_WS_QWS) |
|
456 static void applyQWSSpecificCommandLineArguments(QWidget *main_widget); |
|
457 #endif |
|
458 |
|
459 #ifdef Q_WS_MAC |
|
460 static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *); |
|
461 static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long); |
|
462 static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *); |
|
463 static bool qt_mac_apply_settings(); |
|
464 #endif |
|
465 |
|
466 #ifdef Q_WS_QWS |
|
467 QPointer<QWSManager> last_manager; |
|
468 QWSServerCleaner qwsServerCleaner; |
|
469 # ifndef QT_NO_DIRECTPAINTER |
|
470 QMap<WId, QDirectPainter *> *directPainters; |
|
471 # endif |
|
472 QRect maxWindowRect(const QScreen *screen) const { return maxWindowRects[screen]; } |
|
473 void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect); |
|
474 void setScreenTransformation(QScreen *screen, int screenNo, int transformation); |
|
475 #endif |
|
476 |
|
477 static QApplicationPrivate *instance() { return self; } |
|
478 |
|
479 static QString styleOverride; |
|
480 |
|
481 static int app_compile_version; |
|
482 |
|
483 #ifdef QT_KEYPAD_NAVIGATION |
|
484 static QWidget *oldEditFocus; |
|
485 static Qt::NavigationMode navigationMode; |
|
486 #endif |
|
487 |
|
488 #if defined(Q_WS_MAC) || defined(Q_WS_X11) |
|
489 void _q_alertTimeOut(); |
|
490 QHash<QWidget *, QTimer *> alertTimerHash; |
|
491 #endif |
|
492 #ifndef QT_NO_STYLE_STYLESHEET |
|
493 static QString styleSheet; |
|
494 #endif |
|
495 static QPointer<QWidget> leaveAfterRelease; |
|
496 static QWidget *pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos, |
|
497 QEvent::Type type, Qt::MouseButtons buttons, |
|
498 QWidget *buttonDown, QWidget *alienWidget); |
|
499 static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget, |
|
500 QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver, |
|
501 bool spontaneous = true); |
|
502 #ifdef Q_OS_SYMBIAN |
|
503 static void setNavigationMode(Qt::NavigationMode mode); |
|
504 static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); |
|
505 QSet<WId> nativeWindows; |
|
506 |
|
507 int symbianProcessWsEvent(const TWsEvent *event); |
|
508 int symbianHandleCommand(int command); |
|
509 int symbianResourceChange(int type); |
|
510 |
|
511 #endif |
|
512 #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) |
|
513 void sendSyntheticEnterLeave(QWidget *widget); |
|
514 #endif |
|
515 |
|
516 QGestureManager *gestureManager; |
|
517 |
|
518 QMap<int, QWidget *> widgetForTouchPointId; |
|
519 QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints; |
|
520 static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); |
|
521 void initializeMultitouch(); |
|
522 void initializeMultitouch_sys(); |
|
523 void cleanupMultitouch(); |
|
524 void cleanupMultitouch_sys(); |
|
525 int findClosestTouchPointId(const QPointF &screenPos); |
|
526 void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); |
|
527 void removeTouchPoint(int touchPointId); |
|
528 static void translateRawTouchEvent(QWidget *widget, |
|
529 QTouchEvent::DeviceType deviceType, |
|
530 const QList<QTouchEvent::TouchPoint> &touchPoints); |
|
531 |
|
532 #if defined(Q_WS_WIN) |
|
533 static PtrRegisterTouchWindow RegisterTouchWindow; |
|
534 static PtrGetTouchInputInfo GetTouchInputInfo; |
|
535 static PtrCloseTouchInputHandle CloseTouchInputHandle; |
|
536 |
|
537 QHash<DWORD, int> touchInputIDToTouchPointID; |
|
538 bool translateTouchEvent(const MSG &msg); |
|
539 |
|
540 PtrGetGestureInfo GetGestureInfo; |
|
541 PtrGetGestureExtraArgs GetGestureExtraArgs; |
|
542 PtrCloseGestureInfoHandle CloseGestureInfoHandle; |
|
543 PtrSetGestureConfig SetGestureConfig; |
|
544 PtrGetGestureConfig GetGestureConfig; |
|
545 PtrBeginPanningFeedback BeginPanningFeedback; |
|
546 PtrUpdatePanningFeedback UpdatePanningFeedback; |
|
547 PtrEndPanningFeedback EndPanningFeedback; |
|
548 #endif |
|
549 |
|
550 #ifdef QT_RX71_MULTITOUCH |
|
551 bool hasRX71MultiTouch; |
|
552 |
|
553 struct RX71TouchPointState { |
|
554 QSocketNotifier *socketNotifier; |
|
555 QTouchEvent::TouchPoint touchPoint; |
|
556 |
|
557 int minX, maxX, scaleX; |
|
558 int minY, maxY, scaleY; |
|
559 int minZ, maxZ; |
|
560 }; |
|
561 QList<RX71TouchPointState> allRX71TouchPoints; |
|
562 |
|
563 bool readRX71MultiTouchEvents(int deviceNumber); |
|
564 void fakeMouseEventFromRX71TouchEvent(); |
|
565 void _q_readRX71MultiTouchEvents(); |
|
566 #endif |
|
567 |
|
568 #if defined(Q_WS_S60) |
|
569 int maxTouchPressure; |
|
570 QList<QTouchEvent::TouchPoint> appAllTouchPoints; |
|
571 #endif |
|
572 |
|
573 private: |
|
574 #ifdef Q_WS_QWS |
|
575 QMap<const QScreen*, QRect> maxWindowRects; |
|
576 #endif |
|
577 |
|
578 #ifdef Q_OS_SYMBIAN |
|
579 static QHash<TInt, TUint> scanCodeCache; |
|
580 #endif |
|
581 |
|
582 static QApplicationPrivate *self; |
|
583 |
|
584 static void giveFocusAccordingToFocusPolicy(QWidget *w, |
|
585 Qt::FocusPolicy focusPolicy, |
|
586 Qt::FocusReason focusReason); |
|
587 static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy); |
|
588 |
|
589 |
|
590 static bool isAlien(QWidget *); |
|
591 }; |
|
592 |
|
593 Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, |
|
594 QTouchEvent::DeviceType deviceType, |
|
595 const QList<QTouchEvent::TouchPoint> &touchPoints); |
|
596 |
|
597 #if defined(Q_WS_WIN) |
|
598 extern void qt_win_set_cursor(QWidget *, bool); |
|
599 #elif defined(Q_WS_X11) |
|
600 extern void qt_x11_enforce_cursor(QWidget *, bool); |
|
601 extern void qt_x11_enforce_cursor(QWidget *); |
|
602 #elif defined(Q_OS_SYMBIAN) |
|
603 extern void qt_symbian_set_cursor(QWidget *, bool); |
|
604 #endif |
|
605 |
|
606 QT_END_NAMESPACE |
|
607 |
|
608 #endif // QAPPLICATION_P_H |