diff -up gnome-settings-daemon-2.24.0/plugins/keyboard/gsd-keyboard-xkb.c.fix-gdm-layout-even-more gnome-settings-daemon-2.24.0/plugins/keyboard/gsd-keyboard-xkb.c --- gnome-settings-daemon-2.24.0/plugins/keyboard/gsd-keyboard-xkb.c.fix-gdm-layout-even-more 2008-10-10 21:52:55.000000000 -0400 +++ gnome-settings-daemon-2.24.0/plugins/keyboard/gsd-keyboard-xkb.c 2008-10-10 22:25:28.000000000 -0400 @@ -162,14 +162,27 @@ apply_xkb_settings (void) /* With GDM the user can already set a layout from the login * screen. Try to keep that setting */ if (gdm_keyboard_layout != NULL) { + /* if there is just a single layout, + * just override it (it is probably the X server default) + */ + if (current_kbd_config.layouts_variants && + current_kbd_config.layouts_variants->next == NULL) { + g_free (current_kbd_config.layouts_variants->data); + g_slist_free (current_kbd_config.layouts_variants); + current_kbd_config.layouts_variants = NULL; + } if (current_kbd_config.layouts_variants == NULL) { - current_kbd_config.layouts_variants = g_slist_append (NULL, (char *) gdm_keyboard_layout); + current_kbd_config.layouts_variants = g_slist_append (NULL, g_strdup (gdm_keyboard_layout)); gconf_client_set_list (conf_client, GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, GCONF_VALUE_STRING, current_kbd_config.layouts_variants, NULL); - } else { + } + else { + /* if there are multiple layouts, + * try to find the one closest to the gdm layout + */ GSList *l; int i; size_t len = strlen (gdm_keyboard_layout);