GCC Code Coverage Report


Directory: ./
File: server/pointer.h
Date: 2024-01-22 17:25:27
Exec Total Coverage
Lines: 1 1 100.0%
Branches: 3 6 50.0%

Line Branch Exec Source
1 /********************************************************************
2 Copyright © 2020 Roman Gilg <subdiff@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), which shall
10 act as a proxy defined in Section 6 of version 3 of the license.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
20 #pragma once
21
22 #include <QObject>
23
24 #include <Wrapland/Server/wraplandserver_export.h>
25 #include <memory>
26
27 namespace Wrapland::Server
28 {
29 class Client;
30 class Seat;
31
32 class Cursor;
33 class Seat;
34 class Surface;
35
36 enum class PointerAxisSource;
37
38 class WRAPLANDSERVER_EXPORT Pointer : public QObject
39 {
40 Q_OBJECT
41 public:
42 Seat* seat() const;
43 Surface* focusedSurface() const;
44
45 Cursor* cursor() const;
46 Client* client() const;
47
48 Q_SIGNALS:
49 void cursorChanged();
50 void resourceDestroyed();
51
52 private:
53 void setFocusedSurface(quint32 serial, Surface* surface);
54
55 void motion(QPointF const& position);
56 void buttonPressed(quint32 serial, quint32 button);
57 void buttonReleased(quint32 serial, quint32 button);
58 void
59 axis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
60 void axis(Qt::Orientation orientation, quint32 delta);
61 void
62 relativeMotion(QSizeF const& delta, QSizeF const& deltaNonAccelerated, quint64 microseconds);
63 void frame();
64
65 friend class RelativePointerManagerV1;
66 friend class PointerGesturesV1;
67 friend class PointerConstraintsV1;
68
69 friend class Seat;
70 friend class pointer_pool;
71 friend class touch_pool;
72 Pointer(Client* client, uint32_t version, uint32_t id, Seat* seat);
73
74 class Private;
75 Private* d_ptr;
76 };
77
78 class WRAPLANDSERVER_EXPORT Cursor : public QObject
79 {
80 Q_OBJECT
81 public:
82 ~Cursor() override;
83
84 QPoint hotspot() const;
85 quint32 enteredSerial() const;
86
87 Pointer* pointer() const;
88 Surface* surface() const;
89
90 Q_SIGNALS:
91 void hotspotChanged();
92 void enteredSerialChanged();
93 void surfaceChanged();
94 void changed();
95
96 private:
97 friend class Pointer;
98 explicit Cursor(Pointer* pointer);
99
100 class Private;
101 std::unique_ptr<Private> d_ptr;
102 };
103
104 }
105
106
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 Q_DECLARE_METATYPE(Wrapland::Server::Pointer*)
107