| Flutter Linux Embedder |

fl_text_input_channel.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/linux/fl_text_input_channel.h"
6
7 #include "flutter/shell/platform/linux/public/flutter_linux/fl_json_method_codec.h"
8 #include "flutter/shell/platform/linux/public/flutter_linux/fl_method_channel.h"
9
10 static constexpr char kChannelName[] = "flutter/textinput";
11
12 static constexpr char kBadArgumentsError[] = "Bad Arguments";
13
14 static constexpr char kSetClientMethod[] = "TextInput.setClient";
15 static constexpr char kShowMethod[] = "TextInput.show";
16 static constexpr char kSetEditingStateMethod[] = "TextInput.setEditingState";
17 static constexpr char kClearClientMethod[] = "TextInput.clearClient";
18 static constexpr char kHideMethod[] = "TextInput.hide";
19 static constexpr char kUpdateEditingStateMethod[] =
20 "TextInputClient.updateEditingState";
21 static constexpr char kUpdateEditingStateWithDeltasMethod[] =
22 "TextInputClient.updateEditingStateWithDeltas";
23 static constexpr char kPerformActionMethod[] = "TextInputClient.performAction";
24 static constexpr char kSetEditableSizeAndTransform[] =
25 "TextInput.setEditableSizeAndTransform";
26 static constexpr char kSetMarkedTextRect[] = "TextInput.setMarkedTextRect";
27
28 static constexpr char kInputActionKey[] = "inputAction";
29 static constexpr char kTextInputTypeKey[] = "inputType";
30 static constexpr char kEnableDeltaModel[] = "enableDeltaModel";
31 static constexpr char kTextInputTypeNameKey[] = "name";
32 static constexpr char kTextKey[] = "text";
33 static constexpr char kSelectionBaseKey[] = "selectionBase";
34 static constexpr char kSelectionExtentKey[] = "selectionExtent";
35 static constexpr char kSelectionAffinityKey[] = "selectionAffinity";
36 static constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional";
37 static constexpr char kComposingBaseKey[] = "composingBase";
38 static constexpr char kComposingExtentKey[] = "composingExtent";
39
40 static constexpr char kTransform[] = "transform";
41
42 static constexpr char kMultilineInputType[] = "TextInputType.multiline";
43 static constexpr char kNoneInputType[] = "TextInputType.none";
44
45 static constexpr char kTextAffinityUpstream[] = "TextAffinity.upstream";
46 static constexpr char kTextAffinityDownstream[] = "TextAffinity.downstream";
47
48 struct _FlTextInputChannel {
49 GObject parent_instance;
50
51 FlMethodChannel* channel;
52
53 FlTextInputChannelVTable* vtable;
54
55 gpointer user_data;
56 };
57
58 G_DEFINE_TYPE(FlTextInputChannel, fl_text_input_channel, G_TYPE_OBJECT)
59
60 static const gchar* text_affinity_to_string(FlTextAffinity affinity) {
61 switch (affinity) {
62 case FL_TEXT_AFFINITY_UPSTREAM:
63 return kTextAffinityUpstream;
64 case FL_TEXT_AFFINITY_DOWNSTREAM:
65 return kTextAffinityDownstream;
66 default:
67 g_assert_not_reached();
68 }
69 }
70
71 // Called when the input method client is set up.
72 static FlMethodResponse* set_client(FlTextInputChannel* self, FlValue* args) {
73 if (fl_value_get_type(args) != FL_VALUE_TYPE_LIST ||
74 fl_value_get_length(args) < 2) {
75 return FL_METHOD_RESPONSE(fl_method_error_response_new(
76 kBadArgumentsError, "Expected 2-element list", nullptr));
77 }
78
79 int64_t client_id = fl_value_get_int(fl_value_get_list_value(args, 0));
80 FlValue* config_value = fl_value_get_list_value(args, 1);
81 const gchar* input_action = nullptr;
82 FlValue* input_action_value =
83 fl_value_lookup_string(config_value, kInputActionKey);
84 if (fl_value_get_type(input_action_value) == FL_VALUE_TYPE_STRING) {
85 input_action = fl_value_get_string(input_action_value);
86 }
87
88 FlValue* enable_delta_model_value =
89 fl_value_lookup_string(config_value, kEnableDeltaModel);
90 gboolean enable_delta_model = fl_value_get_bool(enable_delta_model_value);
91
92 // Reset the input type, then set only if appropriate.
93 FlTextInputType input_type = FL_TEXT_INPUT_TYPE_TEXT;
94 FlValue* input_type_value =
95 fl_value_lookup_string(config_value, kTextInputTypeKey);
96 if (fl_value_get_type(input_type_value) == FL_VALUE_TYPE_MAP) {
97 FlValue* input_type_name_value =
98 fl_value_lookup_string(input_type_value, kTextInputTypeNameKey);
99 if (fl_value_get_type(input_type_name_value) == FL_VALUE_TYPE_STRING) {
100 const gchar* input_type_name = fl_value_get_string(input_type_name_value);
101 if (g_strcmp0(input_type_name, kMultilineInputType) == 0) {
102 input_type = FL_TEXT_INPUT_TYPE_MULTILINE;
103 } else if (g_strcmp0(input_type_name, kNoneInputType) == 0) {
104 input_type = FL_TEXT_INPUT_TYPE_NONE;
105 }
106 }
107 }
108
109 self->vtable->set_client(client_id, input_action, enable_delta_model,
110 input_type, self->user_data);
111
112 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
113 }
114
115 // Hides the input method.
116 static FlMethodResponse* hide(FlTextInputChannel* self) {
117 self->vtable->hide(self->user_data);
118 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
119 }
120
121 // Shows the input method.
122 static FlMethodResponse* show(FlTextInputChannel* self) {
123 self->vtable->show(self->user_data);
124 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
125 }
126
127 // Updates the editing state from Flutter.
128 static FlMethodResponse* set_editing_state(FlTextInputChannel* self,
129 FlValue* args) {
130 const gchar* text =
131 fl_value_get_string(fl_value_lookup_string(args, kTextKey));
132 int64_t selection_base =
133 fl_value_get_int(fl_value_lookup_string(args, kSelectionBaseKey));
134 int64_t selection_extent =
135 fl_value_get_int(fl_value_lookup_string(args, kSelectionExtentKey));
136 int64_t composing_base =
137 fl_value_get_int(fl_value_lookup_string(args, kComposingBaseKey));
138 int64_t composing_extent =
139 fl_value_get_int(fl_value_lookup_string(args, kComposingExtentKey));
140
141 self->vtable->set_editing_state(text, selection_base, selection_extent,
142 composing_base, composing_extent,
143 self->user_data);
144
145 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
146 }
147
148 // Called when the input method client is complete.
149 static FlMethodResponse* clear_client(FlTextInputChannel* self) {
150 self->vtable->clear_client(self->user_data);
151 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
152 }
153
154 // Handles updates to the EditableText size and position from the framework.
155 //
156 // On changes to the size or position of the RenderObject underlying the
157 // EditableText, this update may be triggered. It provides an updated size and
158 // transform from the local coordinate system of the EditableText to root
159 // Flutter coordinate system.
160 static FlMethodResponse* set_editable_size_and_transform(
161 FlTextInputChannel* self,
162 FlValue* args) {
163 FlValue* transform_value = fl_value_lookup_string(args, kTransform);
164 if (fl_value_get_length(transform_value) != 16) {
165 return FL_METHOD_RESPONSE(fl_method_error_response_new(
166 kBadArgumentsError, "Invalid transform", nullptr));
167 }
168
169 double transform[16];
170 for (size_t i = 0; i < 16; i++) {
171 transform[i] =
172 fl_value_get_float(fl_value_get_list_value(transform_value, i));
173 }
174 self->vtable->set_editable_size_and_transform(transform, self->user_data);
175
176 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
177 }
178
179 // Handles updates to the composing rect from the framework.
180 //
181 // On changes to the state of the EditableText in the framework, this update
182 // may be triggered. It provides an updated rect for the composing region in
183 // local coordinates of the EditableText. In the case where there is no
184 // composing region, the cursor rect is sent.
185 static FlMethodResponse* set_marked_text_rect(FlTextInputChannel* self,
186 FlValue* args) {
187 double x = fl_value_get_float(fl_value_lookup_string(args, "x"));
188 double y = fl_value_get_float(fl_value_lookup_string(args, "y"));
189 double width = fl_value_get_float(fl_value_lookup_string(args, "width"));
190 double height = fl_value_get_float(fl_value_lookup_string(args, "height"));
191
192 self->vtable->set_marked_text_rect(x, y, width, height, self->user_data);
193
194 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
195 }
196
197 // Called when a method call is received from Flutter.
198 static void method_call_cb(FlMethodChannel* channel,
199 FlMethodCall* method_call,
200 gpointer user_data) {
201 FlTextInputChannel* self = FL_TEXT_INPUT_CHANNEL(user_data);
202
203 const gchar* method = fl_method_call_get_name(method_call);
204 FlValue* args = fl_method_call_get_args(method_call);
205
206 g_autoptr(FlMethodResponse) response = nullptr;
207 if (strcmp(method, kSetClientMethod) == 0) {
208 response = set_client(self, args);
209 } else if (strcmp(method, kShowMethod) == 0) {
210 response = show(self);
211 } else if (strcmp(method, kSetEditingStateMethod) == 0) {
212 response = set_editing_state(self, args);
213 } else if (strcmp(method, kClearClientMethod) == 0) {
214 response = clear_client(self);
215 } else if (strcmp(method, kHideMethod) == 0) {
216 response = hide(self);
217 } else if (strcmp(method, kSetEditableSizeAndTransform) == 0) {
218 response = set_editable_size_and_transform(self, args);
219 } else if (strcmp(method, kSetMarkedTextRect) == 0) {
220 response = set_marked_text_rect(self, args);
221 } else {
222 response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
223 }
224
225 g_autoptr(GError) error = nullptr;
226 if (!fl_method_call_respond(method_call, response, &error)) {
227 g_warning("Failed to send method call response: %s", error->message);
228 }
229 }
230
231 static void fl_text_input_channel_dispose(GObject* object) {
232 FlTextInputChannel* self = FL_TEXT_INPUT_CHANNEL(object);
233
234 g_clear_object(&self->channel);
235
236 G_OBJECT_CLASS(fl_text_input_channel_parent_class)->dispose(object);
237 }
238
239 static void fl_text_input_channel_class_init(FlTextInputChannelClass* klass) {
240 G_OBJECT_CLASS(klass)->dispose = fl_text_input_channel_dispose;
241 }
242
243 static void fl_text_input_channel_init(FlTextInputChannel* self) {}
244
245 FlTextInputChannel* fl_text_input_channel_new(FlBinaryMessenger* messenger,
246 FlTextInputChannelVTable* vtable,
247 gpointer user_data) {
248 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
249 g_return_val_if_fail(vtable != nullptr, nullptr);
250
251 FlTextInputChannel* self = FL_TEXT_INPUT_CHANNEL(
252 g_object_new(fl_text_input_channel_get_type(), nullptr));
253
254 self->vtable = vtable;
255 self->user_data = user_data;
256
257 g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
258 self->channel =
259 fl_method_channel_new(messenger, kChannelName, FL_METHOD_CODEC(codec));
260 fl_method_channel_set_method_call_handler(self->channel, method_call_cb, self,
261 nullptr);
262
263 return self;
264 }
265
266 void fl_text_input_channel_update_editing_state(
267 FlTextInputChannel* self,
268 int64_t client_id,
269 const gchar* text,
270 int64_t selection_base,
271 int64_t selection_extent,
272 FlTextAffinity selection_affinity,
273 gboolean selection_is_directional,
274 int64_t composing_base,
275 int64_t composing_extent,
276 GCancellable* cancellable,
277 GAsyncReadyCallback callback,
278 gpointer user_data) {
279 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
280
281 g_autoptr(FlValue) args = fl_value_new_list();
282 fl_value_append_take(args, fl_value_new_int(client_id));
283 g_autoptr(FlValue) value = fl_value_new_map();
284
285 fl_value_set_string_take(value, kTextKey, fl_value_new_string(text));
286 fl_value_set_string_take(value, kSelectionBaseKey,
287 fl_value_new_int(selection_base));
288 fl_value_set_string_take(value, kSelectionExtentKey,
289 fl_value_new_int(selection_extent));
290 fl_value_set_string_take(
291 value, kSelectionAffinityKey,
292 fl_value_new_string(text_affinity_to_string(selection_affinity)));
293 fl_value_set_string_take(value, kSelectionIsDirectionalKey,
294 fl_value_new_bool(selection_is_directional));
295 fl_value_set_string_take(value, kComposingBaseKey,
296 fl_value_new_int(composing_base));
297 fl_value_set_string_take(value, kComposingExtentKey,
298 fl_value_new_int(composing_extent));
299
300 fl_value_append(args, value);
301
302 fl_method_channel_invoke_method(self->channel, kUpdateEditingStateMethod,
303 args, cancellable, callback, user_data);
304 }
305
306 gboolean fl_text_input_channel_update_editing_state_finish(GObject* object,
307 GAsyncResult* result,
308 GError** error) {
309 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
310 FL_METHOD_CHANNEL(object), result, error);
311 if (response == nullptr) {
312 return FALSE;
313 }
314 return fl_method_response_get_result(response, error) != nullptr;
315 }
316
317 void fl_text_input_channel_update_editing_state_with_deltas(
318 FlTextInputChannel* self,
319 int64_t client_id,
320 const gchar* old_text,
321 const gchar* delta_text,
322 int64_t delta_start,
323 int64_t delta_end,
324 int64_t selection_base,
325 int64_t selection_extent,
326 FlTextAffinity selection_affinity,
327 gboolean selection_is_directional,
328 int64_t composing_base,
329 int64_t composing_extent,
330 GCancellable* cancellable,
331 GAsyncReadyCallback callback,
332 gpointer user_data) {
333 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
334
335 g_autoptr(FlValue) args = fl_value_new_list();
336 fl_value_append_take(args, fl_value_new_int(client_id));
337
338 g_autoptr(FlValue) deltaValue = fl_value_new_map();
339 fl_value_set_string_take(deltaValue, "oldText",
340 fl_value_new_string(old_text));
341 fl_value_set_string_take(deltaValue, "deltaText",
342 fl_value_new_string(delta_text));
343 fl_value_set_string_take(deltaValue, "deltaStart",
344 fl_value_new_int(delta_start));
345 fl_value_set_string_take(deltaValue, "deltaEnd", fl_value_new_int(delta_end));
346 fl_value_set_string_take(deltaValue, "selectionBase",
347 fl_value_new_int(selection_base));
348 fl_value_set_string_take(deltaValue, "selectionExtent",
349 fl_value_new_int(selection_extent));
350 fl_value_set_string_take(
351 deltaValue, "selectionAffinity",
352 fl_value_new_string(text_affinity_to_string(selection_affinity)));
353 fl_value_set_string_take(deltaValue, "selectionIsDirectional",
354 fl_value_new_bool(selection_is_directional));
355 fl_value_set_string_take(deltaValue, "composingBase",
356 fl_value_new_int(composing_base));
357 fl_value_set_string_take(deltaValue, "composingExtent",
358 fl_value_new_int(composing_extent));
359
360 g_autoptr(FlValue) deltas = fl_value_new_list();
361 fl_value_append(deltas, deltaValue);
362 g_autoptr(FlValue) value = fl_value_new_map();
363 fl_value_set_string(value, "deltas", deltas);
364
365 fl_value_append(args, value);
366
367 fl_method_channel_invoke_method(self->channel,
368 kUpdateEditingStateWithDeltasMethod, args,
369 cancellable, callback, user_data);
370 }
371
372 gboolean fl_text_input_channel_update_editing_state_with_deltas_finish(
373 GObject* object,
374 GAsyncResult* result,
375 GError** error) {
376 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
377 FL_METHOD_CHANNEL(object), result, error);
378 if (response == nullptr) {
379 return FALSE;
380 }
381 return fl_method_response_get_result(response, error) != nullptr;
382 }
383
384 void fl_text_input_channel_perform_action(FlTextInputChannel* self,
385 int64_t client_id,
386 const gchar* input_action,
387 GCancellable* cancellable,
388 GAsyncReadyCallback callback,
389 gpointer user_data) {
390 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
391
392 g_autoptr(FlValue) args = fl_value_new_list();
393 fl_value_append_take(args, fl_value_new_int(client_id));
394 fl_value_append_take(args, fl_value_new_string(input_action));
395
396 fl_method_channel_invoke_method(self->channel, kPerformActionMethod, args,
397 cancellable, callback, user_data);
398 }
399
400 gboolean fl_text_input_channel_perform_action_finish(GObject* object,
401 GAsyncResult* result,
402 GError** error) {
403 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
404 FL_METHOD_CHANNEL(object), result, error);
405 if (response == nullptr) {
406 return FALSE;
407 }
408 return fl_method_response_get_result(response, error) != nullptr;
409 }
G_DEFINE_TYPE
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
Definition: fl_basic_message_channel.cc:37
height
self height
Definition: fl_compositor_software.cc:43
g_autoptr
g_autoptr(GMutexLocker) locker
width
self width
Definition: fl_compositor_software.cc:42
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_json_method_codec_new
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
Definition: fl_json_method_codec.cc:205
fl_json_method_codec.h
fl_method_call_respond
G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall *self, FlMethodResponse *response, GError **error)
Definition: fl_method_call.cc:77
fl_method_call_get_name
G_MODULE_EXPORT const gchar * fl_method_call_get_name(FlMethodCall *self)
Definition: fl_method_call.cc:67
fl_method_call_get_args
G_MODULE_EXPORT FlValue * fl_method_call_get_args(FlMethodCall *self)
Definition: fl_method_call.cc:72
fl_method_channel_invoke_method
G_MODULE_EXPORT void fl_method_channel_invoke_method(FlMethodChannel *self, const gchar *method, FlValue *args, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_method_channel.cc:162
fl_method_channel_new
G_MODULE_EXPORT FlMethodChannel * fl_method_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec)
Definition: fl_method_channel.cc:112
fl_method_channel_invoke_method_finish
G_MODULE_EXPORT FlMethodResponse * fl_method_channel_invoke_method_finish(FlMethodChannel *self, GAsyncResult *result, GError **error)
Definition: fl_method_channel.cc:192
fl_method_channel_set_method_call_handler
G_MODULE_EXPORT void fl_method_channel_set_method_call_handler(FlMethodChannel *self, FlMethodChannelMethodCallHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_method_channel.cc:134
fl_method_channel.h
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
fl_method_error_response_new
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
Definition: fl_method_response.cc:144
fl_method_success_response_new
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
Definition: fl_method_response.cc:126
fl_method_response_get_result
G_MODULE_EXPORT FlValue * fl_method_response_get_result(FlMethodResponse *self, GError **error)
Definition: fl_method_response.cc:82
fl_method_not_implemented_response_new
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()
Definition: fl_method_response.cc:179
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
i
int i
Definition: fl_socket_accessible.cc:18
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
kClearClientMethod
static constexpr char kClearClientMethod[]
Definition: fl_text_input_channel.cc:17
kSetEditableSizeAndTransform
static constexpr char kSetEditableSizeAndTransform[]
Definition: fl_text_input_channel.cc:24
fl_text_input_channel_update_editing_state_with_deltas
void fl_text_input_channel_update_editing_state_with_deltas(FlTextInputChannel *self, int64_t client_id, const gchar *old_text, const gchar *delta_text, int64_t delta_start, int64_t delta_end, int64_t selection_base, int64_t selection_extent, FlTextAffinity selection_affinity, gboolean selection_is_directional, int64_t composing_base, int64_t composing_extent, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:317
method_call_cb
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_text_input_channel.cc:198
kTextAffinityUpstream
static constexpr char kTextAffinityUpstream[]
Definition: fl_text_input_channel.cc:45
set_editing_state
static FlMethodResponse * set_editing_state(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:128
kSetMarkedTextRect
static constexpr char kSetMarkedTextRect[]
Definition: fl_text_input_channel.cc:26
kEnableDeltaModel
static constexpr char kEnableDeltaModel[]
Definition: fl_text_input_channel.cc:30
kNoneInputType
static constexpr char kNoneInputType[]
Definition: fl_text_input_channel.cc:43
fl_text_input_channel_dispose
static void fl_text_input_channel_dispose(GObject *object)
Definition: fl_text_input_channel.cc:231
kTransform
static constexpr char kTransform[]
Definition: fl_text_input_channel.cc:40
kSelectionIsDirectionalKey
static constexpr char kSelectionIsDirectionalKey[]
Definition: fl_text_input_channel.cc:36
kHideMethod
static constexpr char kHideMethod[]
Definition: fl_text_input_channel.cc:18
kMultilineInputType
static constexpr char kMultilineInputType[]
Definition: fl_text_input_channel.cc:42
set_editable_size_and_transform
static FlMethodResponse * set_editable_size_and_transform(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:160
kSetEditingStateMethod
static constexpr char kSetEditingStateMethod[]
Definition: fl_text_input_channel.cc:16
kSelectionExtentKey
static constexpr char kSelectionExtentKey[]
Definition: fl_text_input_channel.cc:34
kTextInputTypeNameKey
static constexpr char kTextInputTypeNameKey[]
Definition: fl_text_input_channel.cc:31
fl_text_input_channel_new
FlTextInputChannel * fl_text_input_channel_new(FlBinaryMessenger *messenger, FlTextInputChannelVTable *vtable, gpointer user_data)
Definition: fl_text_input_channel.cc:245
fl_text_input_channel_update_editing_state
void fl_text_input_channel_update_editing_state(FlTextInputChannel *self, int64_t client_id, const gchar *text, int64_t selection_base, int64_t selection_extent, FlTextAffinity selection_affinity, gboolean selection_is_directional, int64_t composing_base, int64_t composing_extent, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:266
fl_text_input_channel_update_editing_state_finish
gboolean fl_text_input_channel_update_editing_state_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:306
hide
static FlMethodResponse * hide(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:116
kChannelName
static constexpr char kChannelName[]
Definition: fl_text_input_channel.cc:10
fl_text_input_channel_perform_action
void fl_text_input_channel_perform_action(FlTextInputChannel *self, int64_t client_id, const gchar *input_action, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_text_input_channel.cc:384
text_affinity_to_string
static const gchar * text_affinity_to_string(FlTextAffinity affinity)
Definition: fl_text_input_channel.cc:60
kSetClientMethod
static constexpr char kSetClientMethod[]
Definition: fl_text_input_channel.cc:14
kUpdateEditingStateMethod
static constexpr char kUpdateEditingStateMethod[]
Definition: fl_text_input_channel.cc:19
kTextInputTypeKey
static constexpr char kTextInputTypeKey[]
Definition: fl_text_input_channel.cc:29
kBadArgumentsError
static constexpr char kBadArgumentsError[]
Definition: fl_text_input_channel.cc:12
kPerformActionMethod
static constexpr char kPerformActionMethod[]
Definition: fl_text_input_channel.cc:23
kShowMethod
static constexpr char kShowMethod[]
Definition: fl_text_input_channel.cc:15
kComposingExtentKey
static constexpr char kComposingExtentKey[]
Definition: fl_text_input_channel.cc:38
kTextAffinityDownstream
static constexpr char kTextAffinityDownstream[]
Definition: fl_text_input_channel.cc:46
kInputActionKey
static constexpr char kInputActionKey[]
Definition: fl_text_input_channel.cc:28
fl_text_input_channel_perform_action_finish
gboolean fl_text_input_channel_perform_action_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:400
kComposingBaseKey
static constexpr char kComposingBaseKey[]
Definition: fl_text_input_channel.cc:37
kUpdateEditingStateWithDeltasMethod
static constexpr char kUpdateEditingStateWithDeltasMethod[]
Definition: fl_text_input_channel.cc:21
set_client
static FlMethodResponse * set_client(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:72
show
static FlMethodResponse * show(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:122
fl_text_input_channel_class_init
static void fl_text_input_channel_class_init(FlTextInputChannelClass *klass)
Definition: fl_text_input_channel.cc:239
kSelectionAffinityKey
static constexpr char kSelectionAffinityKey[]
Definition: fl_text_input_channel.cc:35
fl_text_input_channel_update_editing_state_with_deltas_finish
gboolean fl_text_input_channel_update_editing_state_with_deltas_finish(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_text_input_channel.cc:372
kTextKey
static constexpr char kTextKey[]
Definition: fl_text_input_channel.cc:32
kSelectionBaseKey
static constexpr char kSelectionBaseKey[]
Definition: fl_text_input_channel.cc:33
set_marked_text_rect
static FlMethodResponse * set_marked_text_rect(FlTextInputChannel *self, FlValue *args)
Definition: fl_text_input_channel.cc:185
fl_text_input_channel_init
static void fl_text_input_channel_init(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:243
clear_client
static FlMethodResponse * clear_client(FlTextInputChannel *self)
Definition: fl_text_input_channel.cc:149
fl_text_input_channel.h
FlTextAffinity
FlTextAffinity
Definition: fl_text_input_channel.h:22
FL_TEXT_AFFINITY_DOWNSTREAM
@ FL_TEXT_AFFINITY_DOWNSTREAM
Definition: fl_text_input_channel.h:24
FL_TEXT_AFFINITY_UPSTREAM
@ FL_TEXT_AFFINITY_UPSTREAM
Definition: fl_text_input_channel.h:23
FlTextInputType
FlTextInputType
Definition: fl_text_input_channel.h:14
FL_TEXT_INPUT_TYPE_MULTILINE
@ FL_TEXT_INPUT_TYPE_MULTILINE
Definition: fl_text_input_channel.h:17
FL_TEXT_INPUT_TYPE_TEXT
@ FL_TEXT_INPUT_TYPE_TEXT
Definition: fl_text_input_channel.h:15
FL_TEXT_INPUT_TYPE_NONE
@ FL_TEXT_INPUT_TYPE_NONE
Definition: fl_text_input_channel.h:19
fl_value_set_string
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:639
fl_value_lookup_string
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
Definition: fl_value.cc:811
fl_value_set_string_take
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:650
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:776
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
fl_value_get_string
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:68
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:73
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:74
_FlTextInputChannel
Definition: fl_text_input_channel.cc:48
_FlTextInputChannel::parent_instance
GObject parent_instance
Definition: fl_text_input_channel.cc:49
_FlTextInputChannel::vtable
FlTextInputChannelVTable * vtable
Definition: fl_text_input_channel.cc:53
_FlTextInputChannel::channel
FlMethodChannel * channel
Definition: fl_text_input_channel.cc:51
_FlTextInputChannel::user_data
gpointer user_data
Definition: fl_text_input_channel.cc:55
FlTextInputChannelVTable
Definition: fl_text_input_channel.h:40