| Flutter Linux Embedder |

Classes | Functions | Variables
fl_keyboard_layout.cc File Reference
`#include "flutter/shell/platform/linux/fl_keyboard_layout.h"`

Go to the source code of this file.

## Classes
struct | _FlKeyboardLayout

## Functions
static void | fl_keyboard_layout_dispose (GObject *object)
static void | fl_keyboard_layout_class_init (FlKeyboardLayoutClass *klass)
static void | fl_keyboard_layout_init (FlKeyboardLayout *self)
FlKeyboardLayout * | fl_keyboard_layout_new ()
gboolean | fl_keyboard_layout_has_group (FlKeyboardLayout *self, uint8_t group)
void | fl_keyboard_layout_set_logical_key (FlKeyboardLayout *self, uint8_t group, uint16_t keycode, uint64_t logical_key)
uint64_t | fl_keyboard_layout_get_logical_key (FlKeyboardLayout *self, uint8_t group, uint16_t keycode)

## Variables
constexpr size_t | kLayoutSize = 128

## Function Documentation

## ◆ fl_keyboard_layout_class_init()

static void fl_keyboard_layout_class_init | ( | FlKeyboardLayoutClass * | klass | ) |
| static

Definition at line 30 of file fl_keyboard_layout.cc.

30 {
31 G_OBJECT_CLASS(klass)->dispose = fl_keyboard_layout_dispose;
32 }
fl_keyboard_layout_dispose
static void fl_keyboard_layout_dispose(GObject *object)
Definition: fl_keyboard_layout.cc:22

References fl_keyboard_layout_dispose().

## ◆ fl_keyboard_layout_dispose()

static void fl_keyboard_layout_dispose | ( | GObject * | object | ) |
| static

Definition at line 22 of file fl_keyboard_layout.cc.

22 {
23 FlKeyboardLayout* self = FL_KEYBOARD_LAYOUT(object);
24
25 g_clear_pointer(&self->groups, g_hash_table_unref);
26
27 G_OBJECT_CLASS(fl_keyboard_layout_parent_class)->dispose(object);
28 }

Referenced by fl_keyboard_layout_class_init().

## ◆ 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_init()

static void fl_keyboard_layout_init | ( | FlKeyboardLayout * | self | ) |
| static

Definition at line 34 of file fl_keyboard_layout.cc.

34 {
35 self->groups = g_hash_table_new_full(
36 g_direct_hash, g_direct_equal, nullptr,
37 reinterpret_cast<GDestroyNotify>(g_hash_table_unref));
38 }

## ◆ 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().

## Variable Documentation

## ◆ kLayoutSize

constexpr size_t kLayoutSize = 128
| constexpr

Definition at line 11 of file fl_keyboard_layout.cc.

Referenced by fl_keyboard_layout_get_logical_key().