Pick up keyboard layouts from the login screen

This commit is contained in:
Matthias Clasen 2008-05-05 17:44:53 +00:00
parent 428f352426
commit 0edf42b3eb
2 changed files with 67 additions and 1 deletions

60
gdm-keyboard-layout.patch Normal file
View File

@ -0,0 +1,60 @@
diff -up gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c.gdm-keyboard-layout gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c
--- gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c.gdm-keyboard-layout 2008-05-05 01:56:06.000000000 -0400
+++ gnome-settings-daemon-2.22.1/plugins/keyboard/gsd-keyboard-xkb.c 2008-05-05 02:04:56.000000000 -0400
@@ -54,6 +54,8 @@ static void *pa_callback_user_data = NUL
static const char KNOWN_FILES_KEY[] =
"/desktop/gnome/peripherals/keyboard/general/known_file_list";
+static char *gdm_keyboard_layout = NULL;
+
#define noGSDKX
#ifdef GSDKX
@@ -137,6 +139,8 @@ apply_xkb_settings (void)
{
GConfClient *conf_client;
GkbdKeyboardConfig current_sys_kbd_config;
+ GSList *l;
+ int i;
if (!inited_ok)
return;
@@ -158,6 +162,29 @@ apply_xkb_settings (void)
g_free (current_kbd_config.model);
current_kbd_config.model = g_strdup ("evdev");
}
+
+ /* Try to keep the same layout from the login screen
+ */
+ if (gdm_keyboard_layout) {
+ if (current_kbd_config.layouts_variants == NULL) {
+ current_kbd_config.layouts_variants = g_slist_append (NULL, gdm_keyboard_layout);
+ gconf_client_set_list (conf_client,
+ GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
+ GCONF_VALUE_STRING,
+ current_kbd_config.layouts_variants,
+ NULL);
+ }
+ else {
+ for (i = 0, l = current_kbd_config.layouts_variants; l; i++, l = l->next) {
+ if (strcmp (gdm_keyboard_layout, l->data) == 0) {
+ xkl_engine_lock_group (current_config.engine, i);
+ break;
+ }
+ }
+ }
+ gdm_keyboard_layout = NULL;
+ }
+
/* Activate - only if different! */
if (!gkbd_keyboard_config_equals
(&current_kbd_config, &current_sys_kbd_config)) {
@@ -312,6 +339,8 @@ gsd_keyboard_xkb_init (GConfClient * cli
xkl_set_log_appender (gsd_keyboard_log_appender);
#endif
+ gdm_keyboard_layout = g_getenv ("GDM_KEYBOARD_LAYOUT");
+
xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ());
if (xkl_engine) {
inited_ok = TRUE;

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.23.1.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -41,6 +41,8 @@ Patch5: xrandr-missingok.patch
Patch6: gsd-handle-different-keysyms.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=531487
Patch7: gnome-settings-daemon-background-without-nautilus.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=531589
Patch8: gdm-keyboard-layout.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -69,6 +71,7 @@ popd
%patch5 -p1 -b .xrandr-missingok
%patch6 -p1 -b .multi-keysyms
%patch7 -p1 -b .background-without-nautilus
%patch8 -p1 -b .gdm-keyboard-layout
%build
%configure --enable-static=no --enable-profiling
@ -151,6 +154,9 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Mon May 5 2008 Matthias Clasen <mclasen@redhat.com> - 2.23.1-1-4
- Pick up the keyboard layout from the login screen
* Mon May 5 2008 Matthias Clasen <mclasen@redhat.com> - 2.23.1-1-3
- Fix background drawing without nautilus