| Flutter Linux Embedder |

fl_key_embedder_responder.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EMBEDDER_RESPONDER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EMBEDDER_RESPONDER_H_
7
8 #include <gdk/gdk.h>
9 #include <functional>
10
11 #include "flutter/shell/platform/linux/fl_key_responder.h"
12 #include "flutter/shell/platform/linux/fl_keyboard_manager.h"
13 #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
14 #include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
15
16 constexpr int kMaxConvertedKeyData = 3;
17
18 typedef std::function<void(const FlutterKeyEvent* event,
19 FlutterKeyEventCallback callback,
20 void* user_data)>
21 EmbedderSendKeyEvent;
22
23 G_BEGIN_DECLS
24
25 #define FL_TYPE_KEY_EMBEDDER_RESPONDER fl_key_embedder_responder_get_type()
26 G_DECLARE_FINAL_TYPE(FlKeyEmbedderResponder,
27 fl_key_embedder_responder,
28 FL,
29 KEY_EMBEDDER_RESPONDER,
30 GObject);
31
32 /**
33 * FlKeyEmbedderResponder:
34 *
35 * A #FlKeyResponder that handles events by sending the converted events
36 * through the embedder API.
37 *
38 * This class communicates with the HardwareKeyboard API in the framework.
39 */
40
41 /**
42 * fl_key_embedder_responder_new:
43 * @engine: The #FlEngine, whose the embedder API will be used to send
44 * the event.
45 *
46 * Creates a new #FlKeyEmbedderResponder.
47 *
48 * Returns: a new #FlKeyEmbedderResponder.
49 */
50 FlKeyEmbedderResponder* fl_key_embedder_responder_new(
51 EmbedderSendKeyEvent send_key_event);
52
53 /**
54 * fl_key_embedder_responder_sync_modifiers_if_needed:
55 * @responder: the #FlKeyEmbedderResponder self.
56 * @state: the state of the modifiers mask.
57 * @event_time: the time attribute of the incoming GDK event.
58 *
59 * If needed, synthesize modifier keys up and down event by comparing their
60 * current pressing states with the given modifiers mask.
61 */
62 void fl_key_embedder_responder_sync_modifiers_if_needed(
63 FlKeyEmbedderResponder* responder,
64 guint state,
65 double event_time);
66
67 /**
68 * fl_key_embedder_responder_get_pressed_state:
69 * @responder: the #FlKeyEmbedderResponder self.
70 *
71 * Returns the keyboard pressed state. The hash table contains one entry per
72 * pressed keys, mapping from the logical key to the physical key.
73 */
74 GHashTable* fl_key_embedder_responder_get_pressed_state(
75 FlKeyEmbedderResponder* responder);
76
77 G_END_DECLS
78
79 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EMBEDDER_RESPONDER_H_
fl_key_embedder_responder_get_pressed_state
GHashTable * fl_key_embedder_responder_get_pressed_state(FlKeyEmbedderResponder *responder)
Definition: fl_key_embedder_responder.cc:889
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
fl_keyboard_manager.h
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
state
AtkStateType state
Definition: fl_accessible_node.cc:10
fl_binary_messenger.h
EmbedderSendKeyEvent
std::function< void(const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)> EmbedderSendKeyEvent
Definition: fl_key_embedder_responder.h:21
fl_key_embedder_responder_new
FlKeyEmbedderResponder * fl_key_embedder_responder_new(EmbedderSendKeyEvent send_key_event)
Definition: fl_key_embedder_responder.cc:262
FL
FL
Definition: fl_binary_messenger.cc:27
kMaxConvertedKeyData
constexpr int kMaxConvertedKeyData
Definition: fl_key_embedder_responder.h:16
fl_value.h
fl_key_embedder_responder_sync_modifiers_if_needed
void fl_key_embedder_responder_sync_modifiers_if_needed(FlKeyEmbedderResponder *responder, guint state, double event_time)
Definition: fl_key_embedder_responder.cc:872
send_key_event
static void send_key_event(FlTextInputPlugin *plugin, gint keyval, gint state=0)
Definition: fl_text_input_plugin_test.cc:181
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlKeyEmbedderResponder, fl_key_embedder_responder, FL, KEY_EMBEDDER_RESPONDER, GObject)
fl_key_responder.h