mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 01:27:11 +03:00
localed: handle multiple X11 kbd layouts
https://bugs.freedesktop.org/show_bug.cgi?id=41341
This commit is contained in:
parent
f176b5c296
commit
a0ccd2acab
@ -860,18 +860,46 @@ static int convert_x11_to_vconsole(DBusConnection *connection) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* Determine how well matching this entry is */
|
/* Determine how well matching this entry is */
|
||||||
if (streq_ptr(x11_layout, a[1])) {
|
if (streq_ptr(x11_layout, a[1]))
|
||||||
matching ++;
|
/* If we got an exact match, this is best */
|
||||||
|
matching = 10;
|
||||||
|
else {
|
||||||
|
size_t x;
|
||||||
|
|
||||||
if (streq_ptr(x11_model, a[2])) {
|
x = strcspn(x11_layout, ",");
|
||||||
|
|
||||||
|
/* We have multiple X layouts, look
|
||||||
|
* for an entry that matches our key
|
||||||
|
* with the everything but the first
|
||||||
|
* layout stripped off. */
|
||||||
|
if (x > 0 &&
|
||||||
|
strlen(a[1]) == x &&
|
||||||
|
strncmp(x11_layout, a[1], x) == 0)
|
||||||
|
matching = 5;
|
||||||
|
else {
|
||||||
|
size_t w;
|
||||||
|
|
||||||
|
/* If that didn't work, strip
|
||||||
|
* off the other layouts from
|
||||||
|
* the entry, too */
|
||||||
|
|
||||||
|
w = strcspn(a[1], ",");
|
||||||
|
|
||||||
|
if (x > 0 && x == w &&
|
||||||
|
memcmp(x11_layout, a[1], x) == 0)
|
||||||
|
matching = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matching > 0 &&
|
||||||
|
streq_ptr(x11_model, a[2])) {
|
||||||
|
matching++;
|
||||||
|
|
||||||
|
if (streq_ptr(x11_variant, a[3])) {
|
||||||
matching++;
|
matching++;
|
||||||
|
|
||||||
if (streq_ptr(x11_variant, a[3])) {
|
if (streq_ptr(x11_options, a[4]))
|
||||||
matching++;
|
matching++;
|
||||||
|
|
||||||
if (streq_ptr(x11_options, a[4]))
|
|
||||||
matching++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user