Flutter Engine
 
Loading...
Searching...
No Matches
fl_text_input_channel.cc File Reference

Go to the source code of this file.

Classes

struct  _FlTextInputChannel
 

Functions

static const gchar * text_affinity_to_string (FlTextAffinity affinity)
 
static FlMethodResponse * set_client (FlTextInputChannel *self, FlValue *args)
 
static FlMethodResponse * hide (FlTextInputChannel *self)
 
static FlMethodResponse * show (FlTextInputChannel *self)
 
static FlMethodResponse * set_editing_state (FlTextInputChannel *self, FlValue *args)
 
static FlMethodResponse * clear_client (FlTextInputChannel *self)
 
static FlMethodResponse * set_editable_size_and_transform (FlTextInputChannel *self, FlValue *args)
 
static FlMethodResponse * set_marked_text_rect (FlTextInputChannel *self, FlValue *args)
 
static void method_call_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
static void fl_text_input_channel_dispose (GObject *object)
 
static void fl_text_input_channel_class_init (FlTextInputChannelClass *klass)
 
static void fl_text_input_channel_init (FlTextInputChannel *self)
 
FlTextInputChannel * fl_text_input_channel_new (FlBinaryMessenger *messenger, FlTextInputChannelVTable *vtable, gpointer user_data)
 
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)
 
gboolean fl_text_input_channel_update_editing_state_finish (GObject *object, GAsyncResult *result, GError **error)
 
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)
 
gboolean fl_text_input_channel_update_editing_state_with_deltas_finish (GObject *object, GAsyncResult *result, GError **error)
 
void fl_text_input_channel_perform_action (FlTextInputChannel *self, int64_t client_id, const gchar *input_action, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
 
gboolean fl_text_input_channel_perform_action_finish (GObject *object, GAsyncResult *result, GError **error)
 

Variables

static constexpr char kChannelName [] = "flutter/textinput"
 
static constexpr char kBadArgumentsError [] = "Bad Arguments"
 
static constexpr char kSetClientMethod [] = "TextInput.setClient"
 
static constexpr char kShowMethod [] = "TextInput.show"
 
static constexpr char kSetEditingStateMethod [] = "TextInput.setEditingState"
 
static constexpr char kClearClientMethod [] = "TextInput.clearClient"
 
static constexpr char kHideMethod [] = "TextInput.hide"
 
static constexpr char kUpdateEditingStateMethod []
 
static constexpr char kUpdateEditingStateWithDeltasMethod []
 
static constexpr char kPerformActionMethod [] = "TextInputClient.performAction"
 
static constexpr char kSetEditableSizeAndTransform []
 
static constexpr char kSetMarkedTextRect [] = "TextInput.setMarkedTextRect"
 
static constexpr char kInputActionKey [] = "inputAction"
 
static constexpr char kTextInputTypeKey [] = "inputType"
 
static constexpr char kEnableDeltaModel [] = "enableDeltaModel"
 
static constexpr char kTextInputTypeNameKey [] = "name"
 
static constexpr char kTextKey [] = "text"
 
static constexpr char kSelectionBaseKey [] = "selectionBase"
 
static constexpr char kSelectionExtentKey [] = "selectionExtent"
 
static constexpr char kSelectionAffinityKey [] = "selectionAffinity"
 
static constexpr char kSelectionIsDirectionalKey [] = "selectionIsDirectional"
 
static constexpr char kComposingBaseKey [] = "composingBase"
 
static constexpr char kComposingExtentKey [] = "composingExtent"
 
static constexpr char kTransform [] = "transform"
 
static constexpr char kMultilineInputType [] = "TextInputType.multiline"
 
static constexpr char kNoneInputType [] = "TextInputType.none"
 
static constexpr char kTextAffinityUpstream [] = "TextAffinity.upstream"
 
static constexpr char kTextAffinityDownstream [] = "TextAffinity.downstream"
 

Function Documentation

◆ clear_client()

static FlMethodResponse * clear_client ( FlTextInputChannel *  self)
static

Definition at line 149 of file fl_text_input_channel.cc.

149 {
150 self->vtable->clear_client(self->user_data);
151 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
152}
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)

References fl_method_success_response_new(), and self.

Referenced by method_call_cb().

◆ fl_text_input_channel_class_init()

static void fl_text_input_channel_class_init ( FlTextInputChannelClass *  klass)
static

Definition at line 239 of file fl_text_input_channel.cc.

239 {
240 G_OBJECT_CLASS(klass)->dispose = fl_text_input_channel_dispose;
241}
static void fl_text_input_channel_dispose(GObject *object)

References fl_text_input_channel_dispose().

◆ fl_text_input_channel_dispose()

static void fl_text_input_channel_dispose ( GObject *  object)
static

Definition at line 231 of file fl_text_input_channel.cc.

231 {
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}

References self.

Referenced by fl_text_input_channel_class_init().

◆ fl_text_input_channel_init()

static void fl_text_input_channel_init ( FlTextInputChannel *  self)
static

Definition at line 243 of file fl_text_input_channel.cc.

243{}

◆ fl_text_input_channel_new()

FlTextInputChannel * fl_text_input_channel_new ( FlBinaryMessenger *  messenger,
FlTextInputChannelVTable vtable,
gpointer  user_data 
)

fl_text_input_channel_new: @messenger: an #FlBinaryMessenger. @vtable: callbacks for incoming method calls. @user_data: data to pass in callbacks.

Creates a new channel that implements SystemChannels.textInput from the Flutter services library.

Returns: a new #FlTextInputChannel.

Definition at line 245 of file fl_text_input_channel.cc.

247 {
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));
261 nullptr);
262
263 return self;
264}
g_autoptr(GMutexLocker) locker
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
G_MODULE_EXPORT FlMethodChannel * fl_method_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec)
G_MODULE_EXPORT void fl_method_channel_set_method_call_handler(FlMethodChannel *self, FlMethodChannelMethodCallHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
static constexpr char kChannelName[]

References fl_json_method_codec_new(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), g_autoptr(), kChannelName, method_call_cb(), self, and user_data.

Referenced by fl_text_input_handler_new().

◆ fl_text_input_channel_perform_action()

void fl_text_input_channel_perform_action ( FlTextInputChannel *  channel,
int64_t  client_id,
const gchar *  input_action,
GCancellable *  cancellable,
GAsyncReadyCallback  callback,
gpointer  user_data 
)

fl_text_input_channel_perform_action: @channel: an #FlTextInputChannel. @client_id: @input_action: action to perform. @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the method returns. @user_data: (closure): user data to pass to @callback.

Definition at line 384 of file fl_text_input_channel.cc.

389 {
390 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
391
395
397 cancellable, callback, user_data);
398}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_MODULE_EXPORT void fl_method_channel_invoke_method(FlMethodChannel *self, const gchar *method, FlValue *args, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
static constexpr char kPerformActionMethod[]
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition fl_value.cc:276
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition fl_value.cc:262
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition fl_value.cc:600
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition fl_value.cc:349
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition fl_value.h:42
FlutterDesktopBinaryReply callback

References args, callback, fl_method_channel_invoke_method(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), g_autoptr(), kPerformActionMethod, self, and user_data.

Referenced by perform_action().

◆ fl_text_input_channel_perform_action_finish()

gboolean fl_text_input_channel_perform_action_finish ( GObject *  object,
GAsyncResult *  result,
GError **  error 
)

fl_text_input_channel_perform_action_finish: @object:

Returns
: a #GAsyncResult. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Completes request started with fl_text_input_channel_perform_action().

Returns: TRUE on success.

Definition at line 400 of file fl_text_input_channel.cc.

402 {
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_MODULE_EXPORT FlMethodResponse * fl_method_channel_invoke_method_finish(FlMethodChannel *self, GAsyncResult *result, GError **error)
G_MODULE_EXPORT FlValue * fl_method_response_get_result(FlMethodResponse *self, GError **error)
const uint8_t uint32_t uint32_t GError ** error

References error, fl_method_channel_invoke_method_finish(), fl_method_response_get_result(), and g_autoptr().

Referenced by perform_action_response_cb().

◆ fl_text_input_channel_update_editing_state()

void fl_text_input_channel_update_editing_state ( FlTextInputChannel *  channel,
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 
)

fl_text_input_channel_update_editing_state: @channel: an #FlTextInputChannel. @client_id: @text: @selection_base: @selection_extent: @selection_affinity: @selection_is_directional: @composing_base: @composing_extent: @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the method returns. @user_data: (closure): user data to pass to @callback.

Definition at line 266 of file fl_text_input_channel.cc.

278 {
279 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
280
284
287 fl_value_new_int(selection_base));
289 fl_value_new_int(selection_extent));
292 fl_value_new_string(text_affinity_to_string(selection_affinity)));
294 fl_value_new_bool(selection_is_directional));
296 fl_value_new_int(composing_base));
298 fl_value_new_int(composing_extent));
299
300 fl_value_append(args, value);
301
303 args, cancellable, callback, user_data);
304}
int32_t value
static constexpr char kSelectionIsDirectionalKey[]
static constexpr char kSelectionExtentKey[]
static constexpr char kUpdateEditingStateMethod[]
static constexpr char kComposingExtentKey[]
static constexpr char kComposingBaseKey[]
static const gchar * text_affinity_to_string(FlTextAffinity affinity)
static constexpr char kSelectionAffinityKey[]
static constexpr char kTextKey[]
static constexpr char kSelectionBaseKey[]
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition fl_value.cc:366
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition fl_value.cc:650
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition fl_value.cc:592
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition fl_value.cc:255
std::u16string text

References args, callback, fl_method_channel_invoke_method(), fl_value_append(), fl_value_append_take(), fl_value_new_bool(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_string_take(), g_autoptr(), kComposingBaseKey, kComposingExtentKey, kSelectionAffinityKey, kSelectionBaseKey, kSelectionExtentKey, kSelectionIsDirectionalKey, kTextKey, kUpdateEditingStateMethod, self, text, text_affinity_to_string(), user_data, and value.

Referenced by update_editing_state().

◆ fl_text_input_channel_update_editing_state_finish()

gboolean fl_text_input_channel_update_editing_state_finish ( GObject *  object,
GAsyncResult *  result,
GError **  error 
)

fl_text_input_channel_update_editing_state_finish: @object:

Returns
: a #GAsyncResult. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Completes request started with fl_text_input_channel_update_editing_state().

Returns: TRUE on success.

Definition at line 306 of file fl_text_input_channel.cc.

308 {
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}

References error, fl_method_channel_invoke_method_finish(), fl_method_response_get_result(), and g_autoptr().

Referenced by update_editing_state_response_cb().

◆ fl_text_input_channel_update_editing_state_with_deltas()

void fl_text_input_channel_update_editing_state_with_deltas ( FlTextInputChannel *  channel,
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 
)

fl_text_input_channel_update_editing_state_with_deltas: @channel: an #FlTextInputChannel. @client_id: @old_text: @delta_text: @delta_start: @delta_end: @selection_base: @selection_extent: @selection_affinity: @selection_is_directional: @composing_base: @composing_extent: @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the method returns. @user_data: (closure): user data to pass to @callback.

Definition at line 317 of file fl_text_input_channel.cc.

332 {
333 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
334
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));
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
361 fl_value_append(deltas, deltaValue);
363 fl_value_set_string(value, "deltas", deltas);
364
365 fl_value_append(args, value);
366
369 cancellable, callback, user_data);
370}
static constexpr char kUpdateEditingStateWithDeltasMethod[]
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition fl_value.cc:639

References args, callback, fl_method_channel_invoke_method(), fl_value_append(), fl_value_append_take(), fl_value_new_bool(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_string(), fl_value_set_string_take(), g_autoptr(), kUpdateEditingStateWithDeltasMethod, self, text_affinity_to_string(), user_data, and value.

Referenced by update_editing_state_with_delta().

◆ 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 
)

fl_text_input_channel_update_editing_state_with_deltas_finish: @object:

Returns
: a #GAsyncResult. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Completes request started with fl_text_input_channel_update_editing_state_with_deltas().

Returns: TRUE on success.

Definition at line 372 of file fl_text_input_channel.cc.

375 {
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}

References error, fl_method_channel_invoke_method_finish(), fl_method_response_get_result(), and g_autoptr().

Referenced by update_editing_state_with_deltas_response_cb().

◆ hide()

static FlMethodResponse * hide ( FlTextInputChannel *  self)
static

Definition at line 116 of file fl_text_input_channel.cc.

116 {
117 self->vtable->hide(self->user_data);
118 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
119}

References fl_method_success_response_new(), and self.

Referenced by GetMacOSProvidedMenus(), and method_call_cb().

◆ method_call_cb()

static void method_call_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 198 of file fl_text_input_channel.cc.

200 {
201 FlTextInputChannel* self = FL_TEXT_INPUT_CHANNEL(user_data);
202
203 const gchar* method = fl_method_call_get_name(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) {
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}
G_MODULE_EXPORT const gchar * fl_method_call_get_name(FlMethodCall *self)
G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall *self, FlMethodResponse *response, GError **error)
G_MODULE_EXPORT FlValue * fl_method_call_get_args(FlMethodCall *self)
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()
static constexpr char kClearClientMethod[]
static constexpr char kSetEditableSizeAndTransform[]
static constexpr char kSetMarkedTextRect[]
static constexpr char kHideMethod[]
static FlMethodResponse * set_client(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * set_marked_text_rect(FlTextInputChannel *self, FlValue *args)
static constexpr char kSetEditingStateMethod[]
static FlMethodResponse * set_editing_state(FlTextInputChannel *self, FlValue *args)
static FlMethodResponse * set_editable_size_and_transform(FlTextInputChannel *self, FlValue *args)
static constexpr char kSetClientMethod[]
static constexpr char kShowMethod[]
static FlMethodResponse * clear_client(FlTextInputChannel *self)
static FlMethodResponse * show(FlTextInputChannel *self)
static FlMethodResponse * hide(FlTextInputChannel *self)

References args, clear_client(), error, fl_method_call_get_args(), fl_method_call_get_name(), fl_method_call_respond(), fl_method_not_implemented_response_new(), g_autoptr(), hide(), kClearClientMethod, kHideMethod, kSetClientMethod, kSetEditableSizeAndTransform, kSetEditingStateMethod, kSetMarkedTextRect, kShowMethod, method_call, self, set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), show(), and user_data.

Referenced by fl_text_input_channel_new().

◆ set_client()

static FlMethodResponse * set_client ( FlTextInputChannel *  self,
FlValue args 
)
static

Definition at line 72 of file fl_text_input_channel.cc.

72 {
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 =
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 =
90 gboolean enable_delta_model = fl_value_get_bool(enable_delta_model_value);
91
92 // Reset the input type, then set only if appropriate.
94 FlValue* input_type_value =
96 if (fl_value_get_type(input_type_value) == FL_VALUE_TYPE_MAP) {
97 FlValue* input_type_name_value =
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}
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
static constexpr char kEnableDeltaModel[]
static constexpr char kNoneInputType[]
static constexpr char kMultilineInputType[]
static constexpr char kTextInputTypeNameKey[]
static constexpr char kTextInputTypeKey[]
static constexpr char kBadArgumentsError[]
static constexpr char kInputActionKey[]
@ FL_TEXT_INPUT_TYPE_MULTILINE
@ FL_TEXT_INPUT_TYPE_TEXT
@ FL_TEXT_INPUT_TYPE_NONE
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
Definition fl_value.cc:811
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition fl_value.cc:668
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition fl_value.cc:466
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition fl_value.cc:682
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition fl_value.cc:776
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition fl_value.cc:661
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition fl_value.cc:724
@ FL_VALUE_TYPE_STRING
Definition fl_value.h:68
@ FL_VALUE_TYPE_LIST
Definition fl_value.h:73
@ FL_VALUE_TYPE_MAP
Definition fl_value.h:74

References args, fl_method_error_response_new(), fl_method_success_response_new(), FL_TEXT_INPUT_TYPE_MULTILINE, FL_TEXT_INPUT_TYPE_NONE, FL_TEXT_INPUT_TYPE_TEXT, fl_value_get_bool(), fl_value_get_int(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_string(), fl_value_get_type(), fl_value_lookup_string(), FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_STRING, kBadArgumentsError, kEnableDeltaModel, kInputActionKey, kMultilineInputType, kNoneInputType, kTextInputTypeKey, kTextInputTypeNameKey, and self.

Referenced by method_call_cb().

◆ set_editable_size_and_transform()

static FlMethodResponse * set_editable_size_and_transform ( FlTextInputChannel *  self,
FlValue args 
)
static

Definition at line 160 of file fl_text_input_channel.cc.

162 {
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] =
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}
static constexpr char kTransform[]
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition fl_value.cc:675

References args, fl_method_error_response_new(), fl_method_success_response_new(), fl_value_get_float(), fl_value_get_length(), fl_value_get_list_value(), fl_value_lookup_string(), i, kBadArgumentsError, kTransform, self, and transform.

Referenced by method_call_cb().

◆ set_editing_state()

static FlMethodResponse * set_editing_state ( FlTextInputChannel *  self,
FlValue args 
)
static

Definition at line 128 of file fl_text_input_channel.cc.

129 {
130 const gchar* text =
132 int64_t selection_base =
134 int64_t selection_extent =
136 int64_t composing_base =
138 int64_t composing_extent =
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}

References args, fl_method_success_response_new(), fl_value_get_int(), fl_value_get_string(), fl_value_lookup_string(), kComposingBaseKey, kComposingExtentKey, kSelectionBaseKey, kSelectionExtentKey, kTextKey, self, and text.

Referenced by method_call_cb().

◆ set_marked_text_rect()

static FlMethodResponse * set_marked_text_rect ( FlTextInputChannel *  self,
FlValue args 
)
static

Definition at line 185 of file fl_text_input_channel.cc.

186 {
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}
int32_t x
double y
int32_t height
int32_t width

References args, fl_method_success_response_new(), fl_value_get_float(), fl_value_lookup_string(), height, self, width, x, and y.

Referenced by method_call_cb().

◆ show()

static FlMethodResponse * show ( FlTextInputChannel *  self)
static

Definition at line 122 of file fl_text_input_channel.cc.

122 {
123 self->vtable->show(self->user_data);
124 return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
125}

References fl_method_success_response_new(), and self.

Referenced by method_call_cb().

◆ text_affinity_to_string()

static const gchar * text_affinity_to_string ( FlTextAffinity  affinity)
static

Definition at line 60 of file fl_text_input_channel.cc.

60 {
61 switch (affinity) {
66 default:
67 g_assert_not_reached();
68 }
69}
static constexpr char kTextAffinityUpstream[]
static constexpr char kTextAffinityDownstream[]
@ FL_TEXT_AFFINITY_DOWNSTREAM
@ FL_TEXT_AFFINITY_UPSTREAM

References FL_TEXT_AFFINITY_DOWNSTREAM, FL_TEXT_AFFINITY_UPSTREAM, kTextAffinityDownstream, and kTextAffinityUpstream.

Referenced by fl_text_input_channel_update_editing_state(), and fl_text_input_channel_update_editing_state_with_deltas().

Variable Documentation

◆ kBadArgumentsError

constexpr char kBadArgumentsError[] = "Bad Arguments"
staticconstexpr

Definition at line 12 of file fl_text_input_channel.cc.

Referenced by set_client(), and set_editable_size_and_transform().

◆ kChannelName

constexpr char kChannelName[] = "flutter/textinput"
staticconstexpr

Definition at line 10 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_new().

◆ kClearClientMethod

constexpr char kClearClientMethod[] = "TextInput.clearClient"
staticconstexpr

Definition at line 17 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kComposingBaseKey

constexpr char kComposingBaseKey[] = "composingBase"
staticconstexpr

◆ kComposingExtentKey

constexpr char kComposingExtentKey[] = "composingExtent"
staticconstexpr

◆ kEnableDeltaModel

constexpr char kEnableDeltaModel[] = "enableDeltaModel"
staticconstexpr

Definition at line 30 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kHideMethod

constexpr char kHideMethod[] = "TextInput.hide"
staticconstexpr

Definition at line 18 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kInputActionKey

constexpr char kInputActionKey[] = "inputAction"
staticconstexpr

Definition at line 28 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kMultilineInputType

constexpr char kMultilineInputType[] = "TextInputType.multiline"
staticconstexpr

Definition at line 42 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kNoneInputType

constexpr char kNoneInputType[] = "TextInputType.none"
staticconstexpr

Definition at line 43 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kPerformActionMethod

constexpr char kPerformActionMethod[] = "TextInputClient.performAction"
staticconstexpr

Definition at line 23 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_perform_action().

◆ kSelectionAffinityKey

constexpr char kSelectionAffinityKey[] = "selectionAffinity"
staticconstexpr

Definition at line 35 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_update_editing_state().

◆ kSelectionBaseKey

constexpr char kSelectionBaseKey[] = "selectionBase"
staticconstexpr

◆ kSelectionExtentKey

constexpr char kSelectionExtentKey[] = "selectionExtent"
staticconstexpr

◆ kSelectionIsDirectionalKey

constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional"
staticconstexpr

Definition at line 36 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_update_editing_state().

◆ kSetClientMethod

constexpr char kSetClientMethod[] = "TextInput.setClient"
staticconstexpr

Definition at line 14 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kSetEditableSizeAndTransform

constexpr char kSetEditableSizeAndTransform[]
staticconstexpr
Initial value:
=
"TextInput.setEditableSizeAndTransform"

Definition at line 24 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kSetEditingStateMethod

constexpr char kSetEditingStateMethod[] = "TextInput.setEditingState"
staticconstexpr

Definition at line 16 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kSetMarkedTextRect

constexpr char kSetMarkedTextRect[] = "TextInput.setMarkedTextRect"
staticconstexpr

Definition at line 26 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kShowMethod

constexpr char kShowMethod[] = "TextInput.show"
staticconstexpr

Definition at line 15 of file fl_text_input_channel.cc.

Referenced by method_call_cb().

◆ kTextAffinityDownstream

constexpr char kTextAffinityDownstream[] = "TextAffinity.downstream"
staticconstexpr

Definition at line 46 of file fl_text_input_channel.cc.

Referenced by text_affinity_to_string().

◆ kTextAffinityUpstream

constexpr char kTextAffinityUpstream[] = "TextAffinity.upstream"
staticconstexpr

Definition at line 45 of file fl_text_input_channel.cc.

Referenced by text_affinity_to_string().

◆ kTextInputTypeKey

constexpr char kTextInputTypeKey[] = "inputType"
staticconstexpr

Definition at line 29 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kTextInputTypeNameKey

constexpr char kTextInputTypeNameKey[] = "name"
staticconstexpr

Definition at line 31 of file fl_text_input_channel.cc.

Referenced by set_client().

◆ kTextKey

constexpr char kTextKey[] = "text"
staticconstexpr

◆ kTransform

constexpr char kTransform[] = "transform"
staticconstexpr

Definition at line 40 of file fl_text_input_channel.cc.

Referenced by set_editable_size_and_transform().

◆ kUpdateEditingStateMethod

constexpr char kUpdateEditingStateMethod[]
staticconstexpr
Initial value:
=
"TextInputClient.updateEditingState"

Definition at line 19 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_update_editing_state().

◆ kUpdateEditingStateWithDeltasMethod

constexpr char kUpdateEditingStateWithDeltasMethod[]
staticconstexpr
Initial value:
=
"TextInputClient.updateEditingStateWithDeltas"

Definition at line 21 of file fl_text_input_channel.cc.

Referenced by fl_text_input_channel_update_editing_state_with_deltas().