X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flocaled.c;h=c6b48de5f9c0c3e68136d5121062c976e3aa85c1;hb=4d8a7798e7f12c6400495cbc4d0ad57ed20ce90a;hp=16557b6f2b50cca560df9f45a02a3ba8e819d668;hpb=fb9de93dd3587e62e0fc0413673c98ea709c5a2f;p=elogind.git diff --git a/src/localed.c b/src/localed.c index 16557b6f2..c6b48de5f 100644 --- a/src/localed.c +++ b/src/localed.c @@ -574,6 +574,10 @@ static int write_data_x11(void) { #ifdef TARGET_FEDORA unlink("/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf"); + + /* Symlink this to /dev/null, so that s-s-k (if it is + * still running) doesn't recreate this. */ + symlink("/dev/null", "/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf"); #endif if (unlink("/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) @@ -619,6 +623,10 @@ static int write_data_x11(void) { #ifdef TARGET_FEDORA unlink("/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf"); + + /* Symlink this to /dev/null, so that s-s-k (if it is + * still running) doesn't recreate this. */ + symlink("/dev/null", "/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf"); #endif r = 0; @@ -860,18 +868,46 @@ static int convert_x11_to_vconsole(DBusConnection *connection) { break; /* Determine how well matching this entry is */ - if (streq_ptr(x11_layout, a[1])) { - matching ++; + if (streq_ptr(x11_layout, a[1])) + /* If we got an exact match, this is best */ + matching = 10; + else { + size_t x; + + 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 (streq_ptr(x11_model, a[2])) { + if (matching > 0 && + streq_ptr(x11_model, a[2])) { + matching++; + + if (streq_ptr(x11_variant, a[3])) { matching++; - if (streq_ptr(x11_variant, a[3])) { + if (streq_ptr(x11_options, a[4])) matching++; - - if (streq_ptr(x11_options, a[4])) - matching++; - } } }