|
Flutter Linux Embedder
|
|
Go to the documentation of this file.
36 fl_key_channel_user_data,
38 KEY_CHANNEL_USER_DATA,
53 G_DEFINE_TYPE(FlKeyChannelUserData, fl_key_channel_user_data, G_TYPE_OBJECT)
57 g_return_if_fail(FL_IS_KEY_CHANNEL_USER_DATA(
object));
58 FlKeyChannelUserData*
self = FL_KEY_CHANNEL_USER_DATA(
object);
59 if (self->responder !=
nullptr) {
60 g_object_remove_weak_pointer(
61 G_OBJECT(self->responder),
62 reinterpret_cast<gpointer*
>(&(self->responder)));
63 self->responder =
nullptr;
69 FlKeyChannelUserDataClass* klass) {
80 FlKeyChannelResponder* responder,
83 FlKeyChannelUserData*
self = FL_KEY_CHANNEL_USER_DATA(
84 g_object_new(fl_key_channel_user_data_get_type(),
nullptr));
86 self->responder = responder;
89 g_object_add_weak_pointer(G_OBJECT(responder),
90 reinterpret_cast<gpointer*
>(&(self->responder)));
110 FlKeyChannelResponder,
111 fl_key_channel_responder,
117 FlKeyResponder* responder,
124 FlKeyResponderInterface* iface) {
135 g_autoptr(FlKeyChannelUserData) data = FL_KEY_CHANNEL_USER_DATA(
user_data);
138 if (data->responder ==
nullptr) {
142 FlKeyChannelResponder*
self = data->responder;
144 g_autoptr(GError)
error =
nullptr;
145 FlBasicMessageChannel* messageChannel = FL_BASIC_MESSAGE_CHANNEL(
object);
148 if (self->mock !=
nullptr && self->mock->value_converter !=
nullptr) {
149 message =
self->mock->value_converter(message);
151 bool handled =
false;
152 if (
error !=
nullptr) {
153 g_warning(
"Unable to retrieve framework response: %s",
error->message);
155 g_autoptr(
FlValue) handled_value =
160 data->callback(handled, data->user_data);
165 FlKeyChannelResponder*
self = FL_KEY_CHANNEL_RESPONDER(
object);
167 g_clear_object(&self->channel);
169 G_OBJECT_CLASS(fl_key_channel_responder_parent_class)->dispose(
object);
174 FlKeyChannelResponderClass* klass) {
187 FlBinaryMessenger* messenger,
189 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger),
nullptr);
191 FlKeyChannelResponder*
self = FL_KEY_CHANNEL_RESPONDER(
192 g_object_new(fl_key_channel_responder_get_type(),
nullptr));
196 const char* channel_name =
199 FL_MESSAGE_CODEC(codec));
206 FlKeyResponder* responder,
211 FlKeyChannelResponder*
self = FL_KEY_CHANNEL_RESPONDER(responder);
212 g_return_if_fail(
event !=
nullptr);
213 g_return_if_fail(
callback !=
nullptr);
216 int64_t scan_code =
event->keycode;
217 int64_t unicode_scarlar_values = gdk_keyval_to_unicode(
event->
keyval);
242 guint
state =
event->state & ~(GDK_LOCK_MASK | GDK_MOD2_MASK);
244 static bool shift_lock_pressed = FALSE;
245 static bool caps_lock_pressed = FALSE;
246 static bool num_lock_pressed = FALSE;
248 case GDK_KEY_Num_Lock:
249 num_lock_pressed =
event->is_press;
251 case GDK_KEY_Caps_Lock:
252 caps_lock_pressed =
event->is_press;
254 case GDK_KEY_Shift_Lock:
255 shift_lock_pressed =
event->is_press;
261 state |= (shift_lock_pressed || caps_lock_pressed) ? GDK_LOCK_MASK : 0x0;
262 state |= num_lock_pressed ? GDK_MOD2_MASK : 0x0;
274 if (unicode_scarlar_values != 0) {
284 FlKeyChannelUserData* data =
static void fl_key_channel_user_data_dispose(GObject *object)
static constexpr char kLinuxKeymap[]
static constexpr char kKeyCodeKey[]
static FlKeyChannelUserData * fl_key_channel_user_data_new(FlKeyChannelResponder *responder, FlKeyResponderAsyncCallback callback, gpointer user_data)
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
G_MODULE_EXPORT void fl_basic_message_channel_send(FlBasicMessageChannel *self, FlValue *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
static constexpr char kChannelName[]
static void fl_key_channel_responder_init(FlKeyChannelResponder *self)
static constexpr char kTypeValueDown[]
static void handle_response(GObject *object, GAsyncResult *result, gpointer user_data)
typedefG_BEGIN_DECLS struct _FlValue FlValue
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
FlKeyChannelResponderMock * mock
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
static void fl_key_channel_responder_dispose(GObject *object)
FlKeyChannelResponder * fl_key_channel_responder_new(FlBinaryMessenger *messenger, FlKeyChannelResponderMock *mock)
static constexpr char kModifiersKey[]
static constexpr char kTypeValueUp[]
static constexpr char kScanCodeKey[]
const char * channel_name
G_MODULE_EXPORT FlValue * fl_value_new_map()
#define FL_TYPE_KEY_RESPONDER
static constexpr char kSpecifiedLogicalKey[]
void(* FlKeyResponderAsyncCallback)(bool handled, gpointer user_data)
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
static constexpr char kGtkToolkit[]
static void fl_key_channel_responder_class_init(FlKeyChannelResponderClass *klass)
static constexpr char kTypeKey[]
FlKeyResponderAsyncCallback callback
static constexpr char kKeymapKey[]
G_DEFINE_TYPE_WITH_CODE(FlKeyChannelResponder, fl_key_channel_responder, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(FL_TYPE_KEY_RESPONDER, fl_key_channel_responder_iface_init)) static void fl_key_channel_responder_handle_event(FlKeyResponder *responder
static void fl_key_channel_user_data_init(FlKeyChannelUserData *self)
FlKeyChannelResponder * responder
const uint8_t uint32_t uint32_t GError ** error
static void fl_key_channel_responder_iface_init(FlKeyResponderInterface *iface)
static void fl_key_channel_user_data_class_init(FlKeyChannelUserDataClass *klass)
FlBasicMessageChannel * channel
FlKeyEvent uint64_t specified_logical_key
static constexpr char kToolkitKey[]
static void fl_key_channel_responder_handle_event(FlKeyResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, FlKeyResponderAsyncCallback callback, gpointer user_data)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static constexpr char kUnicodeScalarValuesKey[]
G_MODULE_EXPORT FlValue * fl_basic_message_channel_send_finish(FlBasicMessageChannel *self, GAsyncResult *result, GError **error)
G_MODULE_EXPORT FlBasicMessageChannel * fl_basic_message_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMessageCodec *codec)
G_DECLARE_FINAL_TYPE(FlKeyChannelUserData, fl_key_channel_user_data, FL, KEY_CHANNEL_USER_DATA, GObject)
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)