Flutter Linux Embedder
fl_text_input_handler.cc File Reference

Go to the source code of this file.

Classes

struct  FlTextInputHandlerPrivate
 

Enumerations

enum  FlTextInputType {
  kFlTextInputTypeText,
  kFlTextInputTypeMultiline,
  kFlTextInputTypeNone
}
 

Functions

 G_DEFINE_TYPE_WITH_PRIVATE (FlTextInputHandler, fl_text_input_handler, G_TYPE_OBJECT) static gboolean finish_method(GObject *object
 
 if (response==nullptr)
 
return fl_method_response_get_result (response, error) !
 
static void update_editing_state_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
static void update_editing_state (FlTextInputHandler *self)
 
static void update_editing_state_with_delta (FlTextInputHandler *self, flutter::TextEditingDelta *delta)
 
static void perform_action_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
static void perform_action (FlTextInputHandler *self)
 
static void im_preedit_start_cb (FlTextInputHandler *self)
 
static void im_preedit_changed_cb (FlTextInputHandler *self)
 
static void im_commit_cb (FlTextInputHandler *self, const gchar *text)
 
static void im_preedit_end_cb (FlTextInputHandler *self)
 
static gboolean im_retrieve_surrounding_cb (FlTextInputHandler *self)
 
static gboolean im_delete_surrounding_cb (FlTextInputHandler *self, gint offset, gint n_chars)
 
static FlMethodResponse * set_client (FlTextInputHandler *self, FlValue *args)
 
static FlMethodResponse * hide (FlTextInputHandler *self)
 
static FlMethodResponse * show (FlTextInputHandler *self)
 
static FlMethodResponse * set_editing_state (FlTextInputHandler *self, FlValue *args)
 
static FlMethodResponse * clear_client (FlTextInputHandler *self)
 
static void update_im_cursor_position (FlTextInputHandler *self)
 
static FlMethodResponse * set_editable_size_and_transform (FlTextInputHandler *self, FlValue *args)
 
static FlMethodResponse * set_marked_text_rect (FlTextInputHandler *self, FlValue *args)
 
static void method_call_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
static void fl_text_input_handler_dispose (GObject *object)
 
static gboolean fl_text_input_handler_filter_keypress_default (FlTextInputHandler *self, FlKeyEvent *event)
 
static void fl_text_input_handler_class_init (FlTextInputHandlerClass *klass)
 
static void fl_text_input_handler_init (FlTextInputHandler *self)
 
static void init_im_context (FlTextInputHandler *self, GtkIMContext *im_context)
 
FlTextInputHandler * fl_text_input_handler_new (FlBinaryMessenger *messenger, GtkIMContext *im_context, FlTextInputViewDelegate *view_delegate)
 
gboolean fl_text_input_handler_filter_keypress (FlTextInputHandler *self, FlKeyEvent *event)
 

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 kTextAffinityDownstream [] = "TextAffinity.downstream"
 
static constexpr char kMultilineInputType [] = "TextInputType.multiline"
 
static constexpr char kNoneInputType [] = "TextInputType.none"
 
static constexpr char kNewlineInputAction [] = "TextInputAction.newline"
 
static constexpr int64_t kClientIdUnset = -1
 
GAsyncResult * result
 
GAsyncResult GError ** error
 

Enumeration Type Documentation

◆ FlTextInputType

Enumerator
kFlTextInputTypeText 
kFlTextInputTypeMultiline 
kFlTextInputTypeNone 

Definition at line 54 of file fl_text_input_handler.cc.

54  {
56  // Send newline when multi-line and enter is pressed.
58  // The input method is not shown at all.

Function Documentation

◆ clear_client()

static FlMethodResponse* clear_client ( FlTextInputHandler *  self)
static

Definition at line 468 of file fl_text_input_handler.cc.

468  {
470  fl_text_input_handler_get_instance_private(self));
471  priv->client_id = kClientIdUnset;
472 
473  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
474 }

References fl_method_success_response_new(), kClientIdUnset, and priv.

Referenced by method_call_cb().

◆ fl_method_response_get_result()

return fl_method_response_get_result ( response  ,
error   
)

◆ fl_text_input_handler_class_init()

static void fl_text_input_handler_class_init ( FlTextInputHandlerClass *  klass)
static

Definition at line 701 of file fl_text_input_handler.cc.

701  {
702  G_OBJECT_CLASS(klass)->dispose = fl_text_input_handler_dispose;
703  FL_TEXT_INPUT_HANDLER_CLASS(klass)->filter_keypress =
705 }

References fl_text_input_handler_dispose(), and fl_text_input_handler_filter_keypress_default().

◆ fl_text_input_handler_dispose()

static void fl_text_input_handler_dispose ( GObject *  object)
static

Definition at line 594 of file fl_text_input_handler.cc.

594  {
595  FlTextInputHandler* self = FL_TEXT_INPUT_HANDLER(object);
597  fl_text_input_handler_get_instance_private(self));
598 
599  g_clear_object(&priv->channel);
600  g_clear_pointer(&priv->input_action, g_free);
601  g_clear_object(&priv->im_context);
602  if (priv->text_model != nullptr) {
603  delete priv->text_model;
604  priv->text_model = nullptr;
605  }
606  if (priv->view_delegate != nullptr) {
607  g_object_remove_weak_pointer(
608  G_OBJECT(priv->view_delegate),
609  reinterpret_cast<gpointer*>(&(priv->view_delegate)));
610  priv->view_delegate = nullptr;
611  }
612 
613  G_OBJECT_CLASS(fl_text_input_handler_parent_class)->dispose(object);
614 }

References priv.

Referenced by fl_text_input_handler_class_init().

◆ fl_text_input_handler_filter_keypress()

gboolean fl_text_input_handler_filter_keypress ( FlTextInputHandler *  handler,
FlKeyEvent *  event 
)

fl_text_input_handler_filter_keypress @handler: an #FlTextInputHandler. @event: a #FlKeyEvent

Process a Gdk key event.

Returns: TRUE if the event was used.

Definition at line 778 of file fl_text_input_handler.cc.

779  {
780  g_return_val_if_fail(FL_IS_TEXT_INPUT_HANDLER(self), FALSE);
781  if (FL_TEXT_INPUT_HANDLER_GET_CLASS(self)->filter_keypress) {
782  return FL_TEXT_INPUT_HANDLER_GET_CLASS(self)->filter_keypress(self, event);
783  }
784  return FALSE;
785 }

References event.

Referenced by fl_view_keyboard_delegate_iface_init(), and send_key_event().

◆ fl_text_input_handler_filter_keypress_default()

static gboolean fl_text_input_handler_filter_keypress_default ( FlTextInputHandler *  self,
FlKeyEvent *  event 
)
static

Definition at line 617 of file fl_text_input_handler.cc.

619  {
620  g_return_val_if_fail(FL_IS_TEXT_INPUT_HANDLER(self), false);
621 
623  fl_text_input_handler_get_instance_private(self));
624 
625  if (priv->client_id == kClientIdUnset) {
626  return FALSE;
627  }
628 
629  if (gtk_im_context_filter_keypress(
630  priv->im_context,
631  reinterpret_cast<GdkEventKey*>(fl_key_event_get_origin(event)))) {
632  return TRUE;
633  }
634 
635  std::string text_before_change = priv->text_model->GetText();
636  flutter::TextRange selection_before_change = priv->text_model->selection();
637  std::string text = priv->text_model->GetText();
638 
639  // Handle the enter/return key.
640  gboolean do_action = FALSE;
641  // Handle navigation keys.
642  gboolean changed = FALSE;
644  switch (fl_key_event_get_keyval(event)) {
645  case GDK_KEY_End:
646  case GDK_KEY_KP_End:
647  if (fl_key_event_get_state(event) & GDK_SHIFT_MASK) {
648  changed = priv->text_model->SelectToEnd();
649  } else {
650  changed = priv->text_model->MoveCursorToEnd();
651  }
652  break;
653  case GDK_KEY_Return:
654  case GDK_KEY_KP_Enter:
655  case GDK_KEY_ISO_Enter:
656  if (priv->input_type == kFlTextInputTypeMultiline &&
657  strcmp(priv->input_action, kNewlineInputAction) == 0) {
658  priv->text_model->AddCodePoint('\n');
659  text = "\n";
660  changed = TRUE;
661  }
662  do_action = TRUE;
663  break;
664  case GDK_KEY_Home:
665  case GDK_KEY_KP_Home:
666  if (fl_key_event_get_state(event) & GDK_SHIFT_MASK) {
667  changed = priv->text_model->SelectToBeginning();
668  } else {
669  changed = priv->text_model->MoveCursorToBeginning();
670  }
671  break;
672  case GDK_KEY_BackSpace:
673  case GDK_KEY_Delete:
674  case GDK_KEY_KP_Delete:
675  case GDK_KEY_Left:
676  case GDK_KEY_KP_Left:
677  case GDK_KEY_Right:
678  case GDK_KEY_KP_Right:
679  // Already handled inside the framework in RenderEditable.
680  break;
681  }
682  }
683 
684  if (changed) {
685  if (priv->enable_delta_model) {
687  text_before_change, selection_before_change, text);
688  update_editing_state_with_delta(self, &delta);
689  } else {
690  update_editing_state(self);
691  }
692  }
693  if (do_action) {
694  perform_action(self);
695  }
696 
697  return changed;
698 }

References event, fl_key_event_get_is_press(), fl_key_event_get_keyval(), fl_key_event_get_origin(), fl_key_event_get_state(), kClientIdUnset, kFlTextInputTypeMultiline, kNewlineInputAction, perform_action(), priv, TRUE, update_editing_state(), and update_editing_state_with_delta().

Referenced by fl_text_input_handler_class_init().

◆ fl_text_input_handler_init()

static void fl_text_input_handler_init ( FlTextInputHandler *  self)
static

Definition at line 708 of file fl_text_input_handler.cc.

708  {
710  fl_text_input_handler_get_instance_private(self));
711 
712  priv->client_id = kClientIdUnset;
713  priv->input_type = kFlTextInputTypeText;
714  priv->text_model = new flutter::TextInputModel();
715 }

References kClientIdUnset, kFlTextInputTypeText, and priv.

◆ fl_text_input_handler_new()

FlTextInputHandler* fl_text_input_handler_new ( FlBinaryMessenger *  messenger,
GtkIMContext *  im_context,
FlTextInputViewDelegate *  view_delegate 
)

fl_text_input_handler_new: @messenger: an #FlBinaryMessenger. @im_context: (allow-none): a #GtkIMContext. @view_delegate: an #FlTextInputViewDelegate.

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

Returns: a new #FlTextInputHandler.

Definition at line 747 of file fl_text_input_handler.cc.

750  {
751  g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
752  g_return_val_if_fail(GTK_IS_IM_CONTEXT(im_context), nullptr);
753  g_return_val_if_fail(FL_IS_TEXT_INPUT_VIEW_DELEGATE(view_delegate), nullptr);
754 
755  FlTextInputHandler* self = FL_TEXT_INPUT_HANDLER(
756  g_object_new(fl_text_input_handler_get_type(), nullptr));
757 
758  g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
760  fl_text_input_handler_get_instance_private(self));
761  priv->channel =
762  fl_method_channel_new(messenger, kChannelName, FL_METHOD_CODEC(codec));
764  nullptr);
765 
766  init_im_context(self, im_context);
767 
768  priv->view_delegate = view_delegate;
769  g_object_add_weak_pointer(
770  G_OBJECT(view_delegate),
771  reinterpret_cast<gpointer*>(&(priv->view_delegate)));
772 
773  return self;
774 }

References fl_json_method_codec_new(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), init_im_context(), kChannelName, method_call_cb(), and priv.

Referenced by init_keyboard(), and TEST().

◆ G_DEFINE_TYPE_WITH_PRIVATE()

G_DEFINE_TYPE_WITH_PRIVATE ( FlTextInputHandler  ,
fl_text_input_handler  ,
G_TYPE_OBJECT   
)

◆ hide()

static FlMethodResponse* hide ( FlTextInputHandler *  self)
static

Definition at line 408 of file fl_text_input_handler.cc.

408  {
410  fl_text_input_handler_get_instance_private(self));
411  gtk_im_context_focus_out(priv->im_context);
412 
413  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
414 }

References fl_method_success_response_new(), and priv.

Referenced by method_call_cb(), and show().

◆ if()

if ( response  = = nullptr)

Definition at line 110 of file fl_text_input_handler.cc.

110  {
111  return FALSE;
112  }

◆ im_commit_cb()

static void im_commit_cb ( FlTextInputHandler *  self,
const gchar *  text 
)
static

Definition at line 291 of file fl_text_input_handler.cc.

291  {
293  fl_text_input_handler_get_instance_private(self));
294  std::string text_before_change = priv->text_model->GetText();
295  flutter::TextRange composing_before_change =
296  priv->text_model->composing_range();
297  flutter::TextRange selection_before_change = priv->text_model->selection();
298  gboolean was_composing = priv->text_model->composing();
299 
300  priv->text_model->AddText(text);
301  if (priv->text_model->composing()) {
302  priv->text_model->CommitComposing();
303  }
304 
305  if (priv->enable_delta_model) {
306  flutter::TextRange replace_range =
307  was_composing ? composing_before_change : selection_before_change;
308  std::unique_ptr<flutter::TextEditingDelta> delta =
309  std::make_unique<flutter::TextEditingDelta>(text_before_change,
310  replace_range, text);
311  update_editing_state_with_delta(self, delta.get());
312  } else {
313  update_editing_state(self);
314  }
315 }

References priv, update_editing_state(), and update_editing_state_with_delta().

Referenced by init_im_context().

◆ im_delete_surrounding_cb()

static gboolean im_delete_surrounding_cb ( FlTextInputHandler *  self,
gint  offset,
gint  n_chars 
)
static

Definition at line 343 of file fl_text_input_handler.cc.

345  {
347  fl_text_input_handler_get_instance_private(self));
348 
349  std::string text_before_change = priv->text_model->GetText();
350  if (priv->text_model->DeleteSurrounding(offset, n_chars)) {
351  if (priv->enable_delta_model) {
353  text_before_change, priv->text_model->composing_range(),
354  priv->text_model->GetText());
355  update_editing_state_with_delta(self, &delta);
356  } else {
357  update_editing_state(self);
358  }
359  }
360  return TRUE;
361 }

References priv, TRUE, update_editing_state(), and update_editing_state_with_delta().

Referenced by init_im_context().

◆ im_preedit_changed_cb()

static void im_preedit_changed_cb ( FlTextInputHandler *  self)
static

Definition at line 262 of file fl_text_input_handler.cc.

262  {
264  fl_text_input_handler_get_instance_private(self));
265  std::string text_before_change = priv->text_model->GetText();
266  flutter::TextRange composing_before_change =
267  priv->text_model->composing_range();
268  g_autofree gchar* buf = nullptr;
269  gint cursor_offset = 0;
270  gtk_im_context_get_preedit_string(priv->im_context, &buf, nullptr,
271  &cursor_offset);
272  if (priv->text_model->composing()) {
273  cursor_offset += priv->text_model->composing_range().start();
274  } else {
275  cursor_offset += priv->text_model->selection().start();
276  }
277  priv->text_model->UpdateComposingText(buf);
278  priv->text_model->SetSelection(flutter::TextRange(cursor_offset));
279 
280  if (priv->enable_delta_model) {
281  std::string text(buf);
283  text_before_change, composing_before_change, text);
284  update_editing_state_with_delta(self, &delta);
285  } else {
286  update_editing_state(self);
287  }
288 }

References priv, update_editing_state(), and update_editing_state_with_delta().

Referenced by init_im_context().

◆ im_preedit_end_cb()

static void im_preedit_end_cb ( FlTextInputHandler *  self)
static

Definition at line 318 of file fl_text_input_handler.cc.

318  {
320  fl_text_input_handler_get_instance_private(self));
321  priv->text_model->EndComposing();
322  if (priv->enable_delta_model) {
324  flutter::TextEditingDelta(priv->text_model->GetText());
325  update_editing_state_with_delta(self, &delta);
326  } else {
327  update_editing_state(self);
328  }
329 }

References priv, update_editing_state(), and update_editing_state_with_delta().

Referenced by init_im_context().

◆ im_preedit_start_cb()

static void im_preedit_start_cb ( FlTextInputHandler *  self)
static

Definition at line 255 of file fl_text_input_handler.cc.

255  {
257  fl_text_input_handler_get_instance_private(self));
258  priv->text_model->BeginComposing();
259 }

References priv.

Referenced by init_im_context().

◆ im_retrieve_surrounding_cb()

static gboolean im_retrieve_surrounding_cb ( FlTextInputHandler *  self)
static

Definition at line 332 of file fl_text_input_handler.cc.

332  {
334  fl_text_input_handler_get_instance_private(self));
335  auto text = priv->text_model->GetText();
336  size_t cursor_offset = priv->text_model->GetCursorOffset();
337  gtk_im_context_set_surrounding(priv->im_context, text.c_str(), -1,
338  cursor_offset);
339  return TRUE;
340 }

References priv, and TRUE.

Referenced by init_im_context().

◆ init_im_context()

static void init_im_context ( FlTextInputHandler *  self,
GtkIMContext *  im_context 
)
static

Definition at line 717 of file fl_text_input_handler.cc.

718  {
720  fl_text_input_handler_get_instance_private(self));
721  priv->im_context = GTK_IM_CONTEXT(g_object_ref(im_context));
722 
723  // On Wayland, this call sets up the input method so it can be enabled
724  // immediately when required. Without it, on-screen keyboard's don't come up
725  // the first time a text field is focused.
726  gtk_im_context_focus_out(priv->im_context);
727 
728  g_signal_connect_object(priv->im_context, "preedit-start",
729  G_CALLBACK(im_preedit_start_cb), self,
730  G_CONNECT_SWAPPED);
731  g_signal_connect_object(priv->im_context, "preedit-end",
732  G_CALLBACK(im_preedit_end_cb), self,
733  G_CONNECT_SWAPPED);
734  g_signal_connect_object(priv->im_context, "preedit-changed",
735  G_CALLBACK(im_preedit_changed_cb), self,
736  G_CONNECT_SWAPPED);
737  g_signal_connect_object(priv->im_context, "commit", G_CALLBACK(im_commit_cb),
738  self, G_CONNECT_SWAPPED);
739  g_signal_connect_object(priv->im_context, "retrieve-surrounding",
740  G_CALLBACK(im_retrieve_surrounding_cb), self,
741  G_CONNECT_SWAPPED);
742  g_signal_connect_object(priv->im_context, "delete-surrounding",
743  G_CALLBACK(im_delete_surrounding_cb), self,
744  G_CONNECT_SWAPPED);
745 }

References im_commit_cb(), im_delete_surrounding_cb(), im_preedit_changed_cb(), im_preedit_end_cb(), im_preedit_start_cb(), im_retrieve_surrounding_cb(), and priv.

Referenced by fl_text_input_handler_new().

◆ method_call_cb()

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

Definition at line 560 of file fl_text_input_handler.cc.

562  {
563  FlTextInputHandler* self = FL_TEXT_INPUT_HANDLER(user_data);
564 
565  const gchar* method = fl_method_call_get_name(method_call);
567 
568  g_autoptr(FlMethodResponse) response = nullptr;
569  if (strcmp(method, kSetClientMethod) == 0) {
570  response = set_client(self, args);
571  } else if (strcmp(method, kShowMethod) == 0) {
572  response = show(self);
573  } else if (strcmp(method, kSetEditingStateMethod) == 0) {
574  response = set_editing_state(self, args);
575  } else if (strcmp(method, kClearClientMethod) == 0) {
576  response = clear_client(self);
577  } else if (strcmp(method, kHideMethod) == 0) {
578  response = hide(self);
579  } else if (strcmp(method, kSetEditableSizeAndTransform) == 0) {
580  response = set_editable_size_and_transform(self, args);
581  } else if (strcmp(method, kSetMarkedTextRect) == 0) {
582  response = set_marked_text_rect(self, args);
583  } else {
584  response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
585  }
586 
587  g_autoptr(GError) error = nullptr;
588  if (!fl_method_call_respond(method_call, response, &error)) {
589  g_warning("Failed to send method call response: %s", error->message);
590  }
591 }

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(), hide(), kClearClientMethod, kHideMethod, kSetClientMethod, kSetEditableSizeAndTransform, kSetEditingStateMethod, kSetMarkedTextRect, kShowMethod, method_call, set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), show(), and user_data.

Referenced by fl_text_input_handler_new().

◆ perform_action()

static void perform_action ( FlTextInputHandler *  self)
static

Definition at line 238 of file fl_text_input_handler.cc.

238  {
240  fl_text_input_handler_get_instance_private(self));
241 
242  g_return_if_fail(FL_IS_TEXT_INPUT_HANDLER(self));
243  g_return_if_fail(priv->client_id != 0);
244  g_return_if_fail(priv->input_action != nullptr);
245 
246  g_autoptr(FlValue) args = fl_value_new_list();
249 
251  nullptr, perform_action_response_cb, self);
252 }

References args, fl_method_channel_invoke_method(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), kPerformActionMethod, perform_action_response_cb(), and priv.

Referenced by fl_text_input_handler_filter_keypress_default().

◆ perform_action_response_cb()

static void perform_action_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 228 of file fl_text_input_handler.cc.

230  {
231  g_autoptr(GError) error = nullptr;
232  if (!finish_method(object, result, &error)) {
233  g_warning("Failed to call %s: %s", kPerformActionMethod, error->message);
234  }
235 }

References error, finish_method(), kPerformActionMethod, and result.

Referenced by perform_action().

◆ set_client()

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

Definition at line 364 of file fl_text_input_handler.cc.

364  {
366  fl_value_get_length(args) < 2) {
367  return FL_METHOD_RESPONSE(fl_method_error_response_new(
368  kBadArgumentsError, "Expected 2-element list", nullptr));
369  }
371  fl_text_input_handler_get_instance_private(self));
372 
374  FlValue* config_value = fl_value_get_list_value(args, 1);
375  g_free(priv->input_action);
376  FlValue* input_action_value =
378  if (fl_value_get_type(input_action_value) == FL_VALUE_TYPE_STRING) {
379  priv->input_action = g_strdup(fl_value_get_string(input_action_value));
380  }
381 
382  FlValue* enable_delta_model_value =
384  gboolean enable_delta_model = fl_value_get_bool(enable_delta_model_value);
385  priv->enable_delta_model = enable_delta_model;
386 
387  // Reset the input type, then set only if appropriate.
388  priv->input_type = kFlTextInputTypeText;
389  FlValue* input_type_value =
391  if (fl_value_get_type(input_type_value) == FL_VALUE_TYPE_MAP) {
392  FlValue* input_type_name =
394  if (fl_value_get_type(input_type_name) == FL_VALUE_TYPE_STRING) {
395  const gchar* input_type = fl_value_get_string(input_type_name);
396  if (g_strcmp0(input_type, kMultilineInputType) == 0) {
397  priv->input_type = kFlTextInputTypeMultiline;
398  } else if (g_strcmp0(input_type, kNoneInputType) == 0) {
399  priv->input_type = kFlTextInputTypeNone;
400  }
401  }
402  }
403 
404  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
405 }

References args, fl_method_error_response_new(), fl_method_success_response_new(), 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, kFlTextInputTypeMultiline, kFlTextInputTypeNone, kFlTextInputTypeText, kInputActionKey, kMultilineInputType, kNoneInputType, kTextInputTypeKey, kTextInputTypeNameKey, and priv.

Referenced by method_call_cb(), and TEST().

◆ set_editable_size_and_transform()

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

Definition at line 518 of file fl_text_input_handler.cc.

520  {
522  size_t transform_len = fl_value_get_length(transform);
523  g_warn_if_fail(transform_len == 16);
524 
525  for (size_t i = 0; i < transform_len; ++i) {
526  double val = fl_value_get_float(fl_value_get_list_value(transform, i));
528  fl_text_input_handler_get_instance_private(self));
529  priv->editabletext_transform[i / 4][i % 4] = val;
530  }
532 
533  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
534 }

References args, fl_method_success_response_new(), fl_value_get_float(), fl_value_get_length(), fl_value_get_list_value(), fl_value_lookup_string(), i, kTransform, priv, and update_im_cursor_position().

Referenced by method_call_cb(), and TEST().

◆ set_editing_state()

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

Definition at line 430 of file fl_text_input_handler.cc.

431  {
433  fl_text_input_handler_get_instance_private(self));
434  const gchar* text =
436  priv->text_model->SetText(text);
437 
438  int64_t selection_base =
440  int64_t selection_extent =
442  // Flutter uses -1/-1 for invalid; translate that to 0/0 for the model.
443  if (selection_base == -1 && selection_extent == -1) {
444  selection_base = selection_extent = 0;
445  }
446 
447  priv->text_model->SetText(text);
448  priv->text_model->SetSelection(
449  flutter::TextRange(selection_base, selection_extent));
450 
451  int64_t composing_base =
453  int64_t composing_extent =
455  if (composing_base == -1 && composing_extent == -1) {
456  priv->text_model->EndComposing();
457  } else {
458  size_t composing_start = std::min(composing_base, composing_extent);
459  size_t cursor_offset = selection_base - composing_start;
460  priv->text_model->SetComposingRange(
461  flutter::TextRange(composing_base, composing_extent), cursor_offset);
462  }
463 
464  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
465 }

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

Referenced by method_call_cb().

◆ set_marked_text_rect()

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

Definition at line 542 of file fl_text_input_handler.cc.

543  {
545  fl_text_input_handler_get_instance_private(self));
546  priv->composing_rect.x =
548  priv->composing_rect.y =
550  priv->composing_rect.width =
552  priv->composing_rect.height =
555 
556  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
557 }

References args, fl_method_success_response_new(), fl_value_get_float(), fl_value_lookup_string(), priv, and update_im_cursor_position().

Referenced by method_call_cb(), and TEST().

◆ show()

static FlMethodResponse* show ( FlTextInputHandler *  self)
static

Definition at line 417 of file fl_text_input_handler.cc.

417  {
419  fl_text_input_handler_get_instance_private(self));
420  if (priv->input_type == kFlTextInputTypeNone) {
421  return hide(self);
422  }
423 
424  gtk_im_context_focus_in(priv->im_context);
425 
426  return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
427 }

References fl_method_success_response_new(), hide(), kFlTextInputTypeNone, and priv.

Referenced by method_call_cb(), and TEST().

◆ update_editing_state()

static void update_editing_state ( FlTextInputHandler *  self)
static

Definition at line 128 of file fl_text_input_handler.cc.

128  {
130  fl_text_input_handler_get_instance_private(self));
131 
132  g_autoptr(FlValue) args = fl_value_new_list();
134  g_autoptr(FlValue) value = fl_value_new_map();
135 
136  flutter::TextRange selection = priv->text_model->selection();
138  value, kTextKey,
139  fl_value_new_string(priv->text_model->GetText().c_str()));
141  fl_value_new_int(selection.base()));
143  fl_value_new_int(selection.extent()));
144 
145  int composing_base = -1;
146  int composing_extent = -1;
147  if (!priv->text_model->composing_range().collapsed()) {
148  composing_base = priv->text_model->composing_range().base();
149  composing_extent = priv->text_model->composing_range().extent();
150  }
152  fl_value_new_int(composing_base));
154  fl_value_new_int(composing_extent));
155 
156  // The following keys are not implemented and set to default values.
160  fl_value_new_bool(FALSE));
161 
163 
165  args, nullptr,
167 }

References args, flutter::TextRange::base(), flutter::TextRange::extent(), 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(), kComposingBaseKey, kComposingExtentKey, kSelectionAffinityKey, kSelectionBaseKey, kSelectionExtentKey, kSelectionIsDirectionalKey, kTextAffinityDownstream, kTextKey, kUpdateEditingStateMethod, priv, update_editing_state_response_cb(), and value.

Referenced by fl_text_input_handler_filter_keypress_default(), im_commit_cb(), im_delete_surrounding_cb(), im_preedit_changed_cb(), and im_preedit_end_cb().

◆ update_editing_state_response_cb()

static void update_editing_state_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 117 of file fl_text_input_handler.cc.

119  {
120  g_autoptr(GError) error = nullptr;
121  if (!finish_method(object, result, &error)) {
122  g_warning("Failed to call %s: %s", kUpdateEditingStateMethod,
123  error->message);
124  }
125 }

References error, finish_method(), kUpdateEditingStateMethod, and result.

Referenced by update_editing_state(), and update_editing_state_with_delta().

◆ update_editing_state_with_delta()

static void update_editing_state_with_delta ( FlTextInputHandler *  self,
flutter::TextEditingDelta delta 
)
static

Definition at line 170 of file fl_text_input_handler.cc.

171  {
173  fl_text_input_handler_get_instance_private(self));
174 
175  g_autoptr(FlValue) args = fl_value_new_list();
177 
178  g_autoptr(FlValue) deltaValue = fl_value_new_map();
179  fl_value_set_string_take(deltaValue, "oldText",
180  fl_value_new_string(delta->old_text().c_str()));
181 
182  fl_value_set_string_take(deltaValue, "deltaText",
183  fl_value_new_string(delta->delta_text().c_str()));
184 
185  fl_value_set_string_take(deltaValue, "deltaStart",
186  fl_value_new_int(delta->delta_start()));
187 
188  fl_value_set_string_take(deltaValue, "deltaEnd",
189  fl_value_new_int(delta->delta_end()));
190 
191  flutter::TextRange selection = priv->text_model->selection();
192  fl_value_set_string_take(deltaValue, "selectionBase",
193  fl_value_new_int(selection.base()));
194 
195  fl_value_set_string_take(deltaValue, "selectionExtent",
196  fl_value_new_int(selection.extent()));
197 
198  fl_value_set_string_take(deltaValue, "selectionAffinity",
200 
201  fl_value_set_string_take(deltaValue, "selectionIsDirectional",
202  fl_value_new_bool(FALSE));
203 
204  int composing_base = -1;
205  int composing_extent = -1;
206  if (!priv->text_model->composing_range().collapsed()) {
207  composing_base = priv->text_model->composing_range().base();
208  composing_extent = priv->text_model->composing_range().extent();
209  }
210  fl_value_set_string_take(deltaValue, "composingBase",
211  fl_value_new_int(composing_base));
212  fl_value_set_string_take(deltaValue, "composingExtent",
213  fl_value_new_int(composing_extent));
214 
215  g_autoptr(FlValue) deltas = fl_value_new_list();
216  fl_value_append(deltas, deltaValue);
217  g_autoptr(FlValue) value = fl_value_new_map();
218  fl_value_set_string(value, "deltas", deltas);
219 
221 
223  priv->channel, kUpdateEditingStateWithDeltasMethod, args, nullptr,
225 }

References args, flutter::TextRange::base(), flutter::TextEditingDelta::delta_end(), flutter::TextEditingDelta::delta_start(), flutter::TextEditingDelta::delta_text(), flutter::TextRange::extent(), 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(), kTextAffinityDownstream, kUpdateEditingStateWithDeltasMethod, flutter::TextEditingDelta::old_text(), priv, update_editing_state_response_cb(), and value.

Referenced by fl_text_input_handler_filter_keypress_default(), im_commit_cb(), im_delete_surrounding_cb(), im_preedit_changed_cb(), and im_preedit_end_cb().

◆ update_im_cursor_position()

static void update_im_cursor_position ( FlTextInputHandler *  self)
static

Definition at line 484 of file fl_text_input_handler.cc.

484  {
486  fl_text_input_handler_get_instance_private(self));
487 
488  // Skip update if not composing to avoid setting to position 0.
489  if (!priv->text_model->composing()) {
490  return;
491  }
492 
493  // Transform the x, y positions of the cursor from local coordinates to
494  // Flutter view coordinates.
495  gint x = priv->composing_rect.x * priv->editabletext_transform[0][0] +
496  priv->composing_rect.y * priv->editabletext_transform[1][0] +
497  priv->editabletext_transform[3][0] + priv->composing_rect.width;
498  gint y = priv->composing_rect.x * priv->editabletext_transform[0][1] +
499  priv->composing_rect.y * priv->editabletext_transform[1][1] +
500  priv->editabletext_transform[3][1] + priv->composing_rect.height;
501 
502  // Transform from Flutter view coordinates to GTK window coordinates.
503  GdkRectangle preedit_rect = {};
505  priv->view_delegate, x, y, &preedit_rect.x, &preedit_rect.y);
506 
507  // Set the cursor location in window coordinates so that GTK can position any
508  // system input method windows.
509  gtk_im_context_set_cursor_location(priv->im_context, &preedit_rect);
510 }

References fl_text_input_view_delegate_translate_coordinates(), and priv.

Referenced by set_editable_size_and_transform(), and set_marked_text_rect().

Variable Documentation

◆ error

GAsyncResult GError** error
Initial value:
{
g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
FL_METHOD_CHANNEL(object), result, error)

Definition at line 107 of file fl_text_input_handler.cc.

Referenced by method_call_cb(), perform_action_response_cb(), and update_editing_state_response_cb().

◆ kBadArgumentsError

constexpr char kBadArgumentsError[] = "Bad Arguments"
staticconstexpr

Definition at line 16 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kChannelName

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

Definition at line 14 of file fl_text_input_handler.cc.

Referenced by fl_text_input_handler_new().

◆ kClearClientMethod

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

Definition at line 21 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kClientIdUnset

constexpr int64_t kClientIdUnset = -1
staticconstexpr

◆ kComposingBaseKey

constexpr char kComposingBaseKey[] = "composingBase"
staticconstexpr

Definition at line 41 of file fl_text_input_handler.cc.

Referenced by set_editing_state(), and update_editing_state().

◆ kComposingExtentKey

constexpr char kComposingExtentKey[] = "composingExtent"
staticconstexpr

Definition at line 42 of file fl_text_input_handler.cc.

Referenced by set_editing_state(), and update_editing_state().

◆ kEnableDeltaModel

constexpr char kEnableDeltaModel[] = "enableDeltaModel"
staticconstexpr

Definition at line 34 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kHideMethod

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

Definition at line 22 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kInputActionKey

constexpr char kInputActionKey[] = "inputAction"
staticconstexpr

Definition at line 32 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kMultilineInputType

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

Definition at line 47 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kNewlineInputAction

constexpr char kNewlineInputAction[] = "TextInputAction.newline"
staticconstexpr

◆ kNoneInputType

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

Definition at line 48 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kPerformActionMethod

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

Definition at line 27 of file fl_text_input_handler.cc.

Referenced by perform_action(), and perform_action_response_cb().

◆ kSelectionAffinityKey

constexpr char kSelectionAffinityKey[] = "selectionAffinity"
staticconstexpr

Definition at line 39 of file fl_text_input_handler.cc.

Referenced by update_editing_state().

◆ kSelectionBaseKey

constexpr char kSelectionBaseKey[] = "selectionBase"
staticconstexpr

Definition at line 37 of file fl_text_input_handler.cc.

Referenced by set_editing_state(), and update_editing_state().

◆ kSelectionExtentKey

constexpr char kSelectionExtentKey[] = "selectionExtent"
staticconstexpr

Definition at line 38 of file fl_text_input_handler.cc.

Referenced by set_editing_state(), and update_editing_state().

◆ kSelectionIsDirectionalKey

constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional"
staticconstexpr

Definition at line 40 of file fl_text_input_handler.cc.

Referenced by update_editing_state().

◆ kSetClientMethod

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

Definition at line 18 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kSetEditableSizeAndTransform

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

Definition at line 28 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kSetEditingStateMethod

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

Definition at line 20 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kSetMarkedTextRect

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

Definition at line 30 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kShowMethod

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

Definition at line 19 of file fl_text_input_handler.cc.

Referenced by method_call_cb().

◆ kTextAffinityDownstream

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

◆ kTextInputTypeKey

constexpr char kTextInputTypeKey[] = "inputType"
staticconstexpr

Definition at line 33 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kTextInputTypeNameKey

constexpr char kTextInputTypeNameKey[] = "name"
staticconstexpr

Definition at line 35 of file fl_text_input_handler.cc.

Referenced by set_client().

◆ kTextKey

constexpr char kTextKey[] = "text"
staticconstexpr

Definition at line 36 of file fl_text_input_handler.cc.

Referenced by set_editing_state(), and update_editing_state().

◆ kTransform

constexpr char kTransform[] = "transform"
staticconstexpr

Definition at line 44 of file fl_text_input_handler.cc.

Referenced by set_editable_size_and_transform().

◆ kUpdateEditingStateMethod

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

Definition at line 23 of file fl_text_input_handler.cc.

Referenced by update_editing_state(), and update_editing_state_response_cb().

◆ kUpdateEditingStateWithDeltasMethod

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

Definition at line 25 of file fl_text_input_handler.cc.

Referenced by update_editing_state_with_delta().

◆ result

GAsyncResult* result

Definition at line 106 of file fl_text_input_handler.cc.

Referenced by add_view_cb(), add_view_engine_error_cb(), add_view_error_cb(), clipboard_text_cb(), clipboard_text_has_strings_cb(), decode_error_method_call(), decode_method_call(), decode_response_with_success(), flutter::MethodCodec< rapidjson::Document >::DecodeAndProcessResponseEnvelope(), flutter::JsonMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::JsonMessageCodec::DecodeMessageInternal(), echo_response_cb(), encode_error_message(), encode_message(), encode_success_envelope(), flutter::MethodCodec< rapidjson::Document >::EncodeSuccessEnvelope(), flutter::JsonMethodCodec::EncodeSuccessEnvelopeInternal(), flutter::StandardMethodCodec::EncodeSuccessEnvelopeInternal(), error_response_cb(), event_to_character(), failure_response_cb(), fake_response_cb(), finish_method(), fl_basic_message_channel_respond(), fl_basic_message_channel_send_finish(), fl_binary_messenger_send_on_channel_finish(), fl_engine_add_view(), fl_engine_add_view_finish(), fl_engine_gl_external_texture_frame_callback(), fl_engine_remove_view(), fl_engine_remove_view_finish(), fl_engine_send_platform_message(), fl_engine_send_platform_message_finish(), fl_engine_send_platform_message_response(), fl_engine_start(), fl_json_method_codec_encode_success_envelope(), fl_method_call_respond_success(), fl_method_channel_invoke_method_finish(), fl_method_codec_encode_success_envelope(), fl_method_success_response_new(), fl_standard_method_codec_decode_response(), fl_standard_method_codec_encode_success_envelope(), fl_test_codec_decode_response(), fl_test_codec_encode_success_envelope(), get_exit_response(), get_keyboard_state(), flutter::AccessibilityBridge::GetPendingEvents(), handle_response(), flutter::MethodChannel< T >::InvokeMethod(), MethodCallMatcher::MatchAndExplain(), MATCHER_P(), message_response_cb(), method_call_success_cb(), method_call_success_error_cb(), method_call_success_response_cb(), method_response_cb(), not_implemented_response_cb(), null_message_response_cb(), nullptr_args_response_cb(), nullptr_response_cb(), perform_action_response_cb(), platform_message_ready_cb(), reassign_method_cb(), remove_view_cb(), remove_view_engine_error_cb(), remove_view_error_cb(), request_app_exit_response_cb(), resize_channel_response_cb(), flutter::BinaryMessengerImpl::Send(), send_events_events_cb(), send_on_channel_finish(), send_response(), set_warns_on_channel_overflow_response_cb(), flutter::MethodChannel< T >::SetMethodCallHandler(), flutter::EventChannel< T >::SetStreamHandler(), setup_locales(), flutter::MethodResult< EncodableValue >::Success(), flutter::MethodResultFunctions< T >::SuccessInternal(), flutter::EngineMethodResult< T >::SuccessInternal(), flutter::TEST(), flutter::testing::TEST(), TEST(), unregister_texture(), update_editing_state_response_cb(), view_added_cb(), and view_removed_cb().

fl_json_method_codec_new
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
Definition: fl_json_method_codec.cc:205
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:75
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
kChannelName
static constexpr char kChannelName[]
Definition: fl_text_input_handler.cc:14
finish_method
static gboolean finish_method(GObject *object, GAsyncResult *result, GError **error)
Definition: fl_binary_messenger.cc:305
kHideMethod
static constexpr char kHideMethod[]
Definition: fl_text_input_handler.cc:22
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_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
im_delete_surrounding_cb
static gboolean im_delete_surrounding_cb(FlTextInputHandler *self, gint offset, gint n_chars)
Definition: fl_text_input_handler.cc:343
fl_text_input_view_delegate_translate_coordinates
void fl_text_input_view_delegate_translate_coordinates(FlTextInputViewDelegate *self, gint view_x, gint view_y, gint *window_x, gint *window_y)
Definition: fl_text_input_view_delegate.cc:14
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_method_not_implemented_response_new
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()
Definition: fl_method_response.cc:179
FlTextInputType
FlTextInputType
Definition: fl_text_input_handler.cc:54
set_client
static FlMethodResponse * set_client(FlTextInputHandler *self, FlValue *args)
Definition: fl_text_input_handler.cc:364
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
kMultilineInputType
static constexpr char kMultilineInputType[]
Definition: fl_text_input_handler.cc:47
flutter::TextEditingDelta::delta_start
int delta_start() const
Get the delta_start_ value.
Definition: text_editing_delta.h:42
show
static FlMethodResponse * show(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:417
i
int i
Definition: fl_socket_accessible.cc:18
priv
FlPixelBufferTexturePrivate * priv
Definition: fl_pixel_buffer_texture.cc:30
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
kSetEditableSizeAndTransform
static constexpr char kSetEditableSizeAndTransform[]
Definition: fl_text_input_handler.cc:28
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
hide
static FlMethodResponse * hide(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:408
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:74
perform_action_response_cb
static void perform_action_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_text_input_handler.cc:228
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
fl_value_lookup_string
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
Definition: fl_value.cc:811
init_im_context
static void init_im_context(FlTextInputHandler *self, GtkIMContext *im_context)
Definition: fl_text_input_handler.cc:717
kFlTextInputTypeText
@ kFlTextInputTypeText
Definition: fl_text_input_handler.cc:55
kTextAffinityDownstream
static constexpr char kTextAffinityDownstream[]
Definition: fl_text_input_handler.cc:46
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_value_get_string
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
kInputActionKey
static constexpr char kInputActionKey[]
Definition: fl_text_input_handler.cc:32
kTextInputTypeKey
static constexpr char kTextInputTypeKey[]
Definition: fl_text_input_handler.cc:33
fl_method_success_response_new
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
Definition: fl_method_response.cc:126
im_preedit_end_cb
static void im_preedit_end_cb(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:318
fl_key_event_get_origin
GdkEvent * fl_key_event_get_origin(FlKeyEvent *self)
Definition: fl_key_event.cc:109
kTransform
static constexpr char kTransform[]
Definition: fl_text_input_handler.cc:44
kSetClientMethod
static constexpr char kSetClientMethod[]
Definition: fl_text_input_handler.cc:18
set_editable_size_and_transform
static FlMethodResponse * set_editable_size_and_transform(FlTextInputHandler *self, FlValue *args)
Definition: fl_text_input_handler.cc:518
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
im_preedit_changed_cb
static void im_preedit_changed_cb(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:262
flutter::TextRange
Definition: text_range.h:19
set_editing_state
static FlMethodResponse * set_editing_state(FlTextInputHandler *self, FlValue *args)
Definition: fl_text_input_handler.cc:430
flutter::TextEditingDelta::delta_text
std::string delta_text() const
Definition: text_editing_delta.h:39
fl_method_call_respond
G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall *self, FlMethodResponse *response, GError **error)
Definition: fl_method_call.cc:77
kClientIdUnset
static constexpr int64_t kClientIdUnset
Definition: fl_text_input_handler.cc:52
flutter::TextRange::base
size_t base() const
Definition: text_range.h:30
kSetEditingStateMethod
static constexpr char kSetEditingStateMethod[]
Definition: fl_text_input_handler.cc:20
fl_key_event_get_keyval
guint fl_key_event_get_keyval(FlKeyEvent *self)
Definition: fl_key_event.cc:94
update_editing_state
static void update_editing_state(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:128
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
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_text_input_handler_filter_keypress_default
static gboolean fl_text_input_handler_filter_keypress_default(FlTextInputHandler *self, FlKeyEvent *event)
Definition: fl_text_input_handler.cc:617
error
GAsyncResult GError ** error
Definition: fl_text_input_handler.cc:107
kUpdateEditingStateWithDeltasMethod
static constexpr char kUpdateEditingStateWithDeltasMethod[]
Definition: fl_text_input_handler.cc:25
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
kSetMarkedTextRect
static constexpr char kSetMarkedTextRect[]
Definition: fl_text_input_handler.cc:30
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69
method_call_cb
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_text_input_handler.cc:560
flutter::TextEditingDelta::old_text
std::string old_text() const
Definition: text_editing_delta.h:34
im_preedit_start_cb
static void im_preedit_start_cb(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:255
fl_method_call_get_name
const G_MODULE_EXPORT gchar * fl_method_call_get_name(FlMethodCall *self)
Definition: fl_method_call.cc:67
kComposingBaseKey
static constexpr char kComposingBaseKey[]
Definition: fl_text_input_handler.cc:41
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
kFlTextInputTypeNone
@ kFlTextInputTypeNone
Definition: fl_text_input_handler.cc:59
clear_client
static FlMethodResponse * clear_client(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:468
update_im_cursor_position
static void update_im_cursor_position(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:484
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
set_marked_text_rect
static FlMethodResponse * set_marked_text_rect(FlTextInputHandler *self, FlValue *args)
Definition: fl_text_input_handler.cc:542
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
fl_text_input_handler_dispose
static void fl_text_input_handler_dispose(GObject *object)
Definition: fl_text_input_handler.cc:594
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
kFlTextInputTypeMultiline
@ kFlTextInputTypeMultiline
Definition: fl_text_input_handler.cc:57
kNewlineInputAction
static constexpr char kNewlineInputAction[]
Definition: fl_text_input_handler.cc:50
kTextKey
static constexpr char kTextKey[]
Definition: fl_text_input_handler.cc:36
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_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
kSelectionBaseKey
static constexpr char kSelectionBaseKey[]
Definition: fl_text_input_handler.cc:37
result
GAsyncResult * result
Definition: fl_text_input_handler.cc:106
kShowMethod
static constexpr char kShowMethod[]
Definition: fl_text_input_handler.cc:19
fl_key_event_get_state
GdkModifierType fl_key_event_get_state(FlKeyEvent *self)
Definition: fl_key_event.cc:99
kEnableDeltaModel
static constexpr char kEnableDeltaModel[]
Definition: fl_text_input_handler.cc:34
kComposingExtentKey
static constexpr char kComposingExtentKey[]
Definition: fl_text_input_handler.cc:42
kSelectionIsDirectionalKey
static constexpr char kSelectionIsDirectionalKey[]
Definition: fl_text_input_handler.cc:40
FlTextInputHandlerPrivate
Definition: fl_text_input_handler.cc:62
kUpdateEditingStateMethod
static constexpr char kUpdateEditingStateMethod[]
Definition: fl_text_input_handler.cc:23
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
flutter::TextRange::extent
size_t extent() const
Definition: text_range.h:36
kClearClientMethod
static constexpr char kClearClientMethod[]
Definition: fl_text_input_handler.cc:21
flutter::TextInputModel
Definition: text_input_model.h:18
kTextInputTypeNameKey
static constexpr char kTextInputTypeNameKey[]
Definition: fl_text_input_handler.cc:35
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592
kSelectionExtentKey
static constexpr char kSelectionExtentKey[]
Definition: fl_text_input_handler.cc:38
kPerformActionMethod
static constexpr char kPerformActionMethod[]
Definition: fl_text_input_handler.cc:27
fl_key_event_get_is_press
gboolean fl_key_event_get_is_press(FlKeyEvent *self)
Definition: fl_key_event.cc:84
kBadArgumentsError
static constexpr char kBadArgumentsError[]
Definition: fl_text_input_handler.cc:16
kNoneInputType
static constexpr char kNoneInputType[]
Definition: fl_text_input_handler.cc:48
fl_method_call_get_args
G_MODULE_EXPORT FlValue * fl_method_call_get_args(FlMethodCall *self)
Definition: fl_method_call.cc:72
flutter::TextEditingDelta
A change in the state of an input field.
Definition: text_editing_delta.h:16
perform_action
static void perform_action(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:238
update_editing_state_response_cb
static void update_editing_state_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_text_input_handler.cc:117
im_retrieve_surrounding_cb
static gboolean im_retrieve_surrounding_cb(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:332
im_commit_cb
static void im_commit_cb(FlTextInputHandler *self, const gchar *text)
Definition: fl_text_input_handler.cc:291
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
flutter::TextEditingDelta::delta_end
int delta_end() const
Get the delta_end_ value.
Definition: text_editing_delta.h:45
kSelectionAffinityKey
static constexpr char kSelectionAffinityKey[]
Definition: fl_text_input_handler.cc:39
update_editing_state_with_delta
static void update_editing_state_with_delta(FlTextInputHandler *self, flutter::TextEditingDelta *delta)
Definition: fl_text_input_handler.cc:170