KWayland

textinput.cpp
1 /*
2  SPDX-FileCopyrightText: 2016 Martin Gräßlin <[email protected]>
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 
8 namespace KWayland
9 {
10 namespace Client
11 {
12 
13 TextInput::Private::Private(Seat *seat)
14  : seat(seat)
15 {
16  currentCommit.deleteSurrounding.afterLength = 0;
17  currentCommit.deleteSurrounding.beforeLength = 0;
18  pendingCommit.deleteSurrounding.afterLength = 0;
19  pendingCommit.deleteSurrounding.beforeLength = 0;
20 }
21 
22 TextInput::TextInput(Private *p, QObject *parent)
23  : QObject(parent)
24  , d(p)
25 {
26 }
27 
28 TextInput::~TextInput() = default;
29 
30 void TextInput::setEventQueue(EventQueue *queue)
31 {
32  d->queue = queue;
33 }
34 
35 EventQueue *TextInput::eventQueue() const
36 {
37  return d->queue;
38 }
39 
40 bool TextInput::isValid() const
41 {
42  return d->isValid();
43 }
44 
45 Surface *TextInput::enteredSurface() const
46 {
47  return d->enteredSurface;
48 }
49 
50 bool TextInput::isInputPanelVisible() const
51 {
52  return d->inputPanelVisible;
53 }
54 
55 void TextInput::enable(Surface *surface)
56 {
57  d->enable(surface);
58 }
59 
60 void TextInput::disable(Surface *surface)
61 {
62  d->disable(surface);
63 }
64 
65 void TextInput::showInputPanel()
66 {
67  d->showInputPanel();
68 }
69 
70 void TextInput::hideInputPanel()
71 {
72  d->hideInputPanel();
73 }
74 
75 void TextInput::reset()
76 {
77  d->reset();
78 }
79 
80 void TextInput::setSurroundingText(const QString &text, quint32 cursor, quint32 anchor)
81 {
82  d->setSurroundingText(text, cursor, anchor);
83 }
84 
85 void TextInput::setContentType(ContentHints hint, ContentPurpose purpose)
86 {
87  d->setContentType(hint, purpose);
88 }
89 
90 void TextInput::setCursorRectangle(const QRect &rect)
91 {
92  d->setCursorRectangle(rect);
93 }
94 
95 void TextInput::setPreferredLanguage(const QString &language)
96 {
97  d->setPreferredLanguage(language);
98 }
99 
100 Qt::LayoutDirection TextInput::textDirection() const
101 {
102  return d->textDirection;
103 }
104 
105 QByteArray TextInput::language() const
106 {
107  return d->language;
108 }
109 
110 qint32 TextInput::composingTextCursorPosition() const
111 {
112  return d->currentPreEdit.cursor;
113 }
114 
115 QByteArray TextInput::composingText() const
116 {
117  return d->currentPreEdit.text;
118 }
119 
120 QByteArray TextInput::composingFallbackText() const
121 {
122  return d->currentPreEdit.commitText;
123 }
124 
125 qint32 TextInput::anchorPosition() const
126 {
127  return d->currentCommit.anchor;
128 }
129 
130 qint32 TextInput::cursorPosition() const
131 {
132  return d->currentCommit.cursor;
133 }
134 
135 TextInput::DeleteSurroundingText TextInput::deleteSurroundingText() const
136 {
137  return d->currentCommit.deleteSurrounding;
138 }
139 
140 QByteArray TextInput::commitText() const
141 {
142  return d->currentCommit.text;
143 }
144 
145 TextInputManager::TextInputManager(Private *p, QObject *parent)
146  : QObject(parent)
147  , d(p)
148 {
149 }
150 
151 TextInputManager::~TextInputManager() = default;
152 
153 void TextInputManager::setup(wl_text_input_manager *textinputmanagerunstablev0)
154 {
155  d->setupV0(textinputmanagerunstablev0);
156 }
157 
158 void TextInputManager::setup(zwp_text_input_manager_v2 *textinputmanagerunstablev2)
159 {
160  d->setupV2(textinputmanagerunstablev2);
161 }
162 
163 void TextInputManager::release()
164 {
165  d->release();
166 }
167 
168 void TextInputManager::destroy()
169 {
170  d->destroy();
171 }
172 
173 void TextInputManager::setEventQueue(EventQueue *queue)
174 {
175  d->queue = queue;
176 }
177 
178 EventQueue *TextInputManager::eventQueue()
179 {
180  return d->queue;
181 }
182 
183 TextInputManager::operator wl_text_input_manager*()
184 {
185  return *(d.data());
186 }
187 
188 TextInputManager::operator wl_text_input_manager*() const
189 {
190  return *(d.data());
191 }
192 
193 TextInputManager::operator zwp_text_input_manager_v2*()
194 {
195  return *(d.data());
196 }
197 
198 TextInputManager::operator zwp_text_input_manager_v2*() const
199 {
200  return *(d.data());
201 }
202 
203 bool TextInputManager::isValid() const
204 {
205  return d->isValid();
206 }
207 
208 TextInput *TextInputManager::createTextInput(Seat *seat, QObject *parent)
209 {
210  return d->createTextInput(seat, parent);
211 }
212 
213 }
214 }
ContentPurpose
The ContentPurpose allows to specify the primary purpose of a text input.
Definition: textinput.h:177
Holds the length before and after the cursor position to be deleted.
Definition: textinput.h:326
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
Wrapper for the wl_seat interface.
Definition: seat.h:52
LayoutDirection
void reset(T *other)
Wrapper for the wl_surface interface.
Definition: surface.h:44
T * data() const const
QObject(QObject *parent)
TextInput represents a Wayland interface for text input.
Definition: textinput.h:40
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 13 2020 22:50:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.