layout: Ignore keycodes without corresponding keys

This commit is contained in:
Dorota Czaplejewicz
2019-06-30 20:38:35 +00:00
parent 737d57c1f4
commit baf848c791
2 changed files with 9 additions and 2 deletions

View File

@ -640,13 +640,13 @@ symbols_start_element_callback (GMarkupParseContext *pcontext,
data->key = eek_keyboard_find_key_by_keycode (data->keyboard, data->key = eek_keyboard_find_key_by_keycode (data->keyboard,
keycode); keycode);
if (data->key == NULL) { /*if (data->key == NULL) {
g_set_error (error, g_set_error (error,
G_MARKUP_ERROR, G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT, G_MARKUP_ERROR_INVALID_CONTENT,
"no such keycode %u", keycode); "no such keycode %u", keycode);
return; return;
} }*/
attribute = get_attribute (attribute_names, attribute_values, attribute = get_attribute (attribute_names, attribute_values,
"groups"); "groups");
@ -721,6 +721,10 @@ symbols_end_element_callback (GMarkupParseContext *pcontext,
text = g_strndup (data->text->str, data->text->len); text = g_strndup (data->text->str, data->text->len);
if (g_strcmp0 (element_name, "key") == 0) { if (g_strcmp0 (element_name, "key") == 0) {
if (!data->key) {
return;
}
gint num_symbols = g_slist_length (data->symbols); gint num_symbols = g_slist_length (data->symbols);
gint levels = num_symbols / data->groups; gint levels = num_symbols / data->groups;
EekSymbolMatrix *matrix = eek_symbol_matrix_new (data->groups, EekSymbolMatrix *matrix = eek_symbol_matrix_new (data->groups,

View File

@ -136,6 +136,9 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
} }
} }
keyboard = eek_keyboard_new (self, layout, CSW, CSH); keyboard = eek_keyboard_new (self, layout, CSW, CSH);
if (!keyboard) {
g_error("Failed to create a keyboard");
}
g_object_unref (layout); g_object_unref (layout);
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);