Directory: | ./ |
---|---|
File: | server/seat.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 <QMatrix4x4> | ||
23 | #include <QObject> | ||
24 | #include <QPoint> | ||
25 | |||
26 | #include <Wrapland/Server/wraplandserver_export.h> | ||
27 | |||
28 | #include <cstdint> | ||
29 | #include <memory> | ||
30 | #include <vector> | ||
31 | |||
32 | namespace Wrapland::Server | ||
33 | { | ||
34 | |||
35 | class data_source; | ||
36 | class Display; | ||
37 | class drag_pool; | ||
38 | class input_method_v2; | ||
39 | class Keyboard; | ||
40 | class keyboard_pool; | ||
41 | class Pointer; | ||
42 | class pointer_pool; | ||
43 | class primary_selection_source; | ||
44 | class Surface; | ||
45 | class text_input_pool; | ||
46 | class TextInputV2; | ||
47 | class text_input_v3; | ||
48 | class Touch; | ||
49 | class touch_pool; | ||
50 | |||
51 | enum class PointerAxisSource { | ||
52 | Unknown, | ||
53 | Wheel, | ||
54 | Finger, | ||
55 | Continuous, | ||
56 | WheelTilt, | ||
57 | }; | ||
58 | |||
59 | class WRAPLANDSERVER_EXPORT Seat : public QObject | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | public: | ||
63 | explicit Seat(Display* display); | ||
64 | ~Seat() override; | ||
65 | |||
66 | std::string name() const; | ||
67 | bool hasPointer() const; | ||
68 | bool hasKeyboard() const; | ||
69 | bool hasTouch() const; | ||
70 | |||
71 | void setName(std::string const& name); | ||
72 | void setHasPointer(bool has); | ||
73 | void setHasKeyboard(bool has); | ||
74 | void setHasTouch(bool has); | ||
75 | |||
76 | pointer_pool& pointers() const; | ||
77 | keyboard_pool& keyboards() const; | ||
78 | touch_pool& touches() const; | ||
79 | |||
80 | text_input_pool& text_inputs() const; | ||
81 | drag_pool& drags() const; | ||
82 | |||
83 | void setTimestamp(uint32_t time); | ||
84 | uint32_t timestamp() const; | ||
85 | |||
86 | void setFocusedKeyboardSurface(Surface* surface); | ||
87 | |||
88 | input_method_v2* get_input_method_v2() const; | ||
89 | |||
90 | data_source* selection() const; | ||
91 | void setSelection(data_source* source); | ||
92 | primary_selection_source* primarySelection() const; | ||
93 | void setPrimarySelection(primary_selection_source* source); | ||
94 | |||
95 | Q_SIGNALS: | ||
96 | void pointerPosChanged(QPointF const& pos); | ||
97 | void touchMoved(int32_t id, uint32_t serial, QPointF const& globalPosition); | ||
98 | void timestampChanged(uint32_t); | ||
99 | |||
100 | void pointerCreated(Wrapland::Server::Pointer*); | ||
101 | void keyboardCreated(Wrapland::Server::Keyboard*); | ||
102 | void touchCreated(Wrapland::Server::Touch*); | ||
103 | void input_method_v2_changed(); | ||
104 | |||
105 | void focusedPointerChanged(Wrapland::Server::Pointer*); | ||
106 | |||
107 | void selectionChanged(Wrapland::Server::data_source*); | ||
108 | void primarySelectionChanged(Wrapland::Server::primary_selection_source*); | ||
109 | void dragStarted(); | ||
110 | void dragEnded(bool dropped); | ||
111 | void focusedTextInputChanged(); | ||
112 | void text_input_v2_enabled_changed(bool enabled); | ||
113 | void text_input_v3_enabled_changed(bool enabled); | ||
114 | |||
115 | private: | ||
116 | friend class data_control_device_v1; | ||
117 | friend class data_control_manager_v1; | ||
118 | friend class data_device_manager; | ||
119 | friend class drag_pool; | ||
120 | friend class keyboard_pool; | ||
121 | friend class pointer_pool; | ||
122 | friend class primary_selection_device_manager; | ||
123 | friend class input_method_manager_v2; | ||
124 | friend class text_input_manager_v2; | ||
125 | friend class text_input_manager_v3; | ||
126 | friend class text_input_pool; | ||
127 | friend class touch_pool; | ||
128 | |||
129 | // Returns whether an actual change took place. | ||
130 | bool setFocusedTextInputV2Surface(Surface* surface); | ||
131 | bool setFocusedTextInputV3Surface(Surface* surface); | ||
132 | |||
133 | class Private; | ||
134 | std::unique_ptr<Private> d_ptr; | ||
135 | }; | ||
136 | |||
137 | } | ||
138 | |||
139 |
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::Seat*) |
140 |