GNOME Bugzilla – Bug 596897
Ignores variants in $GDM_KEYBOARD_LAYOUT
Last modified: 2009-10-19 17:54:34 UTC
This is the counterpart of bug #572765 in gdm. In gdm you can select keyboard layouts including variants, such as "USA Dvorak" or "German with no dead keys". gdm exports the layout in $GDM_KEYBOARD_LAYOUT, with space-separating layout name and variant. E. g. "de nodeadkeys". However, g-s-d does not take this into account. Now that gdm is quite insistant to install its layout (even if you never touched it in gdm) and writes it to ~/.dmrc, this pretty much breaks all layout variants.
Created attachment 144474 [details] [review] fix variant handling in $GDM_KEYBOARD_LAYOUT gdm's configuration and $GDM_KEYBOARD_LAYOUT separates layout and variant with a space, but GConf uses tabs. This patch convert spaces to tabs in $GDM_KEYBOARD_LAYOUT to work with either format, for more robustness. Tested with various cases: $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [us,de nodeadkeys] GDM_KEYBOARD_LAYOUT=="de nodeadkeys" selects the exactly matching layout, and "de" selects the same, in the spirit of the "closest match" code [1]. The inverse case, if you configured [us,de] in gconf, then passing "de nodeadkeys" still will not do anything. This is covered in bug 585290, and is considered "wontfix" (FWIW, I don't quite agree, but let's handle this separately, so my patch doesn't cover this case). It also works correctly if gconf settings are empty ([]), then the "initial configuration" case kicks in [2] and sets gconf to the passed layout, with correct tab separation: $ gconftool -u /desktop/gnome/peripherals/keyboard/kbd/layouts $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [] $ GDM_KEYBOARD_LAYOUT="de nodeadkeys" gnome-settings-daemon --debug --no-daemon [..] $ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts [de nodeadkeys] [1] http://git.gnome.org/cgit/gnome-settings-daemon/tree/plugins/keyboard/gsd-keyboard-xkb.c?id=632055166859aba574b8103a3f3d609c1e130b13#n261 [2] http://git.gnome.org/cgit/gnome-settings-daemon/tree/plugins/keyboard/gsd-keyboard-xkb.c?id=632055166859aba574b8103a3f3d609c1e130b13#n239
Comment on attachment 144474 [details] [review] fix variant handling in $GDM_KEYBOARD_LAYOUT Please commit when the corresponding gdm change goes in. But please don't use nested blocks without braces. Thanks.
(In reply to comment #2) > Please commit when the corresponding gdm change goes in. Please note that these are independent. The gdm patch is about gdm determining the correct default layout for the shown selectors, while this one is about actually using a selected variant. You can select variants in current gdm just fine, they will just not be selected by default if you have a variant in your hal keyboard config. So this patch can be applied independently. Or did you mean something else? I can't commit myself, but I'll ask a colleague of mine to do that after fixing the style issue below. > But please don't use nested blocks without braces. Thanks. Ah, in the for loop? Sure.
Created attachment 145796 [details] [review] fix variant handling in $GDM_KEYBOARD_LAYOUT Same logic, but with fixed indentation and braces style.
Comment on attachment 145796 [details] [review] fix variant handling in $GDM_KEYBOARD_LAYOUT Ah, I thought this depended on some behavioural change in gdm as well. Now, this if (gdm_layout != NULL) { seems to imply that gdm_layout can be NULL, which would break the g_strdup.
How so? g_strdup() works just fine with NULL and returns NULL in that case. http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strdup
Comment on attachment 145796 [details] [review] fix variant handling in $GDM_KEYBOARD_LAYOUT Oh, er, in that case, just go ahead.
Chris commited the fix to GIT: http://git.gnome.org/cgit/gnome-settings-daemon/commit/?id=3d5189d3984980ec97d794f7bde6159bc97e1379 Marking Resolved/Fixed.