GNOME Bugzilla – Bug 613775
Reordering keyboard layouts adds tabs to gconf keys and thus duplication
Last modified: 2010-04-19 14:12:12 UTC
(From https://launchpad.net/bugs/460328): There is currently an inconsistency in how g-keyboard-properties and gdm/g-s-d's $GDM_KEYBOARD_LAYOUT handle keyboard layouts without variants. gdm/gsd create them just like "us", while g-k-p creates them as "us\t" after reordering. Reproduction: $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [de nodeadkeys,us] Open g-k-p, move "USA" to top $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us ,de nodeadkeys] Now restart the session, or just restart gnome-settings-daemon: $ echo $GDM_KEYBOARD_LAYOUT us $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us ,de nodeadkeys,us]
Sorry, I mixed that up, bad copy&paste. It only really happens if the gconf value is empty and g-k-p initializes it. I have two keyboard layouts configured system-wide: "us" and "de nodeadkeys": _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "de,us", "nodeadkeys,", "terminate:ctrl_alt_bksp,grp:shifts_toggle" $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [] Open g-k-p, move "USA" to top $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us ,de nodeadkeys] So this is only a problem with handling multiple keyboard layouts with empty gconf keys, and thus one aspect of the problems in bug 613666 and bug 613681.
Created attachment 156948 [details] [review] keyboard: Fix layout gconf key initialization for empty variants With this patch, gconf keys are now consistent to g-s-d's understanding and creation of them: $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [] ... Switch layouts in g-k-p ... $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us,de nodeadkeys]
Martin, this is somewhat suspicions. How happened that g-k-p creates layouts with tabs without variants? I have two layouts, us and ru. I see no tabs at all. $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us,de nodeadkeys,ru] How could I reproduce your scenario?
Sergey, it should reproduce well with comment 1: - set up multiple system layouts (in Ubuntu that's in /etc/default/console-setup, Fedora has a similar file, but a different path) - Remove the user configuration for the layouts: gconftool -u /desktop/gnome/peripherals/keyboard/kbd/layouts - This will trigger the case in xkb_layouts_get_selected_list() where the gconf list is empty, and it reads the list of layouts from initial_config.layouts_variants (which apparently uses trailing tabs)
.. sorry, hit enter too early. After that, open g-k-p and switch the layout order.
I configured console-setup to use layout us,ru, then cleaned up gconf, then rebooed. After I logged in (using gdm) I immediately got single layout 'us' in gconf (that's ok, that's g-s-d copied the value from gdm). Then, I cleared gconf again, started g-k-p, now see two layouts (right, as configured in console-setup). Then I used drug/drop to switch layouts. It just works! No tabs in gconf - only [us,ru] :(( What do you have in your console-setup? Also, could you please do "xprop -root | grep XKB"
Sergey, on what version do you do the testing? lucid has the change discussed there so it's not good for testing the issue
I run it on 9.10
(In reply to comment #6) > What do you have in your console-setup? XKBMODEL="pc105" XKBLAYOUT="de,us" XKBVARIANT="nodeadkeys," XKBOPTIONS="" > Also, could you please do "xprop -root | grep XKB" See comment 1: _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "de,us", "nodeadkeys,", "terminate:ctrl_alt_bksp,grp:shifts_toggle" The difference is that I have XKBVARIANT="nodeadkeys," I suppose libgnomekbd splits on commas and thus interprets the variant for "us" as "" instead of NULL. It does work fine with XKBLAYOUT="de,us" and XKBVARIANT="".
Actually, Martin, with your patch to #613666, did anything change in relation to this bug?
(In reply to comment #10) > Actually, Martin, with your patch to #613666, did anything change in relation > to this bug? Kind of. Before bug 613666 got fixed, it was impossible to have multiple keyboard layouts and an empty gconf key for the layouts. Now it is possible (and in fact the common case), which lead to exhibiting this bug here. BTW, the XKBLAYOUT="de,us" XKBVARIANT="nodeadkeys," case might still be considered debatable, since we could in theory fix installers etc. to not append a trailing comma. However, (1) we should be robust for that in control-center, and (2) we need to cope with empty (not NULL) variants in control-center anyway for the reverse case: XKBLAYOUT="us,de" XKBVARIANT=",nodeadkeys" Here we always need the initial comma to state that "nodeadkeys" applies to the second layout, not the first.
I tried to make it simpler: http://git.gnome.org/browse/libgnomekbd/commit/?id=9e641dbb82242a450aaabcba3b052e694fd0fadb (actually there is unneeded debug printf, next commit drops it). Could you please check if it fixes this bug?
Confirmed, this fixes it as well. Thanks!