diff options
author | Franck Bui <fbui@suse.com> | 2023-04-20 09:47:35 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2023-04-26 08:15:17 +0200 |
commit | b35f71ac1a8b8669cf399711a0396d78581b89eb (patch) | |
tree | 1e8452b70a66ca270eed53f1ec3aca97c374bea5 /src/locale/localed-util.c | |
parent | c821ad7d607b21e807c56d9fa8843821c0fd383e (diff) | |
download | systemd-b35f71ac1a8b8669cf399711a0396d78581b89eb.tar.gz |
locale: when no xvariant match select the entry with an empty xvariant
When doing a conversion and the specified 'xc->xvariant' has no match, select
the x11 layout entry with a matching layout and an empty xvariant if such entry
exists. It's still better than no conversion at all.
Diffstat (limited to 'src/locale/localed-util.c')
-rw-r--r-- | src/locale/localed-util.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c index bcd49fd618..02fac9786b 100644 --- a/src/locale/localed-util.c +++ b/src/locale/localed-util.c @@ -722,6 +722,11 @@ int vconsole_convert_to_x11(const VCContext *vc, X11Context *ret) { /* This sanity check seems redundant with the verification of the X11 layout done on the next * step. However xkbcommon is an optional dependency hence the verification might be a NOP. */ r = find_converted_keymap(&xc, &converted); + if (r == 0 && xc.variant) { + /* If we still haven't find a match, try with no variant, it's still better than nothing. */ + xc.variant = NULL; + r = find_converted_keymap(&xc, &converted); + } if (r < 0) return r; @@ -890,8 +895,17 @@ int x11_convert_to_vconsole(const X11Context *xc, VCContext *ret) { } r = find_converted_keymap(xc, &keymap); - if (r == 0) + if (r == 0) { r = find_legacy_keymap(xc, &keymap); + if (r == 0 && xc->variant) + /* If we still haven't find a match, try with no variant, it's still better than + * nothing. */ + r = find_converted_keymap( + &(X11Context) { + .layout = xc->layout, + }, + &keymap); + } if (r < 0) return r; |