Flutter Engine
fl_text_input_plugin.h File Reference
#include <gdk/gdk.h>
#include "flutter/shell/platform/linux/fl_key_event.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"

Go to the source code of this file.

Classes

struct  _FlTextInputPluginClass
 

Typedefs

typedef gboolean(* FlTextInputPluginImFilter) (GtkIMContext *im_context, gpointer gdk_event)
 

Functions

G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE (FlTextInputPlugin, fl_text_input_plugin, FL, TEXT_INPUT_PLUGIN, GObject)
 
FlTextInputPlugin * fl_text_input_plugin_new (FlBinaryMessenger *messenger, FlView *view, FlTextInputPluginImFilter im_filter)
 
gboolean fl_text_input_plugin_filter_keypress (FlTextInputPlugin *plugin, FlKeyEvent *event)
 

Typedef Documentation

◆ FlTextInputPluginImFilter

typedef gboolean(* FlTextInputPluginImFilter) (GtkIMContext *im_context, gpointer gdk_event)

FlTextInputPluginImFilter: : the pointer to the GdkEventKey.

The signature for a callback with which a #FlTextInputPlugin allow an input method to internally handle key press and release events.

The #gdk_event is an opaque pointer. It will be GdkEvent* in actual applications, or a dummy pointer in unit tests.

Definition at line 24 of file fl_text_input_plugin.h.

Function Documentation

◆ fl_text_input_plugin_filter_keypress()

gboolean fl_text_input_plugin_filter_keypress ( FlTextInputPlugin *  plugin,
FlKeyEvent event 
)

fl_text_input_plugin_filter_keypress : an #FlTextInputPlugin. : a FlKeyEvent

Process a Gdk key event.

Returns: TRUE if the event was used.

Definition at line 637 of file fl_text_input_plugin.cc.

References FALSE.

Referenced by responder_handle_event_callback().

638  {
639  g_return_val_if_fail(FL_IS_TEXT_INPUT_PLUGIN(self), FALSE);
640  if (FL_TEXT_INPUT_PLUGIN_GET_CLASS(self)->filter_keypress) {
641  return FL_TEXT_INPUT_PLUGIN_GET_CLASS(self)->filter_keypress(self, event);
642  }
643  return FALSE;
644 }
return FALSE

◆ fl_text_input_plugin_new()

FlTextInputPlugin* fl_text_input_plugin_new ( FlBinaryMessenger *  messenger,
FlView *  view,
FlTextInputPluginImFilter  im_filter 
)

fl_text_input_plugin_new: : an #FlBinaryMessenger. : the #FlView with which the text input plugin is associated. : a function used to allow an input method to internally handle key press and release events. Typically a wrap of #gtk_im_context_filter_keypress. Must not be nullptr.

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

Returns: a new #FlTextInputPlugin.

Definition at line 612 of file fl_text_input_plugin.cc.

References FlTextInputPluginPrivate::channel, fl_json_method_codec_new(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), FlTextInputPluginPrivate::im_filter, kChannelName, method_call_cb(), and FlTextInputPluginPrivate::view.

Referenced by fl_view_init_keyboard().

615  {
616  g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
617  g_return_val_if_fail(im_filter != nullptr, nullptr);
618 
619  FlTextInputPlugin* self = FL_TEXT_INPUT_PLUGIN(
620  g_object_new(fl_text_input_plugin_get_type(), nullptr));
621 
622  g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
624  fl_text_input_plugin_get_instance_private(self));
625  priv->channel =
626  fl_method_channel_new(messenger, kChannelName, FL_METHOD_CODEC(codec));
628  nullptr);
629  priv->view = view;
630  priv->im_filter = im_filter;
631 
632  return self;
633 }
FlTextInputPluginImFilter im_filter
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
G_MODULE_EXPORT void fl_method_channel_set_method_call_handler(FlMethodChannel *self, FlMethodChannelMethodCallHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
G_MODULE_EXPORT FlMethodChannel * fl_method_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec)
static constexpr char kChannelName[]
FlView * view
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)

◆ G_DECLARE_DERIVABLE_TYPE()

G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE ( FlTextInputPlugin  ,
fl_text_input_plugin  ,
FL  ,
TEXT_INPUT_PLUGIN  ,
GObject   
)