1/*
2 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6#include "textinput_p.h"
7
8namespace KWayland
9{
10namespace Client
11{
12TextInput::Private::Private(Seat *seat)
13 : seat(seat)
14{
15 currentCommit.deleteSurrounding.afterLength = 0;
16 currentCommit.deleteSurrounding.beforeLength = 0;
17 pendingCommit.deleteSurrounding.afterLength = 0;
18 pendingCommit.deleteSurrounding.beforeLength = 0;
19}
20
21TextInput::TextInput(Private *p, QObject *parent)
22 : QObject(parent)
23 , d(p)
24{
25}
26
27TextInput::~TextInput() = default;
28
29void TextInput::setEventQueue(EventQueue *queue)
30{
31 d->queue = queue;
32}
33
34EventQueue *TextInput::eventQueue() const
35{
36 return d->queue;
37}
38
39bool TextInput::isValid() const
40{
41 return d->isValid();
42}
43
44Surface *TextInput::enteredSurface() const
45{
46 return d->enteredSurface;
47}
48
49bool TextInput::isInputPanelVisible() const
50{
51 return d->inputPanelVisible;
52}
53
54void TextInput::enable(Surface *surface)
55{
56 d->enable(surface);
57}
58
59void TextInput::disable(Surface *surface)
60{
61 d->disable(surface);
62}
63
64void TextInput::showInputPanel()
65{
66 d->showInputPanel();
67}
68
69void TextInput::hideInputPanel()
70{
71 d->hideInputPanel();
72}
73
74void TextInput::reset()
75{
76 d->reset();
77}
78
79void TextInput::setSurroundingText(const QString &text, quint32 cursor, quint32 anchor)
80{
81 d->setSurroundingText(text, cursor, anchor);
82}
83
84void TextInput::setContentType(ContentHints hint, ContentPurpose purpose)
85{
86 d->setContentType(hint, purpose);
87}
88
89void TextInput::setCursorRectangle(const QRect &rect)
90{
91 d->setCursorRectangle(rect);
92}
93
94void TextInput::setPreferredLanguage(const QString &language)
95{
96 d->setPreferredLanguage(language);
97}
98
99Qt::LayoutDirection TextInput::textDirection() const
100{
101 return d->textDirection;
102}
103
104QByteArray TextInput::language() const
105{
106 return d->language;
107}
108
109qint32 TextInput::composingTextCursorPosition() const
110{
111 return d->currentPreEdit.cursor;
112}
113
114QByteArray TextInput::composingText() const
115{
116 return d->currentPreEdit.text;
117}
118
119QByteArray TextInput::composingFallbackText() const
120{
121 return d->currentPreEdit.commitText;
122}
123
124qint32 TextInput::anchorPosition() const
125{
126 return d->currentCommit.anchor;
127}
128
129qint32 TextInput::cursorPosition() const
130{
131 return d->currentCommit.cursor;
132}
133
134TextInput::DeleteSurroundingText TextInput::deleteSurroundingText() const
135{
136 return d->currentCommit.deleteSurrounding;
137}
138
139QByteArray TextInput::commitText() const
140{
141 return d->currentCommit.text;
142}
143
144TextInputManager::TextInputManager(Private *p, QObject *parent)
145 : QObject(parent)
146 , d(p)
147{
148}
149
150TextInputManager::~TextInputManager() = default;
151
152void TextInputManager::setup(wl_text_input_manager *textinputmanagerunstablev0)
153{
154 d->setupV0(textinputmanagerunstablev0);
155}
156
157void TextInputManager::setup(zwp_text_input_manager_v2 *textinputmanagerunstablev2)
158{
159 d->setupV2(textinputmanagerunstablev2);
160}
161
162void TextInputManager::release()
163{
164 d->release();
165}
166
167void TextInputManager::destroy()
168{
169 d->destroy();
170}
171
172void TextInputManager::setEventQueue(EventQueue *queue)
173{
174 d->queue = queue;
175}
176
177EventQueue *TextInputManager::eventQueue()
178{
179 return d->queue;
180}
181
182TextInputManager::operator wl_text_input_manager *()
183{
184 return *(d.data());
185}
186
187TextInputManager::operator wl_text_input_manager *() const
188{
189 return *(d.data());
190}
191
192TextInputManager::operator zwp_text_input_manager_v2 *()
193{
194 return *(d.data());
195}
196
197TextInputManager::operator zwp_text_input_manager_v2 *() const
198{
199 return *(d.data());
200}
201
202bool TextInputManager::isValid() const
203{
204 return d->isValid();
205}
206
207TextInput *TextInputManager::createTextInput(Seat *seat, QObject *parent)
208{
209 return d->createTextInput(seat, parent);
210}
211
212}
213}
214
215#include "moc_textinput.cpp"
216#include "moc_textinput_p.cpp"
217

source code of kwayland/src/client/textinput.cpp