| Flutter Linux Embedder |

Classes | Functions | Variables
fl_keyboard_channel.cc File Reference
`#include "flutter/shell/platform/linux/fl_keyboard_channel.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_channel.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_method_codec.h"`

Go to the source code of this file.

## Classes
struct | _FlKeyboardChannel

## Functions
static FlMethodResponse * | get_keyboard_state (FlKeyboardChannel *self)
static void | method_call_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
static void | fl_keyboard_channel_dispose (GObject *object)
static void | fl_keyboard_channel_class_init (FlKeyboardChannelClass *klass)
static void | fl_keyboard_channel_init (FlKeyboardChannel *self)
FlKeyboardChannel * | fl_keyboard_channel_new (FlBinaryMessenger *messenger, FlKeyboardChannelVTable *vtable, gpointer user_data)

## Variables
static constexpr char | kChannelName [] = "flutter/keyboard"
static constexpr char | kGetKeyboardStateMethod [] = "getKeyboardState"

## Function Documentation

## ◆ fl_keyboard_channel_class_init()

static void fl_keyboard_channel_class_init | ( | FlKeyboardChannelClass * | klass | ) |
| static

Definition at line 59 of file fl_keyboard_channel.cc.

59 {
60 G_OBJECT_CLASS(klass)->dispose = fl_keyboard_channel_dispose;
61 }
fl_keyboard_channel_dispose
static void fl_keyboard_channel_dispose(GObject *object)
Definition: fl_keyboard_channel.cc:51

References fl_keyboard_channel_dispose().

## ◆ fl_keyboard_channel_dispose()

static void fl_keyboard_channel_dispose | ( | GObject * | object | ) |
| static

Definition at line 51 of file fl_keyboard_channel.cc.

51 {
52 FlKeyboardChannel* self = FL_KEYBOARD_CHANNEL(object);
53
54 g_clear_object(&self->channel);
55
56 G_OBJECT_CLASS(fl_keyboard_channel_parent_class)->dispose(object);
57 }

Referenced by fl_keyboard_channel_class_init().

## ◆ fl_keyboard_channel_init()

static void fl_keyboard_channel_init | ( | FlKeyboardChannel * | self | ) |
| static

Definition at line 63 of file fl_keyboard_channel.cc.

63 {}

## ◆ fl_keyboard_channel_new()

FlKeyboardChannel* fl_keyboard_channel_new | ( | FlBinaryMessenger * | messenger,
|  | FlKeyboardChannelVTable * | vtable,
|  | gpointer | user_data
| ) |  |

fl_keyboard_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.keyboard from the Flutter services library.

Returns: a new #FlKeyboardChannel

Definition at line 65 of file fl_keyboard_channel.cc.

67 {
68 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
69 g_return_val_if_fail(vtable != nullptr, nullptr);
70
71 FlKeyboardChannel* self = FL_KEYBOARD_CHANNEL(
72 g_object_new(fl_keyboard_channel_get_type(), nullptr));
73
74 self->vtable = vtable;
75 self->user_data = user_data;
76
77 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
78 self->channel =
79 fl_method_channel_new(messenger, kChannelName, FL_METHOD_CODEC(codec));
80 fl_method_channel_set_method_call_handler(self->channel, method_call_cb, self,
81 nullptr);
82
83 return self;
84 }
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
method_call_cb
static void method_call_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_keyboard_channel.cc:32
kChannelName
static constexpr char kChannelName[]
Definition: fl_keyboard_channel.cc:10
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
fl_standard_method_codec_new
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new()
Definition: fl_standard_method_codec.cc:291

References fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), kChannelName, method_call_cb(), and user_data.

Referenced by fl_keyboard_handler_new().

## ◆ get_keyboard_state()

static FlMethodResponse* get_keyboard_state | ( | FlKeyboardChannel * | self | ) |
| static

Definition at line 26 of file fl_keyboard_channel.cc.

26 {
27 g_autoptr(FlValue) result = self->vtable->get_keyboard_state(self->user_data);
28 return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
29 }
fl_method_success_response_new
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
Definition: fl_method_response.cc:126
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

References fl_method_success_response_new().

Referenced by method_call_cb().

## ◆ method_call_cb()

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

Definition at line 32 of file fl_keyboard_channel.cc.

34 {
35 FlKeyboardChannel* self = FL_KEYBOARD_CHANNEL(user_data);
36
37 const gchar* method = fl_method_call_get_name(method_call);
38 g_autoptr(FlMethodResponse) response = nullptr;
39 if (strcmp(method, kGetKeyboardStateMethod) == 0) {
40 response = get_keyboard_state(self);
41 } else {
42 response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
43 }
44
45 g_autoptr(GError) error = nullptr;
46 if (!fl_method_call_respond(method_call, response, &error)) {
47 g_warning("Failed to send method call response: %s", error->message);
48 }
49 }
get_keyboard_state
static FlMethodResponse * get_keyboard_state(FlKeyboardChannel *self)
Definition: fl_keyboard_channel.cc:26
kGetKeyboardStateMethod
static constexpr char kGetKeyboardStateMethod[]
Definition: fl_keyboard_channel.cc:12
fl_method_call_respond
G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall *self, FlMethodResponse *response, GError **error)
Definition: fl_method_call.cc:77
fl_method_call_get_name
G_MODULE_EXPORT const gchar * fl_method_call_get_name(FlMethodCall *self)
Definition: fl_method_call.cc:67
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
fl_method_not_implemented_response_new
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()
Definition: fl_method_response.cc:179
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40

References error, fl_method_call_get_name(), fl_method_call_respond(), fl_method_not_implemented_response_new(), get_keyboard_state(), kGetKeyboardStateMethod, method_call, and user_data.

Referenced by fl_keyboard_channel_new().

## Variable Documentation

## ◆ kChannelName

constexpr char kChannelName[] = "flutter/keyboard"
| static constexpr

Definition at line 10 of file fl_keyboard_channel.cc.

Referenced by fl_keyboard_channel_new().

## ◆ kGetKeyboardStateMethod

constexpr char kGetKeyboardStateMethod[] = "getKeyboardState"
| static constexpr

Definition at line 12 of file fl_keyboard_channel.cc.

Referenced by method_call_cb().