respect system keyboard setting

This commit is contained in:
Matthias Clasen 2008-10-20 16:16:24 +00:00
parent 1429e32712
commit 82bbd34eeb
2 changed files with 82 additions and 1 deletions

73
gdm-system-keyboard.patch Normal file
View File

@ -0,0 +1,73 @@
--- gdm-2.24.0/daemon/gdm-session-direct.c 2008-08-21 00:31:47.000000000 -0400
+++ hacked/daemon/gdm-session-direct.c 2008-10-20 00:20:05.000000000 -0400
@@ -595,14 +595,41 @@
return setlocale (LC_MESSAGES, NULL);
}
+static char *
+get_system_default_layout (void)
+{
+ gchar *text, *p, *q;
+ gsize *length;
+ char *result;
+
+ result = NULL;
+ if (g_file_get_contents ("/etc/sysconfig/keyboard", &text, &length, NULL)) {
+ p = strstr (text, "KEYTABLE=\"");
+ if (p) {
+ p += strlen ("KEYTABLE=\"");
+ q = strchr (p, '"');
+ if (q) {
+ result = g_strndup (p, q - p);
+ }
+ }
+ g_free (text);
+ }
+
+ if (!result) {
+ result = g_strdup ("us");
+ }
+
+ return result;
+}
+
static const char *
get_default_layout_name (GdmSessionDirect *session)
{
- if (session->priv->saved_layout != NULL) {
- return session->priv->saved_layout;
+ if (!session->priv->saved_layout) {
+ session->priv->saved_layout = get_system_default_layout ();
}
- return "us";
+ return session->priv->saved_layout;
}
static char *
@@ -1971,9 +1998,10 @@
"GDM_LANG",
get_language_name (session));
- gdm_session_direct_set_environment_variable (session,
- "GDM_KEYBOARD_LAYOUT",
- get_layout_name (session));
+ if (g_strcmp0 (get_layout_name (session), get_system_default_layout ()) != 0)
+ gdm_session_direct_set_environment_variable (session,
+ "GDM_KEYBOARD_LAYOUT",
+ get_layout_name (session));
gdm_session_direct_set_environment_variable (session,
"DISPLAY",
--- gdm-2.24.0/daemon/gdm-session-settings.c 2008-07-10 11:07:42.000000000 -0400
+++ hacked/daemon/gdm-session-settings.c 2008-10-19 23:55:02.000000000 -0400
@@ -149,8 +149,7 @@
{
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
- if (settings->priv->layout_name == NULL ||
- strcmp (settings->priv->layout_name, layout_name) != 0) {
+ if (g_strcmp0 (settings->priv->layout_name, layout_name) != 0) {
settings->priv->layout_name = g_strdup (layout_name);
g_object_notify (G_OBJECT (settings), "layout-name");
}

View File

@ -16,7 +16,7 @@
Summary: The GNOME Display Manager
Name: gdm
Version: 2.24.0
Release: 10%{?dist}
Release: 11%{?dist}
Epoch: 1
License: GPLv2+
Group: User Interface/X
@ -100,6 +100,10 @@ Patch11: gdm-2.24.0-add-panel-slide.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=465121
Patch12: gdm-user-switcher-no-help.patch
# uses /etc/sysconfig/keyboard and is thus not directly upstreamable
# should probably be changed to get the system layout from the X server
Patch13: gdm-system-keyboard.patch
# Fedora-specific
Patch99: gdm-2.23.1-fedora-logo.patch
@ -132,6 +136,7 @@ multiple simulanteous logged in users.
%patch10 -p1 -b .fix-icon-scale
%patch11 -p1 -b .add-panel-slide
%patch12 -p1 -b .no-help
%patch13 -p1 -b .system-keyboard
%patch99 -p1 -b .fedora-logo
@ -347,6 +352,9 @@ fi
%{_datadir}/gnome-2.0/ui/GNOME_FastUserSwitchApplet.xml
%changelog
* Mon Oct 20 2008 Matthias Clasen <mclasen@redhat.com> - 1:2.24.0-11
- Respect system keyboard setting
* Wed Oct 15 2008 Ray Strode <rstrode@redhat.com> - 1:2.24.0-10
- Rework "force X on vt1" code to work after the user logs out