Flutter Linux Embedder
fl_text_input_handler.h File Reference

Go to the source code of this file.

Classes

struct  _FlTextInputHandlerClass
 

Functions

G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE (FlTextInputHandler, fl_text_input_handler, FL, TEXT_INPUT_HANDLER, GObject)
 
FlTextInputHandler * fl_text_input_handler_new (FlBinaryMessenger *messenger, GtkIMContext *im_context, FlTextInputViewDelegate *view_delegate)
 
gboolean fl_text_input_handler_filter_keypress (FlTextInputHandler *handler, FlKeyEvent *event)
 

Function Documentation

◆ 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_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_DECLARE_DERIVABLE_TYPE()

G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE ( FlTextInputHandler  ,
fl_text_input_handler  ,
FL  ,
TEXT_INPUT_HANDLER  ,
GObject   
)
fl_json_method_codec_new
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
Definition: fl_json_method_codec.cc:205
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
kChannelName
static constexpr char kChannelName[]
Definition: fl_text_input_handler.cc:14
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
priv
FlPixelBufferTexturePrivate * priv
Definition: fl_pixel_buffer_texture.cc:30
init_im_context
static void init_im_context(FlTextInputHandler *self, GtkIMContext *im_context)
Definition: fl_text_input_handler.cc:717
method_call_cb
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_text_input_handler.cc:560
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
FlTextInputHandlerPrivate
Definition: fl_text_input_handler.cc:62