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