| Flutter Windows Embedder |

text_input_plugin.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/windows/text_input_plugin.h"
6
7 #include <windows.h>
8
9 #include <cstdint>
10
11 #include "flutter/fml/string_conversion.h"
12 #include "flutter/shell/platform/common/json_method_codec.h"
13 #include "flutter/shell/platform/common/text_editing_delta.h"
14 #include "flutter/shell/platform/windows/flutter_windows_engine.h"
15 #include "flutter/shell/platform/windows/flutter_windows_view.h"
16
17 static constexpr char kSetEditingStateMethod[] = "TextInput.setEditingState";
18 static constexpr char kClearClientMethod[] = "TextInput.clearClient";
19 static constexpr char kSetClientMethod[] = "TextInput.setClient";
20 static constexpr char kShowMethod[] = "TextInput.show";
21 static constexpr char kHideMethod[] = "TextInput.hide";
22 static constexpr char kSetMarkedTextRect[] = "TextInput.setMarkedTextRect";
23 static constexpr char kSetEditableSizeAndTransform[] =
24 "TextInput.setEditableSizeAndTransform";
25
26 static constexpr char kMultilineInputType[] = "TextInputType.multiline";
27
28 static constexpr char kUpdateEditingStateMethod[] =
29 "TextInputClient.updateEditingState";
30 static constexpr char kUpdateEditingStateWithDeltasMethod[] =
31 "TextInputClient.updateEditingStateWithDeltas";
32 static constexpr char kPerformActionMethod[] = "TextInputClient.performAction";
33
34 static constexpr char kDeltaOldTextKey[] = "oldText";
35 static constexpr char kDeltaTextKey[] = "deltaText";
36 static constexpr char kDeltaStartKey[] = "deltaStart";
37 static constexpr char kDeltaEndKey[] = "deltaEnd";
38 static constexpr char kDeltasKey[] = "deltas";
39 static constexpr char kEnableDeltaModel[] = "enableDeltaModel";
40 static constexpr char kTextInputAction[] = "inputAction";
41 static constexpr char kTextInputType[] = "inputType";
42 static constexpr char kTextInputTypeName[] = "name";
43 static constexpr char kComposingBaseKey[] = "composingBase";
44 static constexpr char kComposingExtentKey[] = "composingExtent";
45 static constexpr char kSelectionAffinityKey[] = "selectionAffinity";
46 static constexpr char kAffinityDownstream[] = "TextAffinity.downstream";
47 static constexpr char kSelectionBaseKey[] = "selectionBase";
48 static constexpr char kSelectionExtentKey[] = "selectionExtent";
49 static constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional";
50 static constexpr char kTextKey[] = "text";
51 static constexpr char kXKey[] = "x";
52 static constexpr char kYKey[] = "y";
53 static constexpr char kWidthKey[] = "width";
54 static constexpr char kHeightKey[] = "height";
55 static constexpr char kTransformKey[] = "transform";
56
57 static constexpr char kChannelName[] = "flutter/textinput";
58
59 static constexpr char kBadArgumentError[] = "Bad Arguments";
60 static constexpr char kInternalConsistencyError[] =
61 "Internal Consistency Error";
62
63 static constexpr char kInputActionNewline[] = "TextInputAction.newline";
64
65 namespace flutter {
66
67 void TextInputPlugin::TextHook(const std::u16string& text) {
68 if (active_model_ == nullptr) {
69 return;
70 }
71 std::u16string text_before_change =
72 fml::Utf8ToUtf16(active_model_->GetText());
73 TextRange selection_before_change = active_model_->selection();
74 active_model_->AddText(text);
75
76 if (enable_delta_model) {
77 TextEditingDelta delta =
78 TextEditingDelta(text_before_change, selection_before_change, text);
79 SendStateUpdateWithDelta(*active_model_, &delta);
80 } else {
81 SendStateUpdate(*active_model_);
82 }
83 }
84
85 void TextInputPlugin::KeyboardHook(int key,
86 int scancode,
87 int action,
88 char32_t character,
89 bool extended,
90 bool was_down) {
91 if (active_model_ == nullptr) {
92 return;
93 }
94 if (action == WM_KEYDOWN || action == WM_SYSKEYDOWN) {
95 // Most editing keys (arrow keys, backspace, delete, etc.) are handled in
96 // the framework, so don't need to be handled at this layer.
97 switch (key) {
98 case VK_RETURN:
99 EnterPressed(active_model_.get());
100 break;
101 default:
102 break;
103 }
104 }
105 }
106
107 TextInputPlugin::TextInputPlugin(flutter::BinaryMessenger* messenger,
108 FlutterWindowsEngine* engine)
109 : channel_(std::make_unique<flutter::MethodChannel<rapidjson::Document>>(
110 messenger,
111 kChannelName,
112 &flutter::JsonMethodCodec::GetInstance())),
113 engine_(engine),
114 active_model_(nullptr) {
115 channel_->SetMethodCallHandler(
116 [this](
117 const flutter::MethodCall<rapidjson::Document>& call,
118 std::unique_ptr<flutter::MethodResult<rapidjson::Document>> result) {
119 HandleMethodCall(call, std::move(result));
120 });
121 }
122
123 TextInputPlugin::~TextInputPlugin() = default;
124
125 void TextInputPlugin::ComposeBeginHook() {
126 if (active_model_ == nullptr) {
127 return;
128 }
129 active_model_->BeginComposing();
130 if (enable_delta_model) {
131 std::string text = active_model_->GetText();
132 TextRange selection = active_model_->selection();
133 TextEditingDelta delta = TextEditingDelta(text);
134 SendStateUpdateWithDelta(*active_model_, &delta);
135 } else {
136 SendStateUpdate(*active_model_);
137 }
138 }
139
140 void TextInputPlugin::ComposeCommitHook() {
141 if (active_model_ == nullptr) {
142 return;
143 }
144 std::string text_before_change = active_model_->GetText();
145 TextRange selection_before_change = active_model_->selection();
146 TextRange composing_before_change = active_model_->composing_range();
147 std::string composing_text_before_change = text_before_change.substr(
148 composing_before_change.start(), composing_before_change.length());
149 active_model_->CommitComposing();
150
151 // We do not trigger SendStateUpdate here.
152 //
153 // Until a WM_IME_ENDCOMPOSING event, the user is still composing from the OS
154 // point of view. Commit events are always immediately followed by another
155 // composing event or an end composing event. However, in the brief window
156 // between the commit event and the following event, the composing region is
157 // collapsed. Notifying the framework of this intermediate state will trigger
158 // any framework code designed to execute at the end of composing, such as
159 // input formatters, which may try to update the text and send a message back
160 // to the engine with changes.
161 //
162 // This is a particular problem with Korean IMEs, which build up one
163 // character at a time in their composing region until a keypress that makes
164 // no sense for the in-progress character. At that point, the result
165 // character is committed and a compose event is immedidately received with
166 // the new composing region.
167 //
168 // In the case where this event is immediately followed by a composing event,
169 // the state will be sent in ComposeChangeHook.
170 //
171 // In the case where this event is immediately followed by an end composing
172 // event, the state will be sent in ComposeEndHook.
173 }
174
175 void TextInputPlugin::ComposeEndHook() {
176 if (active_model_ == nullptr) {
177 return;
178 }
179 std::string text_before_change = active_model_->GetText();
180 TextRange selection_before_change = active_model_->selection();
181 active_model_->CommitComposing();
182 active_model_->EndComposing();
183 if (enable_delta_model) {
184 std::string text = active_model_->GetText();
185 TextEditingDelta delta = TextEditingDelta(text);
186 SendStateUpdateWithDelta(*active_model_, &delta);
187 } else {
188 SendStateUpdate(*active_model_);
189 }
190 }
191
192 void TextInputPlugin::ComposeChangeHook(const std::u16string& text,
193 int cursor_pos) {
194 if (active_model_ == nullptr) {
195 return;
196 }
197 std::string text_before_change = active_model_->GetText();
198 TextRange composing_before_change = active_model_->composing_range();
199 active_model_->AddText(text);
200 active_model_->UpdateComposingText(text, TextRange(cursor_pos, cursor_pos));
201 std::string text_after_change = active_model_->GetText();
202 if (enable_delta_model) {
203 TextEditingDelta delta = TextEditingDelta(
204 fml::Utf8ToUtf16(text_before_change), composing_before_change, text);
205 SendStateUpdateWithDelta(*active_model_, &delta);
206 } else {
207 SendStateUpdate(*active_model_);
208 }
209 }
210
211 void TextInputPlugin::HandleMethodCall(
212 const flutter::MethodCall<rapidjson::Document>& method_call,
213 std::unique_ptr<flutter::MethodResult<rapidjson::Document>> result) {
214 const std::string& method = method_call.method_name();
215
216 if (method.compare(kShowMethod) == 0 || method.compare(kHideMethod) == 0) {
217 // These methods are no-ops.
218 } else if (method.compare(kClearClientMethod) == 0) {
219 // TODO(loicsharma): Remove implicit view assumption.
220 // https://github.com/flutter/flutter/issues/142845
221 FlutterWindowsView* view = engine_->view(kImplicitViewId);
222 if (view == nullptr) {
223 result->Error(kInternalConsistencyError,
224 "Text input is not available in Windows headless mode");
225 return;
226 }
227 if (active_model_ != nullptr && active_model_->composing()) {
228 active_model_->CommitComposing();
229 active_model_->EndComposing();
230 SendStateUpdate(*active_model_);
231 }
232 view->OnResetImeComposing();
233 active_model_ = nullptr;
234 } else if (method.compare(kSetClientMethod) == 0) {
235 if (!method_call.arguments() || method_call.arguments()->IsNull()) {
236 result->Error(kBadArgumentError, "Method invoked without args");
237 return;
238 }
239 const rapidjson::Document& args = *method_call.arguments();
240
241 const rapidjson::Value& client_id_json = args[0];
242 const rapidjson::Value& client_config = args[1];
243 if (client_id_json.IsNull()) {
244 result->Error(kBadArgumentError, "Could not set client, ID is null.");
245 return;
246 }
247 if (client_config.IsNull()) {
248 result->Error(kBadArgumentError,
249 "Could not set client, missing arguments.");
250 return;
251 }
252 client_id_ = client_id_json.GetInt();
253 auto enable_delta_model_json = client_config.FindMember(kEnableDeltaModel);
254 if (enable_delta_model_json != client_config.MemberEnd() &&
255 enable_delta_model_json->value.IsBool()) {
256 enable_delta_model = enable_delta_model_json->value.GetBool();
257 }
258 input_action_ = "";
259 auto input_action_json = client_config.FindMember(kTextInputAction);
260 if (input_action_json != client_config.MemberEnd() &&
261 input_action_json->value.IsString()) {
262 input_action_ = input_action_json->value.GetString();
263 }
264 input_type_ = "";
265 auto input_type_info_json = client_config.FindMember(kTextInputType);
266 if (input_type_info_json != client_config.MemberEnd() &&
267 input_type_info_json->value.IsObject()) {
268 auto input_type_json =
269 input_type_info_json->value.FindMember(kTextInputTypeName);
270 if (input_type_json != input_type_info_json->value.MemberEnd() &&
271 input_type_json->value.IsString()) {
272 input_type_ = input_type_json->value.GetString();
273 }
274 }
275 active_model_ = std::make_unique<TextInputModel>();
276 } else if (method.compare(kSetEditingStateMethod) == 0) {
277 if (!method_call.arguments() || method_call.arguments()->IsNull()) {
278 result->Error(kBadArgumentError, "Method invoked without args");
279 return;
280 }
281 const rapidjson::Document& args = *method_call.arguments();
282
283 if (active_model_ == nullptr) {
284 result->Error(
285 kInternalConsistencyError,
286 "Set editing state has been invoked, but no client is set.");
287 return;
288 }
289 auto text = args.FindMember(kTextKey);
290 if (text == args.MemberEnd() || text->value.IsNull()) {
291 result->Error(kBadArgumentError,
292 "Set editing state has been invoked, but without text.");
293 return;
294 }
295 auto base = args.FindMember(kSelectionBaseKey);
296 auto extent = args.FindMember(kSelectionExtentKey);
297 if (base == args.MemberEnd() || base->value.IsNull() ||
298 extent == args.MemberEnd() || extent->value.IsNull()) {
299 result->Error(kInternalConsistencyError,
300 "Selection base/extent values invalid.");
301 return;
302 }
303 // Flutter uses -1/-1 for invalid; translate that to 0/0 for the model.
304 int selection_base = base->value.GetInt();
305 int selection_extent = extent->value.GetInt();
306 if (selection_base == -1 && selection_extent == -1) {
307 selection_base = selection_extent = 0;
308 }
309 active_model_->SetText(text->value.GetString());
310 active_model_->SetSelection(TextRange(selection_base, selection_extent));
311
312 base = args.FindMember(kComposingBaseKey);
313 extent = args.FindMember(kComposingExtentKey);
314 if (base == args.MemberEnd() || base->value.IsNull() ||
315 extent == args.MemberEnd() || extent->value.IsNull()) {
316 result->Error(kInternalConsistencyError,
317 "Composing base/extent values invalid.");
318 return;
319 }
320 int composing_base = base->value.GetInt();
321 int composing_extent = base->value.GetInt();
322 if (composing_base == -1 && composing_extent == -1) {
323 active_model_->EndComposing();
324 } else {
325 int composing_start = std::min(composing_base, composing_extent);
326 int cursor_offset = selection_base - composing_start;
327 active_model_->SetComposingRange(
328 TextRange(composing_base, composing_extent), cursor_offset);
329 }
330 } else if (method.compare(kSetMarkedTextRect) == 0) {
331 // TODO(loicsharma): Remove implicit view assumption.
332 // https://github.com/flutter/flutter/issues/142845
333 FlutterWindowsView* view = engine_->view(kImplicitViewId);
334 if (view == nullptr) {
335 result->Error(kInternalConsistencyError,
336 "Text input is not available in Windows headless mode");
337 return;
338 }
339 if (!method_call.arguments() || method_call.arguments()->IsNull()) {
340 result->Error(kBadArgumentError, "Method invoked without args");
341 return;
342 }
343 const rapidjson::Document& args = *method_call.arguments();
344 auto x = args.FindMember(kXKey);
345 auto y = args.FindMember(kYKey);
346 auto width = args.FindMember(kWidthKey);
347 auto height = args.FindMember(kHeightKey);
348 if (x == args.MemberEnd() || x->value.IsNull() || //
349 y == args.MemberEnd() || y->value.IsNull() || //
350 width == args.MemberEnd() || width->value.IsNull() || //
351 height == args.MemberEnd() || height->value.IsNull()) {
352 result->Error(kInternalConsistencyError,
353 "Composing rect values invalid.");
354 return;
355 }
356 composing_rect_ = {{x->value.GetDouble(), y->value.GetDouble()},
357 {width->value.GetDouble(), height->value.GetDouble()}};
358
359 Rect transformed_rect = GetCursorRect();
360 view->OnCursorRectUpdated(transformed_rect);
361 } else if (method.compare(kSetEditableSizeAndTransform) == 0) {
362 // TODO(loicsharma): Remove implicit view assumption.
363 // https://github.com/flutter/flutter/issues/142845
364 FlutterWindowsView* view = engine_->view(kImplicitViewId);
365 if (view == nullptr) {
366 result->Error(kInternalConsistencyError,
367 "Text input is not available in Windows headless mode");
368 return;
369 }
370 if (!method_call.arguments() || method_call.arguments()->IsNull()) {
371 result->Error(kBadArgumentError, "Method invoked without args");
372 return;
373 }
374 const rapidjson::Document& args = *method_call.arguments();
375 auto transform = args.FindMember(kTransformKey);
376 if (transform == args.MemberEnd() || transform->value.IsNull() ||
377 !transform->value.IsArray() || transform->value.Size() != 16) {
378 result->Error(kInternalConsistencyError,
379 "EditableText transform invalid.");
380 return;
381 }
382 size_t i = 0;
383 for (auto& entry : transform->value.GetArray()) {
384 if (entry.IsNull()) {
385 result->Error(kInternalConsistencyError,
386 "EditableText transform contains null value.");
387 return;
388 }
389 editabletext_transform_[i / 4][i % 4] = entry.GetDouble();
390 ++i;
391 }
392 Rect transformed_rect = GetCursorRect();
393 view->OnCursorRectUpdated(transformed_rect);
394 } else {
395 result->NotImplemented();
396 return;
397 }
398 // All error conditions return early, so if nothing has gone wrong indicate
399 // success.
400 result->Success();
401 }
402
403 Rect TextInputPlugin::GetCursorRect() const {
404 Point transformed_point = {
405 composing_rect_.left() * editabletext_transform_[0][0] +
406 composing_rect_.top() * editabletext_transform_[1][0] +
407 editabletext_transform_[3][0],
408 composing_rect_.left() * editabletext_transform_[0][1] +
409 composing_rect_.top() * editabletext_transform_[1][1] +
410 editabletext_transform_[3][1]};
411 return {transformed_point, composing_rect_.size()};
412 }
413
414 void TextInputPlugin::SendStateUpdate(const TextInputModel& model) {
415 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
416 auto& allocator = args->GetAllocator();
417 args->PushBack(client_id_, allocator);
418
419 TextRange selection = model.selection();
420 rapidjson::Value editing_state(rapidjson::kObjectType);
421 editing_state.AddMember(kSelectionAffinityKey, kAffinityDownstream,
422 allocator);
423 editing_state.AddMember(kSelectionBaseKey, selection.base(), allocator);
424 editing_state.AddMember(kSelectionExtentKey, selection.extent(), allocator);
425 editing_state.AddMember(kSelectionIsDirectionalKey, false, allocator);
426
427 int composing_base = model.composing() ? model.composing_range().base() : -1;
428 int composing_extent =
429 model.composing() ? model.composing_range().extent() : -1;
430 editing_state.AddMember(kComposingBaseKey, composing_base, allocator);
431 editing_state.AddMember(kComposingExtentKey, composing_extent, allocator);
432 editing_state.AddMember(
433 kTextKey, rapidjson::Value(model.GetText(), allocator).Move(), allocator);
434 args->PushBack(editing_state, allocator);
435
436 channel_->InvokeMethod(kUpdateEditingStateMethod, std::move(args));
437 }
438
439 void TextInputPlugin::SendStateUpdateWithDelta(const TextInputModel& model,
440 const TextEditingDelta* delta) {
441 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
442 auto& allocator = args->GetAllocator();
443 args->PushBack(client_id_, allocator);
444
445 rapidjson::Value object(rapidjson::kObjectType);
446 rapidjson::Value deltas(rapidjson::kArrayType);
447 rapidjson::Value deltaJson(rapidjson::kObjectType);
448
449 deltaJson.AddMember(kDeltaOldTextKey, delta->old_text(), allocator);
450 deltaJson.AddMember(kDeltaTextKey, delta->delta_text(), allocator);
451 deltaJson.AddMember(kDeltaStartKey, delta->delta_start(), allocator);
452 deltaJson.AddMember(kDeltaEndKey, delta->delta_end(), allocator);
453
454 TextRange selection = model.selection();
455 deltaJson.AddMember(kSelectionAffinityKey, kAffinityDownstream, allocator);
456 deltaJson.AddMember(kSelectionBaseKey, selection.base(), allocator);
457 deltaJson.AddMember(kSelectionExtentKey, selection.extent(), allocator);
458 deltaJson.AddMember(kSelectionIsDirectionalKey, false, allocator);
459
460 int composing_base = model.composing() ? model.composing_range().base() : -1;
461 int composing_extent =
462 model.composing() ? model.composing_range().extent() : -1;
463 deltaJson.AddMember(kComposingBaseKey, composing_base, allocator);
464 deltaJson.AddMember(kComposingExtentKey, composing_extent, allocator);
465
466 deltas.PushBack(deltaJson, allocator);
467 object.AddMember(kDeltasKey, deltas, allocator);
468 args->PushBack(object, allocator);
469
470 channel_->InvokeMethod(kUpdateEditingStateWithDeltasMethod, std::move(args));
471 }
472
473 void TextInputPlugin::EnterPressed(TextInputModel* model) {
474 if (input_type_ == kMultilineInputType &&
475 input_action_ == kInputActionNewline) {
476 std::u16string text_before_change = fml::Utf8ToUtf16(model->GetText());
477 TextRange selection_before_change = model->selection();
478 model->AddText(u"\n");
479 if (enable_delta_model) {
480 TextEditingDelta delta(text_before_change, selection_before_change,
481 u"\n");
482 SendStateUpdateWithDelta(*model, &delta);
483 } else {
484 SendStateUpdate(*model);
485 }
486 }
487 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
488 auto& allocator = args->GetAllocator();
489 args->PushBack(client_id_, allocator);
490 args->PushBack(rapidjson::Value(input_action_, allocator).Move(), allocator);
491
492 channel_->InvokeMethod(kPerformActionMethod, std::move(args));
493 }
494
495 } // namespace flutter
kTextInputTypeName
static constexpr char kTextInputTypeName[]
Definition: text_input_plugin.cc:42
flutter::TextInputPlugin::ComposeBeginHook
virtual void ComposeBeginHook()
Definition: text_input_plugin.cc:125
flutter::TextInputPlugin::ComposeChangeHook
virtual void ComposeChangeHook(const std::u16string &text, int cursor_pos)
Definition: text_input_plugin.cc:192
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:55
kTextInputType
static constexpr char kTextInputType[]
Definition: text_input_plugin.cc:41
kXKey
static constexpr char kXKey[]
Definition: text_input_plugin.cc:51
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:657
kDeltaOldTextKey
static constexpr char kDeltaOldTextKey[]
Definition: text_input_plugin.cc:34
kAffinityDownstream
static constexpr char kAffinityDownstream[]
Definition: text_input_plugin.cc:46
scancode
int scancode
Definition: keyboard_key_handler_unittests.cc:115
was_down
bool was_down
Definition: keyboard_key_handler_unittests.cc:119
text_input_plugin.h
flutter::JsonMethodCodec
Definition: json_method_codec.h:16
extended
bool extended
Definition: keyboard_key_handler_unittests.cc:118
flutter::MethodChannel
Definition: method_channel.h:34
kBadArgumentError
static constexpr char kBadArgumentError[]
Definition: text_input_plugin.cc:59
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:90
kDeltasKey
static constexpr char kDeltasKey[]
Definition: text_input_plugin.cc:38
character
char32_t character
Definition: keyboard_key_handler_unittests.cc:117
kUpdateEditingStateMethod
static constexpr char kUpdateEditingStateMethod[]
Definition: text_input_plugin.cc:28
kTransformKey
static constexpr char kTransformKey[]
Definition: text_input_plugin.cc:55
flutter::TextInputPlugin::ComposeEndHook
virtual void ComposeEndHook()
Definition: text_input_plugin.cc:175
json_method_codec.h
kComposingExtentKey
static constexpr char kComposingExtentKey[]
Definition: text_input_plugin.cc:44
flutter::TextInputPlugin::~TextInputPlugin
virtual ~TextInputPlugin()
kHeightKey
static constexpr char kHeightKey[]
Definition: text_input_plugin.cc:54
flutter::TextInputPlugin::ComposeCommitHook
virtual void ComposeCommitHook()
Definition: text_input_plugin.cc:140
kTextKey
static constexpr char kTextKey[]
Definition: text_input_plugin.cc:50
kChannelName
static constexpr char kChannelName[]
Definition: text_input_plugin.cc:57
kTextInputAction
static constexpr char kTextInputAction[]
Definition: text_input_plugin.cc:40
kEnableDeltaModel
static constexpr char kEnableDeltaModel[]
Definition: text_input_plugin.cc:39
kSelectionIsDirectionalKey
static constexpr char kSelectionIsDirectionalKey[]
Definition: text_input_plugin.cc:49
kSetEditableSizeAndTransform
static constexpr char kSetEditableSizeAndTransform[]
Definition: text_input_plugin.cc:23
kSelectionExtentKey
static constexpr char kSelectionExtentKey[]
Definition: text_input_plugin.cc:48
flutter::Rect::left
double left() const
Definition: geometry.h:63
flutter::BinaryMessenger
Definition: binary_messenger.h:28
flutter::TextRange
Definition: text_range.h:19
flutter_windows_view.h
text
std::u16string text
Definition: keyboard_unittests.cc:332
flutter::TextInputPlugin::TextHook
virtual void TextHook(const std::u16string &text)
Definition: text_input_plugin.cc:67
kSetEditingStateMethod
static constexpr char kSetEditingStateMethod[]
Definition: text_input_plugin.cc:17
kDeltaStartKey
static constexpr char kDeltaStartKey[]
Definition: text_input_plugin.cc:36
kDeltaEndKey
static constexpr char kDeltaEndKey[]
Definition: text_input_plugin.cc:37
flutter::MethodCall
Definition: method_call.h:18
kInternalConsistencyError
static constexpr char kInternalConsistencyError[]
Definition: text_input_plugin.cc:60
kSelectionBaseKey
static constexpr char kSelectionBaseKey[]
Definition: text_input_plugin.cc:47
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::TextInputPlugin::TextInputPlugin
TextInputPlugin(flutter::BinaryMessenger *messenger, FlutterWindowsEngine *engine)
Definition: text_input_plugin.cc:107
kYKey
static constexpr char kYKey[]
Definition: text_input_plugin.cc:52
kWidthKey
static constexpr char kWidthKey[]
Definition: text_input_plugin.cc:53
flutter::Rect::top
double top() const
Definition: geometry.h:64
kSetClientMethod
static constexpr char kSetClientMethod[]
Definition: text_input_plugin.cc:19
kClearClientMethod
static constexpr char kClearClientMethod[]
Definition: text_input_plugin.cc:18
flutter::Rect::size
Size size() const
Definition: geometry.h:70
flutter_windows_engine.h
flutter::MethodCall::method_name
const std::string & method_name() const
Definition: method_call.h:31
flutter::MethodResult
Definition: method_result.h:17
kSelectionAffinityKey
static constexpr char kSelectionAffinityKey[]
Definition: text_input_plugin.cc:45
flutter::TextInputPlugin::KeyboardHook
virtual void KeyboardHook(int key, int scancode, int action, char32_t character, bool extended, bool was_down)
Definition: text_input_plugin.cc:85
kPerformActionMethod
static constexpr char kPerformActionMethod[]
Definition: text_input_plugin.cc:32
flutter::TextRange::start
size_t start() const
Definition: text_range.h:42
kSetMarkedTextRect
static constexpr char kSetMarkedTextRect[]
Definition: text_input_plugin.cc:22
action
int action
Definition: keyboard_key_handler_unittests.cc:116
text_editing_delta.h
kComposingBaseKey
static constexpr char kComposingBaseKey[]
Definition: text_input_plugin.cc:43
flutter::TextRange::length
size_t length() const
Definition: text_range.h:74
key
int key
Definition: keyboard_key_handler_unittests.cc:114
flutter::TextEditingDelta
A change in the state of an input field.
Definition: text_editing_delta.h:16
flutter::MethodCall::arguments
const T * arguments() const
Definition: method_call.h:34
kShowMethod
static constexpr char kShowMethod[]
Definition: text_input_plugin.cc:20
kUpdateEditingStateWithDeltasMethod
static constexpr char kUpdateEditingStateWithDeltasMethod[]
Definition: text_input_plugin.cc:30
kHideMethod
static constexpr char kHideMethod[]
Definition: text_input_plugin.cc:21
kMultilineInputType
static constexpr char kMultilineInputType[]
Definition: text_input_plugin.cc:26
kDeltaTextKey
static constexpr char kDeltaTextKey[]
Definition: text_input_plugin.cc:35
kInputActionNewline
static constexpr char kInputActionNewline[]
Definition: text_input_plugin.cc:63