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 #ifndef QWINDOWSYSTEMINTERFACE_H
42 #define QWINDOWSYSTEMINTERFACE_H
43
44 #include <QtCore/QTime>
45 #include <QtGui/qwindowdefs.h>
46 #include <QtCore/QEvent>
47 #include <QtGui/QWidget>
48 #include <QtCore/QWeakPointer>
49 #include <QtCore/QMutex>
50 #include <QtGui/QTouchEvent>
51
52 QT_BEGIN_HEADER
53
54 QT_BEGIN_NAMESPACE
55
QT_MODULE(Gui)56 QT_MODULE(Gui)
57
58 class Q_GUI_EXPORT QWindowSystemInterface
59 {
60 public:
61 static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
62 static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
63
64 static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
65 static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
66
67 static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
68 quint32 nativeScanCode, quint32 nativeVirtualKey,
69 quint32 nativeModifiers,
70 const QString& text = QString(), bool autorep = false,
71 ushort count = 1);
72 static void handleExtendedKeyEvent(QWidget *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
73 quint32 nativeScanCode, quint32 nativeVirtualKey,
74 quint32 nativeModifiers,
75 const QString& text = QString(), bool autorep = false,
76 ushort count = 1);
77
78 static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
79 static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
80
81 struct TouchPoint {
82 int id; // for application use
83 bool isPrimary; // for application use
84 QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
85 QRectF area; // the touched area, centered at position in screen coordinates
86 qreal pressure; // 0 to 1
87 Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
88 };
89
90 static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
91 static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
92
93 static void handleGeometryChange(QWidget *w, const QRect &newRect);
94 static void handleCloseEvent(QWidget *w);
95 static void handleEnterEvent(QWidget *w);
96 static void handleLeaveEvent(QWidget *w);
97 static void handleWindowActivated(QWidget *w);
98 static void handleWindowStateChanged(QWidget *w, Qt::WindowState newState);
99
100 // Changes to the screen
101 static void handleScreenGeometryChange(int screenIndex);
102 static void handleScreenAvailableGeometryChange(int screenIndex);
103 static void handleScreenCountChange(int count);
104
105 static void handleLocaleChange();
106
107 static void handlePlatformPanelEvent(QWidget *w);
108 };
109
110 QT_END_NAMESPACE
111 QT_END_HEADER
112 #endif // QWINDOWSYSTEMINTERFACE_H
113