[gnome-settings-daemon] fix variant handling in $GDM_KEYBOARD_LAYOUT



commit 3d5189d3984980ec97d794f7bde6159bc97e1379
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Mon Oct 19 18:59:07 2009 +0200

    fix variant handling in $GDM_KEYBOARD_LAYOUT
    
    gdm's configuration and $GDM_KEYBOARD_LAYOUT separates layout and
    variant with a space, but GConf uses tabs. Convert spaces to tabs in
    $GDM_KEYBOARD_LAYOUT to work with either format, for more robustness.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596897

 plugins/keyboard/gsd-keyboard-xkb.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index f839aee..cb969e3 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -217,7 +217,8 @@ apply_xkb_settings (void)
 	GConfClient *conf_client;
 	GkbdKeyboardConfig current_sys_kbd_config;
 	int group_to_activate = -1;
-	const char *gdm_layout;
+	char *gdm_layout;
+	char *s;
 
 	if (!inited_ok)
 		return;
@@ -229,8 +230,18 @@ apply_xkb_settings (void)
 	 * We clear gdm_keyboard_layout early, so we don't risk
 	 * recursion from gconf notification.
 	 */
-	gdm_layout = gdm_keyboard_layout;
+	gdm_layout = g_strdup (gdm_keyboard_layout);
 	gdm_keyboard_layout = NULL;
+
+	/* gdm's configuration and $GDM_KEYBOARD_LAYOUT separates layout and
+	 * variant with a space, but gconf uses tabs; so convert to be robust
+	 * with both */
+	for (s = gdm_layout; s && *s; ++s) {
+		if (*s == ' ') {
+			*s = '\t';
+		}
+	}
+
 	if (gdm_layout != NULL) {
 		GSList *layouts;
 		GSList *found_node;
@@ -302,6 +313,8 @@ apply_xkb_settings (void)
 		}
 	}
 
+	g_free (gdm_layout);
+
 	if (!try_activating_xkb_config_if_new (&current_sys_kbd_config)) {
 		if (filter_xkb_config ()) {
 			if (!try_activating_xkb_config_if_new (&current_sys_kbd_config)) {



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