1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QEVDEVMOUSEMANAGER_P_H |
5 | #define QEVDEVMOUSEMANAGER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qevdevmousehandler_p.h" |
19 | |
20 | #include <QtInputSupport/private/devicehandlerlist_p.h> |
21 | |
22 | #include <QObject> |
23 | #include <QHash> |
24 | #include <QSocketNotifier> |
25 | #include <QPoint> |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QDeviceDiscovery; |
30 | |
31 | class QEvdevMouseManager : public QObject |
32 | { |
33 | public: |
34 | QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = nullptr); |
35 | ~QEvdevMouseManager(); |
36 | |
37 | void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons, |
38 | Qt::MouseButton button, QEvent::Type type); |
39 | void handleWheelEvent(QPoint delta); |
40 | |
41 | void addMouse(const QString &deviceNode = QString()); |
42 | void removeMouse(const QString &deviceNode); |
43 | |
44 | private: |
45 | void clampPosition(); |
46 | void updateDeviceCount(); |
47 | |
48 | QString m_spec; |
49 | QtInputSupport::DeviceHandlerList<QEvdevMouseHandler> m_mice; |
50 | int m_x; |
51 | int m_y; |
52 | int m_xoffset; |
53 | int m_yoffset; |
54 | }; |
55 | |
56 | QT_END_NAMESPACE |
57 | |
58 | #endif // QEVDEVMOUSEMANAGER_P_H |
59 | |