# Description: Don't force GDM_KEYBOARD_LAYOUT=us if gdm does not have an explicit setting (which it currently doesn't, since there is not even an interface for changing the keyboard layout). Instead, let the GNOME session default to the very same system default as gdm itself.
# Ubuntu: https://launchpad.net/bugs/395103
# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=572765
--- gdm-2.26.1/daemon/gdm-session-direct.c        2009-02-20 03:45:13.000000000 +0100
+++ gdm-2.26.1.new/daemon/gdm-session-direct.c        2009-07-06 15:13:06.589245715 +0200
@@ -602,7 +602,7 @@
                 return session->priv->saved_layout;
     }
 
-    return "us";
+    return "";
 }
 
 static char *
@@ -1957,6 +1957,8 @@
 static void
 setup_session_environment (GdmSessionDirect *session)
 {
+        const char *value;
+
         gdm_session_direct_set_environment_variable (session,
                                                      "GDMSESSION",
                                                      get_session_name (session));
@@ -1971,9 +1973,12 @@
                                                      "GDM_LANG",
                                                      get_language_name (session));
 
-        gdm_session_direct_set_environment_variable (session,
+        value = get_layout_name (session);
+        if (strlen (value) > 0) {
+                gdm_session_direct_set_environment_variable (session,
                                                      "GDM_KEYBOARD_LAYOUT",
-                                                     get_layout_name (session));
+                                                     value);
+        }
 
         gdm_session_direct_set_environment_variable (session,
                                                      "DISPLAY",
