summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorM Hickford <mirth.hickford@gmail.com>2022-01-24 02:16:08 +0100
committerGitHub <noreply@github.com>2022-01-24 11:16:08 +1000
commitefa99624320f54e6e1ff24e4c4b1fcecdfba43d5 (patch)
treeafe734a69b090dd0c3e4f4cd05029113e2afdc03 /src
parent9b05825e534ee4e4b2206fffcfbabbafdc69471d (diff)
downloadxorg-lib-libxkbcommon-efa99624320f54e6e1ff24e4c4b1fcecdfba43d5.tar.gz
Variants should inherit iso639, iso3166 and brief from parent layout if omitted (#266)
Diffstat (limited to 'src')
-rw-r--r--src/registry.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/registry.c b/src/registry.c
index 65c2ed1..dbaac2a 100644
--- a/src/registry.c
+++ b/src/registry.c
@@ -870,7 +870,8 @@ parse_variant(struct rxkb_context *ctx, struct rxkb_layout *l,
v->name = strdup(l->name);
v->variant = name;
v->description = description;
- v->brief = brief;
+ // if variant omits brief, inherit from parent layout.
+ v->brief = brief == NULL ? strdup_safe(l->brief) : brief;
v->popularity = popularity;
list_append(&ctx->layouts, &v->base.link);
@@ -880,11 +881,35 @@ parse_variant(struct rxkb_context *ctx, struct rxkb_layout *l,
if (!is_node(ci, "configItem"))
continue;
+ bool found_language_list = false;
+ bool found_country_list = false;
for (node = ci->children; node; node = node->next) {
- if (is_node(node, "languageList"))
+ if (is_node(node, "languageList")) {
parse_language_list(node, v);
- if (is_node(node, "countryList"))
+ found_language_list = true;
+ }
+ if (is_node(node, "countryList")) {
parse_country_list(node, v);
+ found_country_list = true;
+ }
+ }
+ if (!found_language_list) {
+ // inherit from parent layout
+ struct rxkb_iso639_code* x;
+ list_for_each(x, &l->iso639s, base.link) {
+ struct rxkb_iso639_code* code = rxkb_iso639_code_create(&v->base);
+ code->code = strdup(x->code);
+ list_append(&v->iso639s, &code->base.link);
+ }
+ }
+ if (!found_country_list) {
+ // inherit from parent layout
+ struct rxkb_iso3166_code* x;
+ list_for_each(x, &l->iso3166s, base.link) {
+ struct rxkb_iso3166_code* code = rxkb_iso3166_code_create(&v->base);
+ code->code = strdup(x->code);
+ list_append(&v->iso3166s, &code->base.link);
+ }
}
}
} else {