Flutter Linux Embedder
fl_key_channel_responder.h File Reference

Go to the source code of this file.

Classes

struct  _FlKeyChannelResponderMock
 

Macros

#define FL_TYPE_KEY_CHANNEL_RESPONDER   fl_key_channel_responder_get_type()
 

Typedefs

typedef FlValue *(* FlValueConverter) (FlValue *)
 
typedef struct _FlKeyChannelResponderMock FlKeyChannelResponderMock
 

Functions

 G_DECLARE_FINAL_TYPE (FlKeyChannelResponder, fl_key_channel_responder, FL, KEY_CHANNEL_RESPONDER, GObject)
 
FlKeyChannelResponder * fl_key_channel_responder_new (FlBinaryMessenger *messenger, FlKeyChannelResponderMock *mock=nullptr)
 

Macro Definition Documentation

◆ FL_TYPE_KEY_CHANNEL_RESPONDER

#define FL_TYPE_KEY_CHANNEL_RESPONDER   fl_key_channel_responder_get_type()

Definition at line 40 of file fl_key_channel_responder.h.

Typedef Documentation

◆ FlKeyChannelResponderMock

FlKeyChannelResponderMock:

Allows mocking of FlKeyChannelResponder methods and values. Only used in unittests.

◆ FlValueConverter

typedef FlValue*(* FlValueConverter) (FlValue *)

Definition at line 15 of file fl_key_channel_responder.h.

Function Documentation

◆ fl_key_channel_responder_new()

FlKeyChannelResponder* fl_key_channel_responder_new ( FlBinaryMessenger *  messenger,
FlKeyChannelResponderMock mock = nullptr 
)

FlKeyChannelResponder:

A #FlKeyResponder that handles events by sending the raw event data in JSON through the message channel.

This class communicates with the RawKeyboard API in the framework. fl_key_channel_responder_new: @messenger: the messenger that the message channel should be built on. @mock: options to mock several functionalities. Only used in unittests.

Creates a new #FlKeyChannelResponder.

Returns: a new #FlKeyChannelResponder.

Definition at line 186 of file fl_key_channel_responder.cc.

188  {
189  g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
190 
191  FlKeyChannelResponder* self = FL_KEY_CHANNEL_RESPONDER(
192  g_object_new(fl_key_channel_responder_get_type(), nullptr));
193  self->mock = mock;
194 
195  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
196  const char* channel_name =
197  mock == nullptr ? kChannelName : mock->channel_name;
198  self->channel = fl_basic_message_channel_new(messenger, channel_name,
199  FL_MESSAGE_CODEC(codec));
200 
201  return self;
202 }

References _FlKeyChannelResponderMock::channel_name, fl_basic_message_channel_new(), fl_json_message_codec_new(), and kChannelName.

Referenced by fl_keyboard_manager_new(), TEST(), and test_lock_event().

◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE ( FlKeyChannelResponder  ,
fl_key_channel_responder  ,
FL  ,
KEY_CHANNEL_RESPONDER  ,
GObject   
)
kChannelName
static constexpr char kChannelName[]
Definition: fl_key_channel_responder.cc:13
fl_json_message_codec_new
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
Definition: fl_json_message_codec.cc:306
_FlKeyChannelResponderMock::channel_name
const char * channel_name
Definition: fl_key_channel_responder.h:35
fl_basic_message_channel_new
G_MODULE_EXPORT FlBasicMessageChannel * fl_basic_message_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMessageCodec *codec)
Definition: fl_basic_message_channel.cc:154