-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextInputManagerV3.cpp
54 lines (43 loc) · 1.37 KB
/
TextInputManagerV3.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "TextInputManagerV3.h"
#include "TextInputV3.h"
#include "qwayland-server-text-input-unstable-v3.h"
#include <QtWaylandCompositor/QWaylandSeat>
class TextInputManagerV3Private : public QtWaylandServer::zwp_text_input_manager_v3
{
public:
TextInputManagerV3Private(TextInputManagerV3 *q)
: q(q)
{
}
protected:
void zwp_text_input_manager_v3_destroy(Resource *resource) override
{
wl_resource_destroy(resource->handle);
}
void zwp_text_input_manager_v3_get_text_input(Resource *resource,
uint32_t id,
struct ::wl_resource *seat) override
{
auto iter = q->m_textInputs.find(seat);
if (iter == q->m_textInputs.end()) {
auto *ti = new TextInputV3(q->m_core, seat, q);
auto [i, r] = q->m_textInputs.emplace(seat, ti);
iter = i;
}
iter->second->add(resource->client(), id);
}
private:
TextInputManagerV3 *q;
};
TextInputManagerV3::TextInputManagerV3(Core *core, QObject *parent)
: QObject(parent)
, m_core(core)
, d(new TextInputManagerV3Private(this))
{
}
TextInputManagerV3::~TextInputManagerV3() { }
INIT_FUNCS(TextInputManagerV3)
TextInputV3 *TextInputManagerV3::getTextInputV4BySeat(struct ::wl_resource *seat)
{
return m_textInputs.at(seat);
}