From 19a0f24ad0a819c462595dd59846d0c78a4f75d6 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Thu, 1 Oct 2009 10:49:48 +0200
Subject: [PATCH] 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 | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index 60495dc..9aa59c0 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,16 @@ 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;
layouts = gconf_client_get_list (conf_client,
@@ -276,6 +285,8 @@ apply_xkb_settings (void)
}
}
+ g_free (gdm_layout);
+
if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) {
if (filter_xkb_config ()) {
if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) {
--
1.6.3.3