| Flutter Linux Embedder |

Classes | Enumerations | Functions
fl_text_input_channel.h File Reference
`#include <gtk/gtk.h>`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"`

Go to the source code of this file.

## Classes
struct | FlTextInputChannelVTable

## Enumerations
enum | FlTextInputType { FL_TEXT_INPUT_TYPE_TEXT , FL_TEXT_INPUT_TYPE_MULTILINE , FL_TEXT_INPUT_TYPE_NONE }
enum | FlTextAffinity { FL_TEXT_AFFINITY_UPSTREAM , FL_TEXT_AFFINITY_DOWNSTREAM }

## Functions
| G_DECLARE_FINAL_TYPE (FlTextInputChannel, fl_text_input_channel, FL, TEXT_INPUT_CHANNEL, GObject)
FlTextInputChannel * | fl_text_input_channel_new (FlBinaryMessenger *messenger, FlTextInputChannelVTable *vtable, gpointer user_data)
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)
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 *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)
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 *channel, 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)

## Enumeration Type Documentation

## ◆ FlTextAffinity

enum FlTextAffinity

Enumerator
FL_TEXT_AFFINITY_UPSTREAM |
FL_TEXT_AFFINITY_DOWNSTREAM |

Definition at line 22 of file fl_text_input_channel.h.

22 {
23 FL_TEXT_AFFINITY_UPSTREAM,
24 FL_TEXT_AFFINITY_DOWNSTREAM,
25 } FlTextAffinity;
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

enum FlTextInputType

Enumerator
FL_TEXT_INPUT_TYPE_TEXT |
FL_TEXT_INPUT_TYPE_MULTILINE |
FL_TEXT_INPUT_TYPE_NONE |

Definition at line 14 of file fl_text_input_channel.h.

14 {
15 FL_TEXT_INPUT_TYPE_TEXT,
16 // Send newline when multi-line and enter is pressed.
17 FL_TEXT_INPUT_TYPE_MULTILINE,
18 // The input method is not shown at all.
19 FL_TEXT_INPUT_TYPE_NONE,
20 } FlTextInputType;
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

## Function Documentation

## ◆ 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 313 of file fl_text_input_channel.cc.

315 {
316 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
317 g_return_val_if_fail(vtable != nullptr, nullptr);
318
319 FlTextInputChannel* self = FL_TEXT_INPUT_CHANNEL(
320 g_object_new(fl_text_input_channel_get_type(), nullptr));
321
322 self->vtable = vtable;
323 self->user_data = user_data;
324
325 g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
326 self->channel =
327 fl_method_channel_new(messenger, kChannelName, FL_METHOD_CODEC(codec));
328 fl_method_channel_set_method_call_handler(self->channel, method_call_cb, self,
329 nullptr);
330
331 return self;
332 }
g_autoptr
g_autoptr(FlEngine) engine
user_data
const char FlTextDirection FlAssertiveness gpointer user_data
Definition: fl_accessibility_handler.cc:24
fl_json_method_codec_new
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
Definition: fl_json_method_codec.cc:205
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_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
method_call_cb
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_text_input_channel.cc:264
kChannelName
static constexpr char kChannelName[]
Definition: fl_text_input_channel.cc:10

References fl_json_method_codec_new(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), g_autoptr(), kChannelName, method_call_cb(), 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 452 of file fl_text_input_channel.cc.

457 {
458 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
459
460 g_autoptr(FlValue) args = fl_value_new_list();
461 fl_value_append_take(args, fl_value_new_int(client_id));
462 fl_value_append_take(args, fl_value_new_string(input_action));
463
464 fl_method_channel_invoke_method(self->channel, kPerformActionMethod, args,
465 cancellable, callback, user_data);
466 }
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
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
kPerformActionMethod
static constexpr char kPerformActionMethod[]
Definition: fl_text_input_channel.cc:24
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
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_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

References args, fl_method_channel_invoke_method(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), g_autoptr(), kPerformActionMethod, 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. If `error` is not NULL, `*error` must be initialized (typically NULL, but an error from a previous call using GLib error handling is explicitly valid).

Completes request started with fl_text_input_channel_perform_action().

Returns: TRUE on success.

Definition at line 468 of file fl_text_input_channel.cc.

470 {
471 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
472 FL_METHOD_CHANNEL(object), result, error);
473 if (response == nullptr) {
474 return FALSE;
475 }
476 return fl_method_response_get_result(response, error) != nullptr;
477 }
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_response_get_result
G_MODULE_EXPORT FlValue * fl_method_response_get_result(FlMethodResponse *self, GError **error)
Definition: fl_method_response.cc:82
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40

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 334 of file fl_text_input_channel.cc.

346 {
347 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
348
349 g_autoptr(FlValue) args = fl_value_new_list();
350 fl_value_append_take(args, fl_value_new_int(client_id));
351 g_autoptr(FlValue) value = fl_value_new_map();
352
353 fl_value_set_string_take(value, kTextKey, fl_value_new_string(text));
354 fl_value_set_string_take(value, kSelectionBaseKey,
355 fl_value_new_int(selection_base));
356 fl_value_set_string_take(value, kSelectionExtentKey,
357 fl_value_new_int(selection_extent));
358 fl_value_set_string_take(
359 value, kSelectionAffinityKey,
360 fl_value_new_string(text_affinity_to_string(selection_affinity)));
361 fl_value_set_string_take(value, kSelectionIsDirectionalKey,
362 fl_value_new_bool(selection_is_directional));
363 fl_value_set_string_take(value, kComposingBaseKey,
364 fl_value_new_int(composing_base));
365 fl_value_set_string_take(value, kComposingExtentKey,
366 fl_value_new_int(composing_extent));
367
368 fl_value_append(args, value);
369
370 fl_method_channel_invoke_method(self->channel, kUpdateEditingStateMethod,
371 args, cancellable, callback, user_data);
372 }
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
kSelectionIsDirectionalKey
static constexpr char kSelectionIsDirectionalKey[]
Definition: fl_text_input_channel.cc:37
kSelectionExtentKey
static constexpr char kSelectionExtentKey[]
Definition: fl_text_input_channel.cc:35
text_affinity_to_string
static const gchar * text_affinity_to_string(FlTextAffinity affinity)
Definition: fl_text_input_channel.cc:75
kUpdateEditingStateMethod
static constexpr char kUpdateEditingStateMethod[]
Definition: fl_text_input_channel.cc:20
kComposingExtentKey
static constexpr char kComposingExtentKey[]
Definition: fl_text_input_channel.cc:39
kComposingBaseKey
static constexpr char kComposingBaseKey[]
Definition: fl_text_input_channel.cc:38
kSelectionAffinityKey
static constexpr char kSelectionAffinityKey[]
Definition: fl_text_input_channel.cc:36
kTextKey
static constexpr char kTextKey[]
Definition: fl_text_input_channel.cc:33
kSelectionBaseKey
static constexpr char kSelectionBaseKey[]
Definition: fl_text_input_channel.cc:34
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_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_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366

References args, 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, 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. If `error` is not NULL, `*error` must be initialized (typically NULL, but an error from a previous call using GLib error handling is explicitly valid).

Completes request started with fl_text_input_channel_update_editing_state().

Returns: TRUE on success.

Definition at line 374 of file fl_text_input_channel.cc.

376 {
377 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
378 FL_METHOD_CHANNEL(object), result, error);
379 if (response == nullptr) {
380 return FALSE;
381 }
382 return fl_method_response_get_result(response, error) != nullptr;
383 }

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 385 of file fl_text_input_channel.cc.

400 {
401 g_return_if_fail(FL_IS_TEXT_INPUT_CHANNEL(self));
402
403 g_autoptr(FlValue) args = fl_value_new_list();
404 fl_value_append_take(args, fl_value_new_int(client_id));
405
406 g_autoptr(FlValue) deltaValue = fl_value_new_map();
407 fl_value_set_string_take(deltaValue, "oldText",
408 fl_value_new_string(old_text));
409 fl_value_set_string_take(deltaValue, "deltaText",
410 fl_value_new_string(delta_text));
411 fl_value_set_string_take(deltaValue, "deltaStart",
412 fl_value_new_int(delta_start));
413 fl_value_set_string_take(deltaValue, "deltaEnd", fl_value_new_int(delta_end));
414 fl_value_set_string_take(deltaValue, "selectionBase",
415 fl_value_new_int(selection_base));
416 fl_value_set_string_take(deltaValue, "selectionExtent",
417 fl_value_new_int(selection_extent));
418 fl_value_set_string_take(
419 deltaValue, "selectionAffinity",
420 fl_value_new_string(text_affinity_to_string(selection_affinity)));
421 fl_value_set_string_take(deltaValue, "selectionIsDirectional",
422 fl_value_new_bool(selection_is_directional));
423 fl_value_set_string_take(deltaValue, "composingBase",
424 fl_value_new_int(composing_base));
425 fl_value_set_string_take(deltaValue, "composingExtent",
426 fl_value_new_int(composing_extent));
427
428 g_autoptr(FlValue) deltas = fl_value_new_list();
429 fl_value_append(deltas, deltaValue);
430 g_autoptr(FlValue) value = fl_value_new_map();
431 fl_value_set_string(value, "deltas", deltas);
432
433 fl_value_append(args, value);
434
435 fl_method_channel_invoke_method(self->channel,
436 kUpdateEditingStateWithDeltasMethod, args,
437 cancellable, callback, user_data);
438 }
kUpdateEditingStateWithDeltasMethod
static constexpr char kUpdateEditingStateWithDeltasMethod[]
Definition: fl_text_input_channel.cc:22
fl_value_set_string
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:639

References args, 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, 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. If `error` is not NULL, `*error` must be initialized (typically NULL, but an error from a previous call using GLib error handling is explicitly valid).

Completes request started with fl_text_input_channel_update_editing_state_with_deltas().

Returns: TRUE on success.

Definition at line 440 of file fl_text_input_channel.cc.

443 {
444 g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
445 FL_METHOD_CHANNEL(object), result, error);
446 if (response == nullptr) {
447 return FALSE;
448 }
449 return fl_method_response_get_result(response, error) != nullptr;
450 }

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().

## ◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE | ( | FlTextInputChannel | ,
|  | fl_text_input_channel | ,
|  | FL | ,
|  | TEXT_INPUT_CHANNEL | ,
|  | GObject |
| ) |  |