--- gnome-settings-daemon-3.10.2/plugins/keyboard/gsd-keyboard-manager.c.hk 2013-11-11 21:25:13.000000000 +0400 +++ gnome-settings-daemon-3.10.2/plugins/keyboard/gsd-keyboard-manager.c 2013-11-27 21:08:15.649850908 +0400 @@ -149,6 +149,8 @@ static gpointer manager_object = NULL; +static guint group_position = 0; + static void init_builder_with_sources (GVariantBuilder *builder, GSettings *settings) @@ -641,10 +643,9 @@ XkbDescRec *xkb_desc; gchar *rules_file; - /* The layout we want is always in the first XKB group index - * so we should enforce it to make sure we never end up with - * the wrong one. */ - XkbLockGroup (display, XkbUseCoreKbd, 0); + /* The index of layout we want is saved in the group_position + * variable. */ + XkbLockGroup (display, XkbUseCoreKbd, group_position); /* Upload it to the X server using the same method as setxkbmap */ xkb_desc = XkbGetKeyboardByName (display, @@ -677,10 +678,13 @@ gsize length = 0; guint commas = 2; - if (latin) + if (latin) { length += strlen (latin); - else + group_position = 1; + } else { commas -= 1; + group_position = 0; + } if (locale) length += strlen (locale); @@ -692,11 +696,11 @@ string = malloc (length); if (locale && latin) - sprintf (string, "%s,%s,%s", user, locale, latin); + sprintf (string, "%s,%s,%s", latin, user, locale); else if (locale) sprintf (string, "%s,%s", user, locale); else if (latin) - sprintf (string, "%s,%s", user, latin); + sprintf (string, "%s,%s", latin, user); else sprintf (string, "%s", user);