1// Copyright (C) 2020 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 QEVDEVMOUSEHANDLER_P_H
5#define QEVDEVMOUSEHANDLER_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 <QObject>
19#include <QString>
20#include <QPoint>
21#include <QEvent>
22#include <private/qglobal_p.h>
23
24#include <memory>
25
26QT_BEGIN_NAMESPACE
27
28class QSocketNotifier;
29
30class QEvdevMouseHandler : public QObject
31{
32 Q_OBJECT
33public:
34 static std::unique_ptr<QEvdevMouseHandler> create(const QString &device, const QString &specification);
35 ~QEvdevMouseHandler();
36
37 void readMouseData();
38
39signals:
40 void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons,
41 Qt::MouseButton button, QEvent::Type type);
42 void handleWheelEvent(QPoint delta);
43
44private:
45 QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit);
46
47 void sendMouseEvent();
48#ifndef Q_OS_VXWORKS
49 bool getHardwareMaximum();
50#endif
51 void detectHiResWheelSupport();
52
53 QString m_device;
54 int m_fd;
55 QSocketNotifier *m_notify = nullptr;
56 int m_x = 0, m_y = 0;
57 int m_prevx = 0, m_prevy = 0;
58 bool m_abs;
59 bool m_compression;
60 bool m_hiResWheel = false;
61 bool m_hiResHWheel = false;
62 Qt::MouseButtons m_buttons;
63 Qt::MouseButton m_button;
64 QEvent::Type m_eventType;
65 int m_jitterLimitSquared;
66 bool m_prevInvalid = true;
67 int m_hardwareWidth;
68 int m_hardwareHeight;
69 qreal m_hardwareScalerY;
70 qreal m_hardwareScalerX;
71};
72
73QT_END_NAMESPACE
74
75#endif // QEVDEVMOUSEHANDLER_P_H
76

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtbase/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h