20 G_DEFINE_TYPE(FlKeyboardLayout, fl_keyboard_layout, G_TYPE_OBJECT)
23 FlKeyboardLayout*
self = FL_KEYBOARD_LAYOUT(
object);
25 g_clear_pointer(&self->groups, g_hash_table_unref);
27 G_OBJECT_CLASS(fl_keyboard_layout_parent_class)->dispose(
object);
35 self->groups = g_hash_table_new_full(
36 g_direct_hash, g_direct_equal,
nullptr,
37 reinterpret_cast<GDestroyNotify
>(g_hash_table_unref));
41 return FL_KEYBOARD_LAYOUT(
42 g_object_new(fl_keyboard_layout_get_type(),
nullptr));
46 return g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)) !=
nullptr;
52 uint64_t logical_key) {
53 GHashTable* group_layout =
static_cast<GHashTable*
>(
54 g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)));
55 if (group_layout ==
nullptr) {
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);
61 g_hash_table_insert(group_layout, GINT_TO_POINTER(keycode),
62 GINT_TO_POINTER(logical_key));
72 GHashTable* group_layout =
static_cast<GHashTable*
>(
73 g_hash_table_lookup(self->groups, GINT_TO_POINTER(group)));
74 if (group_layout ==
nullptr) {
78 return GPOINTER_TO_INT(
79 g_hash_table_lookup(group_layout, GINT_TO_POINTER(keycode)));