Changeset View
Changeset View
Standalone View
Standalone View
src/client/textinput.cpp
1 | /**************************************************************************** | 1 | /**************************************************************************** | ||
---|---|---|---|---|---|
2 | Copyright 2016 Martin Gräßlin <mgraesslin@kde.org> | 2 | Copyright 2016 Martin Gräßlin <mgraesslin@kde.org> | ||
3 | Copyright 2018 Roman Gilg <subdiff@gmail.com> | ||||
3 | 4 | | |||
4 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | 7 | 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 | 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 | 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 | 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 | act as a proxy defined in Section 6 of version 3 of the license. | ||
Show All 17 Lines | 28 | TextInput::Private::Private(Seat *seat) | |||
28 | : seat(seat) | 29 | : seat(seat) | ||
29 | { | 30 | { | ||
30 | currentCommit.deleteSurrounding.afterLength = 0; | 31 | currentCommit.deleteSurrounding.afterLength = 0; | ||
31 | currentCommit.deleteSurrounding.beforeLength = 0; | 32 | currentCommit.deleteSurrounding.beforeLength = 0; | ||
32 | pendingCommit.deleteSurrounding.afterLength = 0; | 33 | pendingCommit.deleteSurrounding.afterLength = 0; | ||
33 | pendingCommit.deleteSurrounding.beforeLength = 0; | 34 | pendingCommit.deleteSurrounding.beforeLength = 0; | ||
34 | } | 35 | } | ||
35 | 36 | | |||
37 | void TextInput::Private::setSurroundingTextChangeCause(TextInput::ChangeCause cause) | ||||
38 | { | ||||
39 | Q_UNUSED(cause) | ||||
40 | // implement by override in child classes | ||||
41 | } | ||||
42 | | ||||
43 | void TextInput::Private::commit() | ||||
44 | { | ||||
45 | // implement by override in child classes | ||||
46 | } | ||||
47 | | ||||
36 | TextInput::TextInput(Private *p, QObject *parent) | 48 | TextInput::TextInput(Private *p, QObject *parent) | ||
37 | : QObject(parent) | 49 | : QObject(parent) | ||
38 | , d(p) | 50 | , d(p) | ||
39 | { | 51 | { | ||
40 | } | 52 | } | ||
41 | 53 | | |||
42 | TextInput::~TextInput() = default; | 54 | TextInput::~TextInput() = default; | ||
43 | 55 | | |||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 97 | { | |||
86 | d->hideInputPanel(); | 98 | d->hideInputPanel(); | ||
87 | } | 99 | } | ||
88 | 100 | | |||
89 | void TextInput::reset() | 101 | void TextInput::reset() | ||
90 | { | 102 | { | ||
91 | d->reset(); | 103 | d->reset(); | ||
92 | } | 104 | } | ||
93 | 105 | | |||
106 | void TextInput::setSurroundingTextChangeCause(TextInput::ChangeCause cause) | ||||
107 | { | ||||
108 | d->setSurroundingTextChangeCause(cause); | ||||
109 | } | ||||
110 | | ||||
94 | void TextInput::setSurroundingText(const QString &text, quint32 cursor, quint32 anchor) | 111 | void TextInput::setSurroundingText(const QString &text, quint32 cursor, quint32 anchor) | ||
95 | { | 112 | { | ||
96 | d->setSurroundingText(text, cursor, anchor); | 113 | d->setSurroundingText(text, cursor, anchor); | ||
97 | } | 114 | } | ||
98 | 115 | | |||
99 | void TextInput::setContentType(ContentHints hint, ContentPurpose purpose) | 116 | void TextInput::setContentType(ContentHints hint, ContentPurpose purpose) | ||
100 | { | 117 | { | ||
101 | d->setContentType(hint, purpose); | 118 | d->setContentType(hint, purpose); | ||
102 | } | 119 | } | ||
103 | 120 | | |||
104 | void TextInput::setCursorRectangle(const QRect &rect) | 121 | void TextInput::setCursorRectangle(const QRect &rect) | ||
105 | { | 122 | { | ||
106 | d->setCursorRectangle(rect); | 123 | d->setCursorRectangle(rect); | ||
107 | } | 124 | } | ||
108 | 125 | | |||
109 | void TextInput::setPreferredLanguage(const QString &language) | 126 | void TextInput::setPreferredLanguage(const QString &language) | ||
110 | { | 127 | { | ||
111 | d->setPreferredLanguage(language); | 128 | d->setPreferredLanguage(language); | ||
112 | } | 129 | } | ||
113 | 130 | | |||
131 | void TextInput::commit() | ||||
132 | { | ||||
133 | d->commit(); | ||||
134 | } | ||||
135 | | ||||
114 | Qt::LayoutDirection TextInput::textDirection() const | 136 | Qt::LayoutDirection TextInput::textDirection() const | ||
115 | { | 137 | { | ||
116 | return d->textDirection; | 138 | return d->textDirection; | ||
117 | } | 139 | } | ||
118 | 140 | | |||
119 | QByteArray TextInput::language() const | 141 | QByteArray TextInput::language() const | ||
120 | { | 142 | { | ||
121 | return d->language; | 143 | return d->language; | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 190 | { | |||
169 | d->setupV0(textinputmanagerunstablev0); | 191 | d->setupV0(textinputmanagerunstablev0); | ||
170 | } | 192 | } | ||
171 | 193 | | |||
172 | void TextInputManager::setup(zwp_text_input_manager_v2 *textinputmanagerunstablev2) | 194 | void TextInputManager::setup(zwp_text_input_manager_v2 *textinputmanagerunstablev2) | ||
173 | { | 195 | { | ||
174 | d->setupV2(textinputmanagerunstablev2); | 196 | d->setupV2(textinputmanagerunstablev2); | ||
175 | } | 197 | } | ||
176 | 198 | | |||
199 | void TextInputManager::setup(zwp_text_input_manager_v3 *textinputmanagerunstablev3) | ||||
200 | { | ||||
201 | d->setupV3(textinputmanagerunstablev3); | ||||
202 | } | ||||
203 | | ||||
177 | void TextInputManager::release() | 204 | void TextInputManager::release() | ||
178 | { | 205 | { | ||
179 | d->release(); | 206 | d->release(); | ||
180 | } | 207 | } | ||
181 | 208 | | |||
182 | void TextInputManager::destroy() | 209 | void TextInputManager::destroy() | ||
183 | { | 210 | { | ||
184 | d->destroy(); | 211 | d->destroy(); | ||
Show All 24 Lines | 235 | { | |||
209 | return *(d.data()); | 236 | return *(d.data()); | ||
210 | } | 237 | } | ||
211 | 238 | | |||
212 | TextInputManager::operator zwp_text_input_manager_v2*() const | 239 | TextInputManager::operator zwp_text_input_manager_v2*() const | ||
213 | { | 240 | { | ||
214 | return *(d.data()); | 241 | return *(d.data()); | ||
215 | } | 242 | } | ||
216 | 243 | | |||
244 | TextInputManager::operator zwp_text_input_manager_v3*() | ||||
245 | { | ||||
246 | return *(d.data()); | ||||
247 | } | ||||
248 | | ||||
249 | TextInputManager::operator zwp_text_input_manager_v3*() const | ||||
250 | { | ||||
251 | return *(d.data()); | ||||
252 | } | ||||
253 | | ||||
217 | bool TextInputManager::isValid() const | 254 | bool TextInputManager::isValid() const | ||
218 | { | 255 | { | ||
219 | return d->isValid(); | 256 | return d->isValid(); | ||
220 | } | 257 | } | ||
221 | 258 | | |||
222 | TextInput *TextInputManager::createTextInput(Seat *seat, QObject *parent) | 259 | TextInput *TextInputManager::createTextInput(Seat *seat, QObject *parent) | ||
223 | { | 260 | { | ||
224 | return d->createTextInput(seat, parent); | 261 | return d->createTextInput(seat, parent); | ||
225 | } | 262 | } | ||
226 | 263 | | |||
227 | } | 264 | } | ||
228 | } | 265 | } |