[gnome-settings-daemon] Default to system settings for handling multiple keyboard layouts



commit 91e59a768460eda2e4154ea6e27231cdc94de5c2
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Tue Mar 23 15:12:41 2010 +0100

    Default to system settings for handling multiple keyboard layouts
    
    Take configured system keyboard layouts into account if the user does not have
    any configured layouts in gconf.
    
    This fixes situations where the system configures multiple layouts by default
    (like "us,gr"). This is important for non-Latin languages. E. g. if you
    normally use a Russian, Greek, or Hebrew layout, you always need an additional
    alternative Latin layout (usually US) to be able to enter URLs, use keyboard
    shortcuts and the like.
    
    Instead of just relying on $GDM_KEYBOARD_LAYOUT, make all system layouts
    available, so that users do not need to reconfigure their keyboard layouts if
    it's already done on the system level.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=613666
    Bug-Ubuntu: https://launchpad.net/bugs/460328

 plugins/keyboard/gsd-keyboard-xkb.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index 62101ab..753af39 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -595,6 +595,23 @@ apply_xkb_settings (void)
 						 GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
 						 GCONF_VALUE_STRING, NULL);
 
+		/* Use system layouts as a default if we do not have
+		 * user configuration */
+		if (layouts == NULL) {
+			GSList *i;
+			int len;
+
+			for (i = initial_sys_kbd_config.layouts_variants; i; i = g_slist_next (i)) {
+				s = g_strdup (i->data);
+
+				/* chop off empty variants to avoid duplicates */
+				len = strlen (s);
+				if (s[len - 1] == '\t')
+					s[len - 1] = '\0';
+				layouts = g_slist_append (layouts, s);
+			}
+		}
+
 		/* Add the layout if it doesn't already exist. XKB limits the
 		 * total number of layouts. If we already have the maximum
 		 * number of layouts configured, we replace the last one. This



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]