| Flutter Linux Embedder |

Functions
fl_keyboard_layout.h File Reference
`#include <glib-object.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS | G_DECLARE_FINAL_TYPE (FlKeyboardLayout, fl_keyboard_layout, FL, KEYBOARD_LAYOUT, GObject)
FlKeyboardLayout * | fl_keyboard_layout_new ()
gboolean | fl_keyboard_layout_has_group (FlKeyboardLayout *layout, uint8_t group)
void | fl_keyboard_layout_set_logical_key (FlKeyboardLayout *layout, uint8_t group, uint16_t keycode, uint64_t logical_key)
uint64_t | fl_keyboard_layout_get_logical_key (FlKeyboardLayout *layout, uint8_t group, uint16_t keycode)

## Function Documentation

## ◆ fl_keyboard_layout_get_logical_key()

uint64_t fl_keyboard_layout_get_logical_key | ( | FlKeyboardLayout * | layout,
|  | uint8_t | group,
|  | uint16_t | keycode
| ) |  |

fl_keyboard_layout_get_logical_key: @layout: a #FlKeyboardLayout. @group: a key group. @keycode: a keycode.

Gets the logical key for the given group and keycode.

Returns: the logical keycode or 0 if not set.

Definition at line 65 of file fl_keyboard_layout.cc.

67 {
68 if (keycode >= kLayoutSize) {
69 return 0;
70 }
71
72 GHashTable* group_layout = static_cast<GHashTable*>(
73 g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)));
74 if (group_layout == nullptr) {
75 return 0;
76 }
77
78 return GPOINTER_TO_INT(
79 g_hash_table_lookup(group_layout, GINT_TO_POINTER(keycode)));
80 }
kLayoutSize
constexpr size_t kLayoutSize
Definition: fl_keyboard_layout.cc:11

References kLayoutSize.

Referenced by fl_keyboard_manager_handle_event(), guarantee_layout(), and TEST().

## ◆ fl_keyboard_layout_has_group()

gboolean fl_keyboard_layout_has_group | ( | FlKeyboardLayout * | layout,
|  | uint8_t | group
| ) |  |

fl_keyboard_layout_has_group: @layout: a #FlKeyboardLayout. @group: a key group.

Checks if a group is present in this layout.

Returns: TRUE if this group is present.

Definition at line 45 of file fl_keyboard_layout.cc.

45 {
46 return g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)) != nullptr;
47 }

Referenced by guarantee_layout(), and TEST().

## ◆ fl_keyboard_layout_new()

FlKeyboardLayout* fl_keyboard_layout_new | ( |  | ) |

FlKeyboardLayout: Tracks keycode to to logical key mappings for #FlKeyboardHandler fl_keyboard_layout_new:

Create a new #FlKeyboardLayout.

Returns: a new #FlKeyboardLayout.

Definition at line 40 of file fl_keyboard_layout.cc.

40 {
41 return FL_KEYBOARD_LAYOUT(
42 g_object_new(fl_keyboard_layout_get_type(), nullptr));
43 }

Referenced by fl_keyboard_manager_init(), keymap_keys_changed_cb(), and TEST().

## ◆ fl_keyboard_layout_set_logical_key()

void fl_keyboard_layout_set_logical_key | ( | FlKeyboardLayout * | layout,
|  | uint8_t | group,
|  | uint16_t | keycode,
|  | uint64_t | logical_key
| ) |  |

fl_keyboard_layout_has_group: @layout: a #FlKeyboardLayout. @group: a key group. @logical_key: a logical keycode.

Sets the logical key for a given group and keycode.

Definition at line 49 of file fl_keyboard_layout.cc.

52 {
53 GHashTable* group_layout = static_cast<GHashTable*>(
54 g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)));
55 if (group_layout == nullptr) {
56 group_layout =
57 g_hash_table_new_full(g_direct_hash, g_direct_equal, nullptr, nullptr);
58 g_hash_table_insert(self->groups, GINT_TO_POINTER(group), group_layout);
59 }
60
61 g_hash_table_insert(group_layout, GINT_TO_POINTER(keycode),
62 GINT_TO_POINTER(logical_key));
63 }

Referenced by guarantee_layout(), and TEST().

## ◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE | ( | FlKeyboardLayout | ,
|  | fl_keyboard_layout | ,
|  | FL | ,
|  | KEYBOARD_LAYOUT | ,
|  | GObject |
| ) |  |