1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** GNU General Public License Usage
31 ** Alternatively, this file may be used under the terms of the GNU
32 ** General Public License version 3.0 as published by the Free Software
33 ** Foundation and appearing in the file LICENSE.GPL included in the
34 ** packaging of this file. Please review the following information to
35 ** ensure the GNU General Public License version 3.0 requirements will be
36 ** met: http://www.gnu.org/copyleft/gpl.html.
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 "QtGui/private/qshortcutmap_p.h"
69 #include <private/qthread_p.h>
70 #include "QtCore/qpoint.h"
71 #include <QTime>
72 #ifdef Q_WS_QWS
73 #include "QtGui/qscreen_qws.h"
74 #include <private/qgraphicssystem_qws_p.h>
75 #endif
76 #ifdef Q_OS_SYMBIAN
77 #include <w32std.h>
78 #endif
79 #ifdef Q_WS_QPA
80 #include <QWindowSystemInterface>
81 #include "qwindowsysteminterface_qpa_p.h"
82 #include "QtGui/qplatformintegration_qpa.h"
83 #endif
84
85 QT_BEGIN_NAMESPACE
86
87 class QClipboard;
88 class QGraphicsScene;
89 class QGraphicsSystem;
90 class QInputContext;
91 class QObject;
92 class QWidget;
93 class QSocketNotifier;
94 #ifndef QT_NO_GESTURES
95 class QGestureManager;
96 #endif
97
98 extern bool qt_is_gui_used;
99 #ifndef QT_NO_CLIPBOARD
100 extern QClipboard *qt_clipboard;
101 #endif
102
103 #if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE)
104 extern QSysInfo::WinVersion qt_winver;
105 enum { QT_TABLET_NPACKETQSIZE = 128 };
106 # ifdef Q_OS_WINCE
107 extern DWORD qt_cever;
108 # endif
109 #elif defined (Q_OS_MAC)
110 extern QSysInfo::MacVersion qt_macver;
111 #endif
112 #if defined(Q_WS_QWS)
113 class QWSManager;
114 class QDirectPainter;
115 struct QWSServerCleaner { ~QWSServerCleaner(); };
116 #endif
117
118 #ifndef QT_NO_TABLET
119 struct QTabletDeviceData
120 {
121 #ifndef Q_WS_MAC
122 int minPressure;
123 int maxPressure;
124 int minTanPressure;
125 int maxTanPressure;
126 int minX, maxX, minY, maxY, minZ, maxZ;
127 inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int outExtentX,
128 int outOriginY, int outExtentY) const;
129 #endif
130
131 #if defined(Q_WS_X11) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA))
132 QPointer<QWidget> widgetToGetPress;
133 #endif
134
135 #ifdef Q_WS_X11
136 int deviceType;
137 enum {
138 TOTAL_XINPUT_EVENTS = 64
139 };
140 void *device;
141 int eventCount;
142 long unsigned int eventList[TOTAL_XINPUT_EVENTS]; // XEventClass is in fact a long unsigned int
143
144 int xinput_motion;
145 int xinput_key_press;
146 int xinput_key_release;
147 int xinput_button_press;
148 int xinput_button_release;
149 int xinput_proximity_in;
150 int xinput_proximity_out;
151 #elif defined(Q_WS_WIN)
152 qint64 llId;
153 int currentDevice;
154 int currentPointerType;
155 #elif defined(Q_WS_MAC)
156 quint64 tabletUniqueID;
157 int tabletDeviceType;
158 int tabletPointerType;
159 int capabilityMask;
160 #endif
161 };
162
sign(int x)163 static inline int sign(int x)
164 {
165 return x >= 0 ? 1 : -1;
166 }
167
168 #ifndef Q_WS_MAC
scaleCoord(int coordX,int coordY,int outOriginX,int outExtentX,int outOriginY,int outExtentY)169 inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY,
170 int outOriginX, int outExtentX,
171 int outOriginY, int outExtentY) const
172 {
173 QPointF ret;
174
175 if (sign(outExtentX) == sign(maxX))
176 ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX);
177 else
178 ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX)))
179 + outOriginX);
180
181 if (sign(outExtentY) == sign(maxY))
182 ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY);
183 else
184 ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY)))
185 + outOriginY);
186
187 return ret;
188 }
189 #endif
190
191 typedef QList<QTabletDeviceData> QTabletDeviceDataList;
192 QTabletDeviceDataList *qt_tablet_devices();
193 # if defined(Q_WS_MAC)
194 typedef QHash<int, QTabletDeviceData> QMacTabletHash;
195 QMacTabletHash *qt_mac_tablet_hash();
196 # endif
197 #endif
198
199 #ifdef QT3_SUPPORT
200 extern "C" {
201 typedef bool (*Ptrqt_tryAccelEvent)(QWidget *w, QKeyEvent *e);
202 typedef bool (*Ptrqt_tryComposeUnicode)(QWidget *w, QKeyEvent *e);
203 typedef bool (*Ptrqt_dispatchAccelEvent)(QWidget *w, QKeyEvent *e);
204 }
205 #endif
206
207 #if defined(Q_WS_WIN)
208 typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
209 typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
210 typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
211
212 #ifndef QT_NO_GESTURES
213 typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
214 typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
215 typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
216 typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT);
217 typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT);
218
219 typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND);
220 typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
221 typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL);
222
223 #ifndef WM_GESTURE
224 # define WM_GESTURE 0x0119
225
226 # define GID_BEGIN 1
227 # define GID_END 2
228 # define GID_ZOOM 3
229 # define GID_PAN 4
230 # define GID_ROTATE 5
231 # define GID_TWOFINGERTAP 6
232 # define GID_ROLLOVER 7
233
234 typedef struct tagGESTUREINFO
235 {
236 UINT cbSize;
237 DWORD dwFlags;
238 DWORD dwID;
239 HWND hwndTarget;
240 POINTS ptsLocation;
241 DWORD dwInstanceID;
242 DWORD dwSequenceID;
243 ULONGLONG ullArguments;
244 UINT cbExtraArgs;
245 } GESTUREINFO;
246
247 # define GC_PAN 0x00000001
248 # define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
249 # define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
250
251 # define GC_ZOOM 0x00000001
252 # define GC_ROTATE 0x00000001
253
254 typedef struct tagGESTURECONFIG
255 {
256 DWORD dwID;
257 DWORD dwWant;
258 DWORD dwBlock;
259 } GESTURECONFIG;
260
261 # define GID_ROTATE_ANGLE_FROM_ARGUMENT(arg) ((((double)(arg) / 65535.0) * 4.0 * 3.14159265) - 2.0*3.14159265)
262
263 #endif // WM_GESTURE
264
265 #if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
266 #undef GID_ZOOM
267 #define GID_ZOOM 0xf000
268 #undef GID_ROTATE
269 #define GID_ROTATE 0xf001
270 #undef GID_TWOFINGERTAP
271 #define GID_TWOFINGERTAP 0xf002
272 #undef GID_ROLLOVER
273 #define GID_ROLLOVER 0xf003
274 #endif
275
276 #endif // QT_NO_GESTURES
277
278 #endif // Q_WS_WIN
279
280 typedef QHash<QByteArray, QFont> FontHash;
281 FontHash *qt_app_fonts_hash();
282
283 typedef QHash<QByteArray, QPalette> PaletteHash;
284 PaletteHash *qt_app_palettes_hash();
285
286 class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate
287 {
288 Q_DECLARE_PUBLIC(QApplication)
289 public:
290 QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags);
291 ~QApplicationPrivate();
292
293 #if defined(Q_WS_X11)
294 #ifndef QT_NO_SETTINGS
295 static bool x11_apply_settings();
296 #endif
297 static void reset_instance_pointer();
298 #elif defined(Q_WS_QWS)
299 static bool qws_apply_settings();
300 static QWidget *findWidget(const QObjectList&, const QPoint &, bool rec);
301 #endif
302 static bool quitOnLastWindowClosed;
303 static void emitLastWindowClosed();
304 #ifdef Q_WS_WINCE
305 static int autoMaximizeThreshold;
306 #endif
307 static bool autoSipEnabled;
308 static QString desktopStyleKey();
309
graphicsSystem()310 static QGraphicsSystem *graphicsSystem()
311 #if defined(Q_WS_QWS)
312 { return QScreen::instance()->graphicsSystem(); }
313 #else
314 { return graphics_system; }
315 #endif
316
317 #if defined(Q_WS_QPA)
platformIntegration()318 static QPlatformIntegration *platformIntegration()
319 { return platform_integration; }
320
qt_qpa_core_dispatcher()321 static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
322 { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
323 #endif
324
325 void createEventDispatcher();
326 QString appName() const;
327 static void dispatchEnterLeave(QWidget *enter, QWidget *leave);
328
329 //modality
330 static void enterModal(QWidget*);
331 static void leaveModal(QWidget*);
332 static void enterModal_sys(QWidget*);
333 static void leaveModal_sys(QWidget*);
334 static bool isBlockedByModal(QWidget *widget);
335 static bool modalState();
336 static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0);
337 #ifdef Q_WS_MAC
338 static QWidget *tryModalHelper_sys(QWidget *top);
339 bool canQuit();
340 #endif
341
342 bool notify_helper(QObject *receiver, QEvent * e);
343
344 void construct(
345 #ifdef Q_WS_X11
346 Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0
347 #endif
348 );
349 void initialize();
350 void process_cmdline();
351
352 #if defined(Q_WS_X11)
353 static void x11_initialize_style();
354 #endif
355
356 enum KeyPlatform {
357 KB_Win = 1,
358 KB_Mac = 2,
359 KB_X11 = 4,
360 KB_KDE = 8,
361 KB_Gnome = 16,
362 KB_CDE = 32,
363 KB_S60 = 64,
364 KB_All = 0xffff
365 };
366
367 static uint currentPlatform();
368 bool inPopupMode() const;
369 void closePopup(QWidget *popup);
370 void openPopup(QWidget *popup);
371 static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
372 static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next);
373
374 #ifndef QT_NO_SESSIONMANAGER
375 QSessionManager *session_manager;
376 QString session_id;
377 QString session_key;
378 bool is_session_restored;
379 #endif
380
381 #ifndef QT_NO_CURSOR
382 QList<QCursor> cursor_list;
383 #endif
384 #ifndef QT_NO_GRAPHICSVIEW
385 // Maintain a list of all scenes to ensure font and palette propagation to
386 // all scenes.
387 QList<QGraphicsScene *> scene_list;
388 #endif
389
390 QBasicTimer toolTipWakeUp, toolTipFallAsleep;
391 QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos;
392 QPointer<QWidget> toolTipWidget;
393 #ifndef QT_NO_SHORTCUT
394 QShortcutMap shortcutMap;
395 #endif
396
397 #ifdef QT3_SUPPORT
398 bool qt_compat_used;
399 bool qt_compat_resolved;
400 Ptrqt_tryAccelEvent qt_tryAccelEvent;
401 Ptrqt_tryComposeUnicode qt_tryComposeUnicode;
402 Ptrqt_dispatchAccelEvent qt_dispatchAccelEvent;
403
use_compat()404 bool use_compat() {
405 return qt_tryAccelEvent
406 && qt_tryComposeUnicode
407 && qt_dispatchAccelEvent;
408 }
409 #endif
410 static QInputContext *inputContext;
411 #ifdef Q_OS_SYMBIAN
412 static bool inputContextBeingCreated;
413 #endif
414 static Qt::MouseButtons mouse_buttons;
415 static Qt::KeyboardModifiers modifier_buttons;
416
417 static QSize app_strut;
418 static QWidgetList *popupWidgets;
419 static QStyle *app_style;
420 static int app_cspec;
421 static QPalette *app_pal;
422 static QPalette *sys_pal;
423 static QPalette *set_pal;
424 static QGraphicsSystem *graphics_system;
425 static QString graphics_system_name;
426 static bool runtime_graphics_system;
427 #ifdef Q_WS_QPA
428 static QPlatformIntegration *platform_integration;
429 #endif
430
431 private:
432 static QFont *app_font; // private for a reason! Always use QApplication::font() instead!
433 public:
434 static QFont *sys_font;
435 static QFont *set_font;
436 static QWidget *main_widget;
437 static QWidget *focus_widget;
438 static QWidget *hidden_focus_widget;
439 static QWidget *active_window;
440 static QIcon *app_icon;
441 static bool obey_desktop_settings;
442 static int cursor_flash_time;
443 static int mouse_double_click_time;
444 static int keyboard_input_time;
445 #ifndef QT_NO_WHEELEVENT
446 static int wheel_scroll_lines;
447 #endif
448
449 static bool animate_ui;
450 static bool animate_menu;
451 static bool animate_tooltip;
452 static bool animate_combo;
453 static bool fade_menu;
454 static bool fade_tooltip;
455 static bool animate_toolbox;
456 static bool widgetCount; // Coupled with -widgetcount switch
457 static bool load_testability; // Coupled with -testability switch
458
459 #ifdef Q_WS_MAC
460 static bool native_modal_dialog_active;
461 #endif
462
463 static void setSystemPalette(const QPalette &pal);
464 static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
465 static void initializeWidgetPaletteHash();
466 static void setSystemFont(const QFont &font);
467
468 #if defined(Q_WS_X11)
469 static void applyX11SpecificCommandLineArguments(QWidget *main_widget);
470 #elif defined(Q_WS_QWS)
471 static void applyQWSSpecificCommandLineArguments(QWidget *main_widget);
472 #endif
473
474 #ifdef Q_WS_MAC
475 static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *);
476 static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long);
477 static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *);
478 #ifdef QT_MAC_USE_COCOA
479 static void qt_initAfterNSAppStarted();
480 static void setupAppleEvents();
481 #endif
482 static bool qt_mac_apply_settings();
483 #endif
484
485 #ifdef Q_WS_QPA
486 static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
487 static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
488 static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
489 static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
490 static void processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e);
491
492 static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
493
494 static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e);
495
496 static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
497 static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
498
499 static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
500
501 static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
502 static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
503
504 // static void reportScreenCount(int count);
505 static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e);
506 // static void reportGeometryChange(int screenIndex);
507 static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
508 // static void reportAvailableGeometryChange(int screenIndex);
509 static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
510 static void reportLocaleChange();
511 #endif
512
513 #ifdef Q_WS_QWS
514 QPointer<QWSManager> last_manager;
515 QWSServerCleaner qwsServerCleaner;
516 # ifndef QT_NO_DIRECTPAINTER
517 QMap<WId, QDirectPainter *> *directPainters;
518 # endif
maxWindowRect(const QScreen * screen)519 QRect maxWindowRect(const QScreen *screen) const { return maxWindowRects[screen]; }
520 void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect);
521 void setScreenTransformation(QScreen *screen, int screenNo, int transformation);
522 #endif
523
instance()524 static QApplicationPrivate *instance() { return self; }
525
526 static QString styleOverride;
527
528 #ifdef QT_KEYPAD_NAVIGATION
529 static QWidget *oldEditFocus;
530 static Qt::NavigationMode navigationMode;
531 #endif
532
533 #if defined(Q_WS_MAC) || defined(Q_WS_X11)
534 void _q_alertTimeOut();
535 QHash<QWidget *, QTimer *> alertTimerHash;
536 #endif
537 #ifndef QT_NO_STYLE_STYLESHEET
538 static QString styleSheet;
539 #endif
540 static QPointer<QWidget> leaveAfterRelease;
541 static QWidget *pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos,
542 QEvent::Type type, Qt::MouseButtons buttons,
543 QWidget *buttonDown, QWidget *alienWidget);
544 static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget,
545 QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
546 bool spontaneous = true);
547 #ifdef Q_OS_SYMBIAN
548 static void setNavigationMode(Qt::NavigationMode mode);
549 static TUint resolveS60ScanCode(TInt scanCode, TUint keysym);
550 QSet<WId> nativeWindows;
551
552 int symbianProcessWsEvent(const QSymbianEvent *symbianEvent);
553 int symbianHandleCommand(const QSymbianEvent *symbianEvent);
554 int symbianResourceChange(const QSymbianEvent *symbianEvent);
555 void symbianHandleLiteModeStartup();
556
557 void _q_aboutToQuit();
558
559 void emitAboutToReleaseGpuResources();
560 void emitAboutToUseGpuResources();
561 #endif
562 #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA)
563 void sendSyntheticEnterLeave(QWidget *widget);
564 #endif
565
566 #ifndef QT_NO_GESTURES
567 QGestureManager *gestureManager;
568 QWidget *gestureWidget;
569 #endif
570 #if defined(Q_WS_X11) || defined(Q_WS_WIN)
571 QPixmap *move_cursor;
572 QPixmap *copy_cursor;
573 QPixmap *link_cursor;
574 #endif
575 #if defined(Q_WS_WIN)
576 QPixmap *ignore_cursor;
577 #endif
578 QPixmap getPixmapCursor(Qt::CursorShape cshape);
579
580 QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId;
581 QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
582 static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
583 void initializeMultitouch();
584 void initializeMultitouch_sys();
585 void cleanupMultitouch();
586 void cleanupMultitouch_sys();
587 int findClosestTouchPointId(const QPointF &screenPos);
588 void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
589 void removeTouchPoint(int touchPointId);
590 static void translateRawTouchEvent(QWidget *widget,
591 QTouchEvent::DeviceType deviceType,
592 const QList<QTouchEvent::TouchPoint> &touchPoints);
593
594 #if defined(Q_WS_WIN)
595 static bool HasTouchSupport;
596 static PtrRegisterTouchWindow RegisterTouchWindow;
597 static PtrGetTouchInputInfo GetTouchInputInfo;
598 static PtrCloseTouchInputHandle CloseTouchInputHandle;
599
600 QHash<DWORD, int> touchInputIDToTouchPointID;
601 bool translateTouchEvent(const MSG &msg);
602
603 #ifndef QT_NO_GESTURES
604 PtrGetGestureInfo GetGestureInfo;
605 PtrGetGestureExtraArgs GetGestureExtraArgs;
606 PtrCloseGestureInfoHandle CloseGestureInfoHandle;
607 PtrSetGestureConfig SetGestureConfig;
608 PtrGetGestureConfig GetGestureConfig;
609 PtrBeginPanningFeedback BeginPanningFeedback;
610 PtrUpdatePanningFeedback UpdatePanningFeedback;
611 PtrEndPanningFeedback EndPanningFeedback;
612 #endif // QT_NO_GESTURES
613 #endif
614
615 #ifdef QT_RX71_MULTITOUCH
616 bool hasRX71MultiTouch;
617
618 struct RX71TouchPointState {
619 QSocketNotifier *socketNotifier;
620 QTouchEvent::TouchPoint touchPoint;
621
622 int minX, maxX, scaleX;
623 int minY, maxY, scaleY;
624 int minZ, maxZ;
625 };
626 QList<RX71TouchPointState> allRX71TouchPoints;
627
628 bool readRX71MultiTouchEvents(int deviceNumber);
629 void fakeMouseEventFromRX71TouchEvent();
630 void _q_readRX71MultiTouchEvents();
631 #endif
632
633 #if defined(Q_OS_SYMBIAN)
634 int pressureSupported;
635 int maxTouchPressure;
636 QList<QTouchEvent::TouchPoint> appAllTouchPoints;
637
638 bool useTranslucentEGLSurfaces;
639 #endif
640
641 private:
642 #ifdef Q_WS_QWS
643 QMap<const QScreen*, QRect> maxWindowRects;
644 #endif
645
646 #ifdef Q_OS_SYMBIAN
647 QHash<TInt, TUint> scanCodeCache;
648 #endif
649
650 static QApplicationPrivate *self;
651
652 static void giveFocusAccordingToFocusPolicy(QWidget *w,
653 Qt::FocusPolicy focusPolicy,
654 Qt::FocusReason focusReason);
655 static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy);
656
657
658 static bool isAlien(QWidget *);
659 };
660
661 Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
662 QTouchEvent::DeviceType deviceType,
663 const QList<QTouchEvent::TouchPoint> &touchPoints);
664
665 #if defined(Q_WS_WIN)
666 extern void qt_win_set_cursor(QWidget *, bool);
667 #elif defined(Q_WS_X11)
668 extern void qt_x11_enforce_cursor(QWidget *, bool);
669 extern void qt_x11_enforce_cursor(QWidget *);
670 #elif defined(Q_OS_SYMBIAN)
671 extern void qt_symbian_set_cursor(QWidget *, bool);
672 #elif defined (Q_WS_QPA)
673 extern void qt_qpa_set_cursor(QWidget *, bool);
674 #endif
675
676 QT_END_NAMESPACE
677
678 #endif // QAPPLICATION_P_H
679