| Flutter Linux Embedder |

fl_keyboard_manager.cc
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 #include "flutter/shell/platform/linux/fl_keyboard_manager.h"
6
7 #include <array>
8 #include <cinttypes>
9 #include <memory>
10 #include <string>
11
12 #include "flutter/shell/platform/linux/fl_key_channel_responder.h"
13 #include "flutter/shell/platform/linux/fl_key_embedder_responder.h"
14 #include "flutter/shell/platform/linux/fl_keyboard_layout.h"
15 #include "flutter/shell/platform/linux/key_mapping.h"
16
17 // Turn on this flag to print complete layout data when switching IMEs. The data
18 // is used in unit tests.
19 #define DEBUG_PRINT_LAYOUT
20
21 namespace {
22
23 static bool is_eascii(uint16_t character) {
24 return character < 256;
25 }
26
27 #ifdef DEBUG_PRINT_LAYOUT
28 // Prints layout entries that will be parsed by `MockLayoutData`.
29 void debug_format_layout_data(std::string& debug_layout_data,
30 uint16_t keycode,
31 uint16_t clue1,
32 uint16_t clue2) {
33 if (keycode % 4 == 0) {
34 debug_layout_data.append(" ");
35 }
36
37 constexpr int kBufferSize = 30;
38 char buffer[kBufferSize];
39 buffer[0] = 0;
40 buffer[kBufferSize - 1] = 0;
41
42 snprintf(buffer, kBufferSize, "0x%04x, 0x%04x, ", clue1, clue2);
43 debug_layout_data.append(buffer);
44
45 if (keycode % 4 == 3) {
46 snprintf(buffer, kBufferSize, " // 0x%02x", keycode);
47 debug_layout_data.append(buffer);
48 }
49 }
50 #endif
51
52 } // namespace
53
54 typedef struct {
55 // Event being handled.
56 FlKeyEvent* event;
57
58 // TRUE if the embedder has responded.
59 gboolean embedder_responded;
60
61 // TRUE if the channel has responded.
62 gboolean channel_responded;
63
64 // TRUE if this event is to be redispatched;
65 gboolean redispatch;
66
67 // TRUE if either the embedder of channel handled this event (or both).
68 gboolean handled;
69 } HandleEventData;
70
71 static HandleEventData* handle_event_data_new(FlKeyEvent* event) {
72 HandleEventData* data =
73 static_cast<HandleEventData*>(g_new0(HandleEventData, 1));
74 data->event = FL_KEY_EVENT(g_object_ref(event));
75 return data;
76 }
77
78 static void handle_event_data_free(HandleEventData* data) {
79 g_object_unref(data->event);
80 g_free(data);
81 }
82
83 struct _FlKeyboardManager {
84 GObject parent_instance;
85
86 FlKeyboardManagerLookupKeyHandler lookup_key_handler;
87 gpointer lookup_key_handler_user_data;
88
89 // Key events that have been redispatched.
90 GPtrArray* redispatched_key_events;
91
92 FlKeyEmbedderResponder* key_embedder_responder;
93
94 FlKeyChannelResponder* key_channel_responder;
95
96 // Record the derived layout.
97 //
98 // It is cleared when the platform reports a layout switch. Each entry,
99 // which corresponds to a group, is only initialized on the arrival of the
100 // first event for that group that has a goal keycode.
101 FlKeyboardLayout* derived_layout;
102
103 // A static map from keycodes to all layout goals.
104 //
105 // It is set up when the manager is initialized and is not changed ever after.
106 std::unique_ptr<std::map<uint16_t, const LayoutGoal*>> keycode_to_goals;
107
108 // A static map from logical keys to all mandatory layout goals.
109 //
110 // It is set up when the manager is initialized and is not changed ever after.
111 std::unique_ptr<std::map<uint64_t, const LayoutGoal*>>
112 logical_to_mandatory_goals;
113
114 GdkKeymap* keymap;
115 gulong keymap_keys_changed_cb_id; // Signal connection ID for
116 // keymap-keys-changed
117
118 GCancellable* cancellable;
119 };
120
121 G_DEFINE_TYPE(FlKeyboardManager, fl_keyboard_manager, G_TYPE_OBJECT);
122
123 static gboolean event_is_redispatched(FlKeyboardManager* self,
124 FlKeyEvent* event) {
125 guint32 time = fl_key_event_get_time(event);
126 gboolean is_press = !!fl_key_event_get_is_press(event);
127 guint16 keycode = fl_key_event_get_keycode(event);
128 for (guint i = 0; i < self->redispatched_key_events->len; i++) {
129 FlKeyEvent* e =
130 FL_KEY_EVENT(g_ptr_array_index(self->redispatched_key_events, i));
131 if (fl_key_event_get_time(e) == time &&
132 !!fl_key_event_get_is_press(e) == is_press &&
133 fl_key_event_get_keycode(e) == keycode) {
134 g_ptr_array_remove_index(self->redispatched_key_events, i);
135 return TRUE;
136 }
137 }
138
139 return FALSE;
140 }
141
142 static void keymap_keys_changed_cb(FlKeyboardManager* self) {
143 g_clear_object(&self->derived_layout);
144 self->derived_layout = fl_keyboard_layout_new();
145 }
146
147 static void complete_handle_event(FlKeyboardManager* self, GTask* task) {
148 HandleEventData* data =
149 static_cast<HandleEventData*>(g_task_get_task_data(task));
150
151 // Waiting for responses.
152 if (!data->embedder_responded || !data->channel_responded) {
153 return;
154 }
155
156 data->redispatch = !data->handled;
157 g_task_return_boolean(task, TRUE);
158 }
159
160 static void responder_handle_embedder_event_cb(GObject* object,
161 GAsyncResult* result,
162 gpointer user_data) {
163 g_autoptr(GTask) task = G_TASK(user_data);
164 FlKeyboardManager* self = FL_KEYBOARD_MANAGER(g_task_get_source_object(task));
165
166 HandleEventData* data =
167 static_cast<HandleEventData*>(g_task_get_task_data(G_TASK(task)));
168 data->embedder_responded = TRUE;
169
170 g_autoptr(GError) error = nullptr;
171 gboolean handled;
172 if (!fl_key_embedder_responder_handle_event_finish(
173 FL_KEY_EMBEDDER_RESPONDER(object), result, &handled, &error)) {
174 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
175 g_warning("Failed to handle key event in embedder: %s", error->message);
176 }
177 handled = FALSE;
178 }
179 if (handled) {
180 data->handled = TRUE;
181 }
182
183 complete_handle_event(self, task);
184 }
185
186 static void responder_handle_channel_event_cb(GObject* object,
187 GAsyncResult* result,
188 gpointer user_data) {
189 g_autoptr(GTask) task = G_TASK(user_data);
190 FlKeyboardManager* self = FL_KEYBOARD_MANAGER(g_task_get_source_object(task));
191
192 HandleEventData* data =
193 static_cast<HandleEventData*>(g_task_get_task_data(G_TASK(task)));
194 data->channel_responded = TRUE;
195
196 g_autoptr(GError) error = nullptr;
197 gboolean handled;
198 if (!fl_key_channel_responder_handle_event_finish(
199 FL_KEY_CHANNEL_RESPONDER(object), result, &handled, &error)) {
200 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
201 g_warning("Failed to handle key event in platform: %s", error->message);
202 }
203 handled = FALSE;
204 }
205 if (handled) {
206 data->handled = TRUE;
207 }
208
209 complete_handle_event(self, task);
210 }
211
212 static uint16_t convert_key_to_char(FlKeyboardManager* self,
213 guint keycode,
214 gint group,
215 gint level) {
216 GdkKeymapKey key = {keycode, group, level};
217 constexpr int kBmpMax = 0xD7FF;
218 guint origin;
219 if (self->lookup_key_handler != nullptr) {
220 origin = self->lookup_key_handler(&key, self->lookup_key_handler_user_data);
221 } else {
222 origin = gdk_keymap_lookup_key(self->keymap, &key);
223 }
224 return origin < kBmpMax ? origin : 0xFFFF;
225 }
226
227 // Make sure that Flutter has derived the layout for the group of the event,
228 // if the event contains a goal keycode.
229 static void guarantee_layout(FlKeyboardManager* self, FlKeyEvent* event) {
230 guint8 group = fl_key_event_get_group(event);
231 if (fl_keyboard_layout_has_group(self->derived_layout, group)) {
232 return;
233 }
234 if (self->keycode_to_goals->find(fl_key_event_get_keycode(event)) ==
235 self->keycode_to_goals->end()) {
236 return;
237 }
238
239 // Clone all mandatory goals. Each goal is removed from this cloned map when
240 // fulfilled, and the remaining ones will be assigned to a default position.
241 std::map<uint64_t, const LayoutGoal*> remaining_mandatory_goals =
242 *self->logical_to_mandatory_goals;
243
244 #ifdef DEBUG_PRINT_LAYOUT
245 std::string debug_layout_data;
246 for (uint16_t keycode = 0; keycode < 128; keycode += 1) {
247 std::vector<uint16_t> this_key_clues = {
248 convert_key_to_char(self, keycode, group, 0),
249 convert_key_to_char(self, keycode, group, 1), // Shift
250 };
251 debug_format_layout_data(debug_layout_data, keycode, this_key_clues[0],
252 this_key_clues[1]);
253 }
254 #endif
255
256 // It's important to only traverse layout goals instead of all keycodes.
257 // Some key codes outside of the standard keyboard also gives alpha-numeric
258 // letters, and will therefore take over mandatory goals from standard
259 // keyboard keys if they come first. Example: French keyboard digit 1.
260 for (const LayoutGoal& keycode_goal : layout_goals) {
261 uint16_t keycode = keycode_goal.keycode;
262 std::vector<uint16_t> this_key_clues = {
263 convert_key_to_char(self, keycode, group, 0),
264 convert_key_to_char(self, keycode, group, 1), // Shift
265 };
266
267 // The logical key should be the first available clue from below:
268 //
269 // - Mandatory goal, if it matches any clue. This ensures that all alnum
270 // keys can be found somewhere.
271 // - US layout, if neither clue of the key is EASCII. This ensures that
272 // there are no non-latin logical keys.
273 // - A value derived on the fly from keycode & keyval.
274 for (uint16_t clue : this_key_clues) {
275 auto matching_goal = remaining_mandatory_goals.find(clue);
276 if (matching_goal != remaining_mandatory_goals.end()) {
277 // Found a key that produces a mandatory char. Use it.
278 g_return_if_fail(fl_keyboard_layout_get_logical_key(
279 self->derived_layout, group, keycode) == 0);
280 fl_keyboard_layout_set_logical_key(self->derived_layout, group, keycode,
281 clue);
282 remaining_mandatory_goals.erase(matching_goal);
283 break;
284 }
285 }
286 bool has_any_eascii =
287 is_eascii(this_key_clues[0]) || is_eascii(this_key_clues[1]);
288 // See if any produced char meets the requirement as a logical key.
289 if (fl_keyboard_layout_get_logical_key(self->derived_layout, group,
290 keycode) == 0 &&
291 !has_any_eascii) {
292 auto found_us_layout = self->keycode_to_goals->find(keycode);
293 if (found_us_layout != self->keycode_to_goals->end()) {
294 fl_keyboard_layout_set_logical_key(
295 self->derived_layout, group, keycode,
296 found_us_layout->second->logical_key);
297 }
298 }
299 }
300
301 // Ensure all mandatory goals are assigned.
302 for (const auto mandatory_goal_iter : remaining_mandatory_goals) {
303 const LayoutGoal* goal = mandatory_goal_iter.second;
304 fl_keyboard_layout_set_logical_key(self->derived_layout, group,
305 goal->keycode, goal->logical_key);
306 }
307 }
308
309 static void fl_keyboard_manager_dispose(GObject* object) {
310 FlKeyboardManager* self = FL_KEYBOARD_MANAGER(object);
311
312 g_cancellable_cancel(self->cancellable);
313
314 self->keycode_to_goals.reset();
315 self->logical_to_mandatory_goals.reset();
316
317 g_clear_pointer(&self->redispatched_key_events, g_ptr_array_unref);
318 g_clear_object(&self->key_embedder_responder);
319 g_clear_object(&self->key_channel_responder);
320 g_clear_object(&self->derived_layout);
321 if (self->keymap_keys_changed_cb_id != 0) {
322 g_signal_handler_disconnect(self->keymap, self->keymap_keys_changed_cb_id);
323 self->keymap_keys_changed_cb_id = 0;
324 }
325 g_clear_object(&self->cancellable);
326
327 G_OBJECT_CLASS(fl_keyboard_manager_parent_class)->dispose(object);
328 }
329
330 static void fl_keyboard_manager_class_init(FlKeyboardManagerClass* klass) {
331 G_OBJECT_CLASS(klass)->dispose = fl_keyboard_manager_dispose;
332 }
333
334 static void fl_keyboard_manager_init(FlKeyboardManager* self) {
335 self->redispatched_key_events =
336 g_ptr_array_new_with_free_func(g_object_unref);
337 self->derived_layout = fl_keyboard_layout_new();
338
339 self->keycode_to_goals =
340 std::make_unique<std::map<uint16_t, const LayoutGoal*>>();
341 self->logical_to_mandatory_goals =
342 std::make_unique<std::map<uint64_t, const LayoutGoal*>>();
343 for (const LayoutGoal& goal : layout_goals) {
344 (*self->keycode_to_goals)[goal.keycode] = &goal;
345 if (goal.mandatory) {
346 (*self->logical_to_mandatory_goals)[goal.logical_key] = &goal;
347 }
348 }
349
350 self->keymap = gdk_keymap_get_for_display(gdk_display_get_default());
351 self->keymap_keys_changed_cb_id = g_signal_connect_swapped(
352 self->keymap, "keys-changed", G_CALLBACK(keymap_keys_changed_cb), self);
353 self->cancellable = g_cancellable_new();
354 }
355
356 FlKeyboardManager* fl_keyboard_manager_new(FlEngine* engine) {
357 FlKeyboardManager* self = FL_KEYBOARD_MANAGER(
358 g_object_new(fl_keyboard_manager_get_type(), nullptr));
359
360 self->key_embedder_responder = fl_key_embedder_responder_new(engine);
361 self->key_channel_responder =
362 fl_key_channel_responder_new(fl_engine_get_binary_messenger(engine));
363
364 return self;
365 }
366
367 void fl_keyboard_manager_add_redispatched_event(FlKeyboardManager* self,
368 FlKeyEvent* event) {
369 g_return_if_fail(FL_IS_KEYBOARD_MANAGER(self));
370
371 g_ptr_array_add(self->redispatched_key_events, g_object_ref(event));
372 }
373
374 void fl_keyboard_manager_handle_event(FlKeyboardManager* self,
375 FlKeyEvent* event,
376 GCancellable* cancellable,
377 GAsyncReadyCallback callback,
378 gpointer user_data) {
379 g_return_if_fail(FL_IS_KEYBOARD_MANAGER(self));
380 g_return_if_fail(event != nullptr);
381
382 g_autoptr(GTask) task = g_task_new(self, cancellable, callback, user_data);
383
384 guarantee_layout(self, event);
385
386 g_task_set_task_data(
387 task, handle_event_data_new(event),
388 reinterpret_cast<GDestroyNotify>(handle_event_data_free));
389
390 if (event_is_redispatched(self, event)) {
391 HandleEventData* data =
392 static_cast<HandleEventData*>(g_task_get_task_data(task));
393 data->handled = TRUE;
394 g_task_return_boolean(task, TRUE);
395 return;
396 }
397
398 uint64_t specified_logical_key = fl_keyboard_layout_get_logical_key(
399 self->derived_layout, fl_key_event_get_group(event),
400 fl_key_event_get_keycode(event));
401 fl_key_embedder_responder_handle_event(
402 self->key_embedder_responder, event, specified_logical_key,
403 self->cancellable, responder_handle_embedder_event_cb,
404 g_object_ref(task));
405 fl_key_channel_responder_handle_event(
406 self->key_channel_responder, event, specified_logical_key,
407 self->cancellable, responder_handle_channel_event_cb, g_object_ref(task));
408 }
409
410 gboolean fl_keyboard_manager_handle_event_finish(
411 FlKeyboardManager* self,
412 GAsyncResult* result,
413 FlKeyEvent** redispatched_event,
414 GError** error) {
415 g_return_val_if_fail(FL_IS_KEYBOARD_MANAGER(self), FALSE);
416 g_return_val_if_fail(g_task_is_valid(result, self), FALSE);
417
418 HandleEventData* data =
419 static_cast<HandleEventData*>(g_task_get_task_data(G_TASK(result)));
420 if (redispatched_event != nullptr && data->redispatch) {
421 *redispatched_event = FL_KEY_EVENT(g_object_ref(data->event));
422 }
423
424 return g_task_propagate_boolean(G_TASK(result), error);
425 }
426
427 void fl_keyboard_manager_sync_modifier_if_needed(FlKeyboardManager* self,
428 guint state,
429 double event_time) {
430 g_return_if_fail(FL_IS_KEYBOARD_MANAGER(self));
431 fl_key_embedder_responder_sync_modifiers_if_needed(
432 self->key_embedder_responder, state, event_time);
433 }
434
435 GHashTable* fl_keyboard_manager_get_pressed_state(FlKeyboardManager* self) {
436 g_return_val_if_fail(FL_IS_KEYBOARD_MANAGER(self), nullptr);
437 return fl_key_embedder_responder_get_pressed_state(
438 self->key_embedder_responder);
439 }
440
441 void fl_keyboard_manager_set_lookup_key_handler(
442 FlKeyboardManager* self,
443 FlKeyboardManagerLookupKeyHandler lookup_key_handler,
444 gpointer user_data) {
445 g_return_if_fail(FL_IS_KEYBOARD_MANAGER(self));
446 self->lookup_key_handler = lookup_key_handler;
447 self->lookup_key_handler_user_data = user_data;
448 }
if
if(end==-1)
Definition: fl_accessible_text_field.cc:42
g_autoptr
g_autoptr(GMutexLocker) locker
TRUE
return TRUE
Definition: fl_compositor_software.cc:68
fl_engine_get_binary_messenger
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:1415
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_key_channel_responder_handle_event
void fl_key_channel_responder_handle_event(FlKeyChannelResponder *self, FlKeyEvent *event, uint64_t specified_logical_key, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_key_channel_responder.cc:71
fl_key_channel_responder_handle_event_finish
gboolean fl_key_channel_responder_handle_event_finish(FlKeyChannelResponder *self, GAsyncResult *result, gboolean *handled, GError **error)
Definition: fl_key_channel_responder.cc:139
fl_key_channel_responder_new
FlKeyChannelResponder * fl_key_channel_responder_new(FlBinaryMessenger *messenger)
Definition: fl_key_channel_responder.cc:59
fl_key_channel_responder.h
fl_key_embedder_responder_get_pressed_state
GHashTable * fl_key_embedder_responder_get_pressed_state(FlKeyEmbedderResponder *self)
Definition: fl_key_embedder_responder.cc:783
fl_key_embedder_responder_sync_modifiers_if_needed
void fl_key_embedder_responder_sync_modifiers_if_needed(FlKeyEmbedderResponder *self, guint state, double event_time)
Definition: fl_key_embedder_responder.cc:774
fl_key_embedder_responder_handle_event
void fl_key_embedder_responder_handle_event(FlKeyEmbedderResponder *self, FlKeyEvent *event, uint64_t specified_logical_key, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_key_embedder_responder.cc:737
fl_key_embedder_responder_handle_event_finish
gboolean fl_key_embedder_responder_handle_event_finish(FlKeyEmbedderResponder *self, GAsyncResult *result, gboolean *handled, GError **error)
Definition: fl_key_embedder_responder.cc:757
fl_key_embedder_responder_new
FlKeyEmbedderResponder * fl_key_embedder_responder_new(FlEngine *engine)
Definition: fl_key_embedder_responder.cc:181
fl_key_embedder_responder.h
fl_key_event_get_keycode
guint16 fl_key_event_get_keycode(FlKeyEvent *self)
Definition: fl_key_event.cc:89
fl_key_event_get_is_press
gboolean fl_key_event_get_is_press(FlKeyEvent *self)
Definition: fl_key_event.cc:84
fl_key_event_get_group
guint8 fl_key_event_get_group(FlKeyEvent *self)
Definition: fl_key_event.cc:104
fl_key_event_get_time
guint32 fl_key_event_get_time(FlKeyEvent *self)
Definition: fl_key_event.cc:79
fl_keyboard_layout_get_logical_key
uint64_t fl_keyboard_layout_get_logical_key(FlKeyboardLayout *self, uint8_t group, uint16_t keycode)
Definition: fl_keyboard_layout.cc:65
fl_keyboard_layout_set_logical_key
void fl_keyboard_layout_set_logical_key(FlKeyboardLayout *self, uint8_t group, uint16_t keycode, uint64_t logical_key)
Definition: fl_keyboard_layout.cc:49
fl_keyboard_layout_new
FlKeyboardLayout * fl_keyboard_layout_new()
Definition: fl_keyboard_layout.cc:40
fl_keyboard_layout_has_group
gboolean fl_keyboard_layout_has_group(FlKeyboardLayout *self, uint8_t group)
Definition: fl_keyboard_layout.cc:45
fl_keyboard_layout.h
fl_keyboard_manager_class_init
static void fl_keyboard_manager_class_init(FlKeyboardManagerClass *klass)
Definition: fl_keyboard_manager.cc:330
fl_keyboard_manager_dispose
static void fl_keyboard_manager_dispose(GObject *object)
Definition: fl_keyboard_manager.cc:309
guarantee_layout
static void guarantee_layout(FlKeyboardManager *self, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:229
fl_keyboard_manager_new
FlKeyboardManager * fl_keyboard_manager_new(FlEngine *engine)
Definition: fl_keyboard_manager.cc:356
responder_handle_channel_event_cb
static void responder_handle_channel_event_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_keyboard_manager.cc:186
G_DEFINE_TYPE
G_DEFINE_TYPE(FlKeyboardManager, fl_keyboard_manager, G_TYPE_OBJECT)
handle_event_data_new
static HandleEventData * handle_event_data_new(FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:71
fl_keyboard_manager_handle_event
void fl_keyboard_manager_handle_event(FlKeyboardManager *self, FlKeyEvent *event, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_keyboard_manager.cc:374
handle_event_data_free
static void handle_event_data_free(HandleEventData *data)
Definition: fl_keyboard_manager.cc:78
convert_key_to_char
static uint16_t convert_key_to_char(FlKeyboardManager *self, guint keycode, gint group, gint level)
Definition: fl_keyboard_manager.cc:212
fl_keyboard_manager_init
static void fl_keyboard_manager_init(FlKeyboardManager *self)
Definition: fl_keyboard_manager.cc:334
responder_handle_embedder_event_cb
static void responder_handle_embedder_event_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_keyboard_manager.cc:160
event_is_redispatched
static gboolean event_is_redispatched(FlKeyboardManager *self, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:123
keymap_keys_changed_cb
static void keymap_keys_changed_cb(FlKeyboardManager *self)
Definition: fl_keyboard_manager.cc:142
fl_keyboard_manager_handle_event_finish
gboolean fl_keyboard_manager_handle_event_finish(FlKeyboardManager *self, GAsyncResult *result, FlKeyEvent **redispatched_event, GError **error)
Definition: fl_keyboard_manager.cc:410
fl_keyboard_manager_set_lookup_key_handler
void fl_keyboard_manager_set_lookup_key_handler(FlKeyboardManager *self, FlKeyboardManagerLookupKeyHandler lookup_key_handler, gpointer user_data)
Definition: fl_keyboard_manager.cc:441
fl_keyboard_manager_get_pressed_state
GHashTable * fl_keyboard_manager_get_pressed_state(FlKeyboardManager *self)
Definition: fl_keyboard_manager.cc:435
complete_handle_event
static void complete_handle_event(FlKeyboardManager *self, GTask *task)
Definition: fl_keyboard_manager.cc:147
fl_keyboard_manager_add_redispatched_event
void fl_keyboard_manager_add_redispatched_event(FlKeyboardManager *self, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:367
fl_keyboard_manager_sync_modifier_if_needed
void fl_keyboard_manager_sync_modifier_if_needed(FlKeyboardManager *self, guint state, double event_time)
Definition: fl_keyboard_manager.cc:427
fl_keyboard_manager.h
FlKeyboardManagerLookupKeyHandler
guint(* FlKeyboardManagerLookupKeyHandler)(const GdkKeymapKey *key, gpointer user_data)
Definition: fl_keyboard_manager.h:118
buffer
static const uint8_t buffer[]
Definition: fl_pixel_buffer_texture_test.cc:44
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
i
int i
Definition: fl_socket_accessible.cc:18
layout_goals
const std::vector< LayoutGoal > layout_goals
Definition: key_mapping.g.cc:462
key_mapping.h
_FlKeyboardManager
Definition: fl_keyboard_manager.cc:83
_FlKeyboardManager::lookup_key_handler_user_data
gpointer lookup_key_handler_user_data
Definition: fl_keyboard_manager.cc:87
_FlKeyboardManager::lookup_key_handler
FlKeyboardManagerLookupKeyHandler lookup_key_handler
Definition: fl_keyboard_manager.cc:86
_FlKeyboardManager::key_channel_responder
FlKeyChannelResponder * key_channel_responder
Definition: fl_keyboard_manager.cc:94
_FlKeyboardManager::logical_to_mandatory_goals
std::unique_ptr< std::map< uint64_t, const LayoutGoal * > > logical_to_mandatory_goals
Definition: fl_keyboard_manager.cc:112
_FlKeyboardManager::key_embedder_responder
FlKeyEmbedderResponder * key_embedder_responder
Definition: fl_keyboard_manager.cc:92
_FlKeyboardManager::redispatched_key_events
GPtrArray * redispatched_key_events
Definition: fl_keyboard_manager.cc:90
_FlKeyboardManager::keycode_to_goals
std::unique_ptr< std::map< uint16_t, const LayoutGoal * > > keycode_to_goals
Definition: fl_keyboard_manager.cc:106
_FlKeyboardManager::cancellable
GCancellable * cancellable
Definition: fl_keyboard_manager.cc:118
_FlKeyboardManager::keymap
GdkKeymap * keymap
Definition: fl_keyboard_manager.cc:114
_FlKeyboardManager::keymap_keys_changed_cb_id
gulong keymap_keys_changed_cb_id
Definition: fl_keyboard_manager.cc:115
_FlKeyboardManager::parent_instance
GObject parent_instance
Definition: fl_keyboard_manager.cc:84
_FlKeyboardManager::derived_layout
FlKeyboardLayout * derived_layout
Definition: fl_keyboard_manager.cc:101
HandleEventData
Definition: fl_keyboard_manager.cc:54
HandleEventData::embedder_responded
gboolean embedder_responded
Definition: fl_keyboard_manager.cc:59
HandleEventData::handled
gboolean handled
Definition: fl_keyboard_manager.cc:68
HandleEventData::event
FlKeyEvent * event
Definition: fl_keyboard_manager.cc:56
HandleEventData::channel_responded
gboolean channel_responded
Definition: fl_keyboard_manager.cc:62
HandleEventData::redispatch
gboolean redispatch
Definition: fl_keyboard_manager.cc:65
LayoutGoal
Definition: key_mapping.h:40
LayoutGoal::keycode
uint16_t keycode
Definition: key_mapping.h:42
LayoutGoal::logical_key
uint64_t logical_key
Definition: key_mapping.h:45