Debian Codegraph @

src/private/dregionmonitor_p.h

raw
1 // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4
5 #ifndef DREGIONMONITOR_P_H
6 #define DREGIONMONITOR_P_H
7
8 #include "dregionmonitor.h"
9 #include "xeventmonitor_interface.h"
10
11 #include <dtkgui_global.h>
12 #include <DObjectPrivate>
13
14 #include <QRegion>
15 #include <QScreen>
16
17 DCORE_USE_NAMESPACE
18 DGUI_BEGIN_NAMESPACE
19
20 using XEventMonitor = ::com::deepin::api::XEventMonitor;
21
22 class DRegionMonitorPrivate : public DObjectPrivate
23 {
24 D_DECLARE_PUBLIC(DRegionMonitor)
25
26 public:
27 DRegionMonitorPrivate(DRegionMonitor *q);
28 ~DRegionMonitorPrivate();
29
30 bool registered() const { return !registerKey.isEmpty(); }
31
32 void init();
33 void registerMonitorRegion();
34 void unregisterMonitorRegion();
35
36 void _q_ButtonPress(const int flag, const int x, const int y, const QString &key);
37 void _q_ButtonRelease(const int flag, const int x, const int y, const QString &key);
38 void _q_CursorMove(const int x, const int y, const QString &key);
39 void _q_CursorEnter(const int x, const int y, const QString &key);
40 void _q_CursorLeave(const int x, const int y, const QString &key);
41 void _q_KeyPress(const QString &keyname, const int x, const int y, const QString &key);
42 void _q_KeyRelease(const QString &keyname, const int x, const int y, const QString &key);
43
44 const QPoint deviceScaledCoordinate(const QPoint &p, const double ratio) const;
45
46 XEventMonitor *eventInter;
47 QRegion watchedRegion;
48 QString registerKey;
49 DRegionMonitor::CoordinateType type = DRegionMonitor::ScaleRatio;
50 DRegionMonitor::RegisterdFlags registerdFlags = DRegionMonitor::Motion | DRegionMonitor::Button | DRegionMonitor::Key;
51 };
52
53 DGUI_END_NAMESPACE
54
55 #endif // DREGIONMONITOR_P_H