diff -up gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c.gdm-keyboard-layout gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c --- gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c.gdm-keyboard-layout 2008-05-05 01:56:06.000000000 -0400 +++ gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c 2008-05-05 02:04:56.000000000 -0400 @@ -54,6 +54,8 @@ static void *pa_callback_user_data = NUL static const char KNOWN_FILES_KEY[] = "/desktop/gnome/peripherals/keyboard/general/known_file_list"; +static char *gdm_keyboard_layout = NULL; + #define noGSDKX #ifdef GSDKX @@ -137,6 +139,8 @@ apply_xkb_settings (void) { GConfClient *conf_client; GkbdKeyboardConfig current_sys_kbd_config; + GSList *l; + int i; if (!inited_ok) return; @@ -158,6 +162,29 @@ apply_xkb_settings (void) g_free (current_kbd_config.model); current_kbd_config.model = g_strdup ("evdev"); } + + /* Try to keep the same layout from the login screen + */ + if (gdm_keyboard_layout) { + if (current_kbd_config.layouts_variants == NULL) { + current_kbd_config.layouts_variants = g_slist_append (NULL, gdm_keyboard_layout); + gconf_client_set_list (conf_client, + GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, + GCONF_VALUE_STRING, + current_kbd_config.layouts_variants, + NULL); + } + else { + for (i = 0, l = current_kbd_config.layouts_variants; l; i++, l = l->next) { + if (strcmp (gdm_keyboard_layout, l->data) == 0) { + xkl_engine_lock_group (current_config.engine, i); + break; + } + } + } + gdm_keyboard_layout = NULL; + } + /* Activate - only if different! */ if (!gkbd_keyboard_config_equals (¤t_kbd_config, ¤t_sys_kbd_config)) { @@ -312,6 +339,8 @@ gsd_keyboard_xkb_init (GConfClient * cli xkl_set_log_appender (gsd_keyboard_log_appender); #endif + gdm_keyboard_layout = g_getenv ("GDM_KEYBOARD_LAYOUT"); + xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ()); if (xkl_engine) { inited_ok = TRUE;