Bug 47671

Summary: Wrong group gets locked in after login
Product: libxklavier Reporter: Michael Terry <michael.terry>
Component: GeneralAssignee: Sergey V. Udaltsov <svu>
Status: RESOLVED FIXED QA Contact: Sergey V. Udaltsov <svu>
Severity: normal    
Priority: medium CC: bugzilla, martin.pitt
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Michael Terry 2012-03-21 11:29:50 UTC
Originally reported in Ubuntu: https://bugs.launchpad.net/bugs/960096 using libxklavier 5.2.1

We had a problem where after autologin, the wrong keyboard layout group would get selected instead of the default.

Seems to be caused by http://cgit.freedesktop.org/libxklavier/commit/?id=18e75ba865e5f23b5e0b6926cc20ee82b0782084

To reproduce:
1) gsettings set org.gnome.libgnomekbd.keyboard layouts "['it','it\tnodeadkeys','it\tus']"
2) startx # assuming this launches GNOME Shell or Unity, haven't tested other environments)

Notice that your layout ends up being "it\tus" instead of "it".  If you instead set your layouts to ['it','it\tnodeadkeys','it\tmac'], you DO NOT get the bug.  That is, libxklavier is matching against the 'us' part of 'it\tus' for some reason.
Comment 1 Sergey V. Udaltsov 2012-03-24 17:47:57 UTC
If you disable autologin - what is the layout used in GDM?
Comment 2 Michael Terry 2012-03-26 09:51:25 UTC
I'm not sure.  Ubuntu doesn't use GDM by default.  LightDM happens to do the right thing, and leaves the layout correct when it starts the user session, which is why the Ubuntu bug mentions autologin.

But autologin is a bit of a red herring, because the reproduction steps I gave don't involve a display manager at all, just startx.
Comment 3 Sergey V. Udaltsov 2012-05-05 02:09:18 UTC
I guess it is a (patched?) g-s-d. I tried to reproduce in FC16 - and my first layout is ‘it‘.
Please file a bug against g-s-d - but first check if it is reproducible in other distros
Comment 4 Sergey V. Udaltsov 2012-05-05 02:15:03 UTC
I now managed to reproduce it in FC - but still it is an issue with gnome-settings-daemon
Comment 5 Sergey V. Udaltsov 2012-05-05 02:22:05 UTC
I guess it is the same as https://bugzilla.gnome.org/show_bug.cgi?id=671880

Actually, just running

gsettings set org.gnome.libgnomekbd.keyboard layouts "['us','ru']"
gsettings set org.gnome.libgnomekbd.keyboard layouts "['it','it\tnodeadkeys','it\tus']"

selects 3rd italian layout. For some reason.
Comment 6 Sergey V. Udaltsov 2012-05-06 00:18:27 UTC
It is in libxklavier indeed. Investigating. Fixing.
Comment 7 Sergey V. Udaltsov 2012-05-06 18:59:57 UTC
Perhaps even deeper, in X.Org. It seems XOrg has issue loading keymaps generated by libxklavier. For example, that one:

xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete" };
        xkb_compat    { include "complete" };
        xkb_symbols   { include "pc+it+it(nodeadkeys):2+it(us):3+inet(evdev)+group(rctrl_toggle)+srvr_ctrl(no_srvr_keys)" };
        xkb_geometry  { include "pc(pc104)" };
};

Could please anyone having that issue try to load that keymap to X without GNOME ("xkbcomp input.xkb :0"). And then check the resulting group names: "xkbcomp :0 -xkb - | grep name"). What names do you see for groups 1-3?

I see a very strange thing:

    name[group1]="Italian";
    name[group2]="Italian (eliminate dead keys)";
    name[group3]="English (US)";

Instead of

    name[group1]="Italian";
    name[group2]="Italian (eliminate dead keys)";
    name[group3]="Italian (US keyboard with Italian letters)";

What are your results?
Comment 8 Sergey V. Udaltsov 2012-05-06 19:10:48 UTC
Stupid me!

Here is the answer. Try to change

    name[Group1]= "Italian (US keyboard with Italian letters)";

    include "us(euro)"

to

    include "us(euro)"

    name[Group1]= "Italian (US keyboard with Italian letters)";

in /usr/share/X11/xkb/symbols/it.

It works for me.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.