1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QGUIAPPLICATION_QPA_P_H
43 #define QGUIAPPLICATION_QPA_P_H
45 #include <QtGui/qguiapplication.h>
47 #include <QtCore/QPointF>
48 #include <QtCore/private/qcoreapplication_p.h>
50 #include <QtCore/private/qthread_p.h>
52 #include <QWindowSystemInterface>
53 #include "private/qwindowsysteminterface_qpa_p.h"
54 #include "QtGui/qplatformintegration_qpa.h"
62 class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
64 Q_DECLARE_PUBLIC(QGuiApplication)
66 QGuiApplicationPrivate(int &argc, char **argv, int flags);
67 ~QGuiApplicationPrivate();
69 void createPlatformIntegration();
70 void createEventDispatcher();
71 void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
73 virtual void notifyLayoutDirectionChange();
74 virtual void notifyActiveWindowChange(QWindow *previous);
76 static Qt::KeyboardModifiers modifier_buttons;
77 static Qt::MouseButtons mouse_buttons;
79 static QPlatformIntegration *platform_integration;
81 static QPlatformIntegration *platformIntegration()
82 { return platform_integration; }
95 static uint currentKeyPlatform();
97 static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
98 { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
100 static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
101 static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
102 static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
103 static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
105 static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
107 static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e);
109 static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
110 static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
112 static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
113 static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
115 static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
117 static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e);
118 static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
119 static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
121 static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e);
122 static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e);
124 static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
126 static Qt::DropAction processDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
127 static Qt::DropAction processDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
129 static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
131 if (!(alignment & Qt::AlignHorizontal_Mask))
132 alignment |= Qt::AlignLeft;
133 if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) {
134 if (direction == Qt::RightToLeft)
135 alignment ^= (Qt::AlignLeft | Qt::AlignRight);
136 alignment |= Qt::AlignAbsolute;
141 static void emitLastWindowClosed();
143 QPixmap getPixmapCursor(Qt::CursorShape cshape);
145 static QGuiApplicationPrivate *instance() { return self; }
147 static bool app_do_modal;
149 static Qt::MouseButtons buttons;
150 static ulong mousePressTime;
151 static Qt::MouseButton mousePressButton;
152 static int mousePressX;
153 static int mousePressY;
154 static int mouse_double_click_distance;
155 static QPointF lastCursorPosition;
157 #ifndef QT_NO_CLIPBOARD
158 static QClipboard *qt_clipboard;
161 static QPalette *app_pal;
163 static QWindowList window_list;
164 static QWindow *active_window;
167 QList<QCursor> cursor_list;
169 static QList<QScreen *> screen_list;
171 static QFont *app_font;
173 QStyleHints *styleHints;
174 QInputPanel *inputPanel;
176 static bool quitOnLastWindowClosed;
182 static QGuiApplicationPrivate *self;
184 QMap<int, QWeakPointer<QWindow> > windowForTouchPointId;
185 QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
192 #endif // QGUIAPPLICATION_QPA_P_H