1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
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 [email protected].
|
---|
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 | #ifndef QT_NO_IM
|
---|
402 | static QInputContext *inputContext;
|
---|
403 | #endif
|
---|
404 | static Qt::MouseButtons mouse_buttons;
|
---|
405 | static Qt::KeyboardModifiers modifier_buttons;
|
---|
406 |
|
---|
407 | static QSize app_strut;
|
---|
408 | static QWidgetList *popupWidgets;
|
---|
409 | static QStyle *app_style;
|
---|
410 | static int app_cspec;
|
---|
411 | static QPalette *app_pal;
|
---|
412 | static QPalette *sys_pal;
|
---|
413 | static QPalette *set_pal;
|
---|
414 | static QGraphicsSystem *graphics_system;
|
---|
415 | static QString graphics_system_name;
|
---|
416 |
|
---|
417 | private:
|
---|
418 | static QFont *app_font; // private for a reason! Always use QApplication::font() instead!
|
---|
419 | public:
|
---|
420 | static QFont *sys_font;
|
---|
421 | static QFont *set_font;
|
---|
422 | static QWidget *main_widget;
|
---|
423 | static QWidget *focus_widget;
|
---|
424 | static QWidget *hidden_focus_widget;
|
---|
425 | static QWidget *active_window;
|
---|
426 | static QIcon *app_icon;
|
---|
427 | static bool obey_desktop_settings;
|
---|
428 | static int cursor_flash_time;
|
---|
429 | static int mouse_double_click_time;
|
---|
430 | static int keyboard_input_time;
|
---|
431 | static int wheel_scroll_lines;
|
---|
432 |
|
---|
433 | static bool animate_ui;
|
---|
434 | static bool animate_menu;
|
---|
435 | static bool animate_tooltip;
|
---|
436 | static bool animate_combo;
|
---|
437 | static bool fade_menu;
|
---|
438 | static bool fade_tooltip;
|
---|
439 | static bool animate_toolbox;
|
---|
440 | static bool widgetCount; // Coupled with -widgetcount switch
|
---|
441 | static bool load_testability; // Coupled with -testability switch
|
---|
442 | #ifdef Q_WS_MAC
|
---|
443 | static bool native_modal_dialog_active;
|
---|
444 | #endif
|
---|
445 |
|
---|
446 | static void setSystemPalette(const QPalette &pal);
|
---|
447 | static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
|
---|
448 | static void initializeWidgetPaletteHash();
|
---|
449 | static void setSystemFont(const QFont &font);
|
---|
450 |
|
---|
451 | #if defined(Q_WS_X11)
|
---|
452 | static void applyX11SpecificCommandLineArguments(QWidget *main_widget);
|
---|
453 | #elif defined(Q_WS_QWS)
|
---|
454 | static void applyQWSSpecificCommandLineArguments(QWidget *main_widget);
|
---|
455 | #endif
|
---|
456 |
|
---|
457 | #ifdef Q_WS_MAC
|
---|
458 | static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *);
|
---|
459 | static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long);
|
---|
460 | static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *);
|
---|
461 | static bool qt_mac_apply_settings();
|
---|
462 | #endif
|
---|
463 |
|
---|
464 | #ifdef Q_WS_QWS
|
---|
465 | QPointer<QWSManager> last_manager;
|
---|
466 | QWSServerCleaner qwsServerCleaner;
|
---|
467 | # ifndef QT_NO_DIRECTPAINTER
|
---|
468 | QMap<WId, QDirectPainter *> *directPainters;
|
---|
469 | # endif
|
---|
470 | QRect maxWindowRect(const QScreen *screen) const { return maxWindowRects[screen]; }
|
---|
471 | void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect);
|
---|
472 | void setScreenTransformation(QScreen *screen, int screenNo, int transformation);
|
---|
473 | #endif
|
---|
474 |
|
---|
475 | static QApplicationPrivate *instance() { return self; }
|
---|
476 |
|
---|
477 | static QString styleOverride;
|
---|
478 |
|
---|
479 | static int app_compile_version;
|
---|
480 |
|
---|
481 | #ifdef QT_KEYPAD_NAVIGATION
|
---|
482 | static QWidget *oldEditFocus;
|
---|
483 | static Qt::NavigationMode navigationMode;
|
---|
484 | #endif
|
---|
485 |
|
---|
486 | #if defined(Q_WS_MAC) || defined(Q_WS_X11)
|
---|
487 | void _q_alertTimeOut();
|
---|
488 | QHash<QWidget *, QTimer *> alertTimerHash;
|
---|
489 | #endif
|
---|
490 | #ifndef QT_NO_STYLE_STYLESHEET
|
---|
491 | static QString styleSheet;
|
---|
492 | #endif
|
---|
493 | static QPointer<QWidget> leaveAfterRelease;
|
---|
494 | static QWidget *pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos,
|
---|
495 | QEvent::Type type, Qt::MouseButtons buttons,
|
---|
496 | QWidget *buttonDown, QWidget *alienWidget);
|
---|
497 | static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget,
|
---|
498 | QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
|
---|
499 | bool spontaneous = true);
|
---|
500 | #ifdef Q_OS_SYMBIAN
|
---|
501 | static void setNavigationMode(Qt::NavigationMode mode);
|
---|
502 | static TUint resolveS60ScanCode(TInt scanCode, TUint keysym);
|
---|
503 | QSet<WId> nativeWindows;
|
---|
504 |
|
---|
505 | int symbianProcessWsEvent(const TWsEvent *event);
|
---|
506 | int symbianHandleCommand(int command);
|
---|
507 | int symbianResourceChange(int type);
|
---|
508 |
|
---|
509 | #endif
|
---|
510 | #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_PM)
|
---|
511 | void sendSyntheticEnterLeave(QWidget *widget);
|
---|
512 | #endif
|
---|
513 | #if defined(Q_WS_PM) && !defined(QT_NO_SESSIONMANAGER)
|
---|
514 | bool canQuit();
|
---|
515 | #endif
|
---|
516 |
|
---|
517 | QGestureManager *gestureManager;
|
---|
518 | QWidget *gestureWidget;
|
---|
519 |
|
---|
520 | QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId;
|
---|
521 | QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
|
---|
522 | static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
|
---|
523 | void initializeMultitouch();
|
---|
524 | void initializeMultitouch_sys();
|
---|
525 | void cleanupMultitouch();
|
---|
526 | void cleanupMultitouch_sys();
|
---|
527 | int findClosestTouchPointId(const QPointF &screenPos);
|
---|
528 | void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
|
---|
529 | void removeTouchPoint(int touchPointId);
|
---|
530 | static void translateRawTouchEvent(QWidget *widget,
|
---|
531 | QTouchEvent::DeviceType deviceType,
|
---|
532 | const QList<QTouchEvent::TouchPoint> &touchPoints);
|
---|
533 |
|
---|
534 | #if defined(Q_WS_WIN)
|
---|
535 | static PtrRegisterTouchWindow RegisterTouchWindow;
|
---|
536 | static PtrGetTouchInputInfo GetTouchInputInfo;
|
---|
537 | static PtrCloseTouchInputHandle CloseTouchInputHandle;
|
---|
538 |
|
---|
539 | QHash<DWORD, int> touchInputIDToTouchPointID;
|
---|
540 | bool translateTouchEvent(const MSG &msg);
|
---|
541 |
|
---|
542 | PtrGetGestureInfo GetGestureInfo;
|
---|
543 | PtrGetGestureExtraArgs GetGestureExtraArgs;
|
---|
544 | PtrCloseGestureInfoHandle CloseGestureInfoHandle;
|
---|
545 | PtrSetGestureConfig SetGestureConfig;
|
---|
546 | PtrGetGestureConfig GetGestureConfig;
|
---|
547 | PtrBeginPanningFeedback BeginPanningFeedback;
|
---|
548 | PtrUpdatePanningFeedback UpdatePanningFeedback;
|
---|
549 | PtrEndPanningFeedback EndPanningFeedback;
|
---|
550 | #endif
|
---|
551 |
|
---|
552 | #ifdef QT_RX71_MULTITOUCH
|
---|
553 | bool hasRX71MultiTouch;
|
---|
554 |
|
---|
555 | struct RX71TouchPointState {
|
---|
556 | QSocketNotifier *socketNotifier;
|
---|
557 | QTouchEvent::TouchPoint touchPoint;
|
---|
558 |
|
---|
559 | int minX, maxX, scaleX;
|
---|
560 | int minY, maxY, scaleY;
|
---|
561 | int minZ, maxZ;
|
---|
562 | };
|
---|
563 | QList<RX71TouchPointState> allRX71TouchPoints;
|
---|
564 |
|
---|
565 | bool readRX71MultiTouchEvents(int deviceNumber);
|
---|
566 | void fakeMouseEventFromRX71TouchEvent();
|
---|
567 | void _q_readRX71MultiTouchEvents();
|
---|
568 | #endif
|
---|
569 |
|
---|
570 | #if defined(Q_WS_S60)
|
---|
571 | int maxTouchPressure;
|
---|
572 | QList<QTouchEvent::TouchPoint> appAllTouchPoints;
|
---|
573 | #endif
|
---|
574 |
|
---|
575 | private:
|
---|
576 | #ifdef Q_WS_QWS
|
---|
577 | QMap<const QScreen*, QRect> maxWindowRects;
|
---|
578 | #endif
|
---|
579 |
|
---|
580 | #ifdef Q_OS_SYMBIAN
|
---|
581 | static QHash<TInt, TUint> scanCodeCache;
|
---|
582 | #endif
|
---|
583 |
|
---|
584 | static QApplicationPrivate *self;
|
---|
585 |
|
---|
586 | static void giveFocusAccordingToFocusPolicy(QWidget *w,
|
---|
587 | Qt::FocusPolicy focusPolicy,
|
---|
588 | Qt::FocusReason focusReason);
|
---|
589 | static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy);
|
---|
590 |
|
---|
591 |
|
---|
592 | static bool isAlien(QWidget *);
|
---|
593 | };
|
---|
594 |
|
---|
595 | Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
|
---|
596 | QTouchEvent::DeviceType deviceType,
|
---|
597 | const QList<QTouchEvent::TouchPoint> &touchPoints);
|
---|
598 |
|
---|
599 | #if defined(Q_WS_WIN)
|
---|
600 | extern void qt_win_set_cursor(QWidget *, bool);
|
---|
601 | #elif defined(Q_WS_X11)
|
---|
602 | extern void qt_x11_enforce_cursor(QWidget *, bool);
|
---|
603 | extern void qt_x11_enforce_cursor(QWidget *);
|
---|
604 | #elif defined(Q_OS_SYMBIAN)
|
---|
605 | extern void qt_symbian_set_cursor(QWidget *, bool);
|
---|
606 | #elif defined(Q_WS_PM)
|
---|
607 | extern void qt_pm_set_cursor(QWidget *, bool);
|
---|
608 | #endif
|
---|
609 |
|
---|
610 | QT_END_NAMESPACE
|
---|
611 |
|
---|
612 | #endif // QAPPLICATION_P_H
|
---|