OBS User unknown 2009-06-12 16:05:33 +00:00 committed by Git OBS Bridge
parent e4cc27e1c5
commit acf8c1a6fa
4 changed files with 265 additions and 9 deletions

View File

@ -0,0 +1,177 @@
commit 408568e30f1552b03101c724b28c4d865bea4adc
Author: Sergey V. Udaltsov <svu@gnome.org>
Date: Thu Jun 11 01:34:41 2009 +0100
Nicer handling of broken XKB configuration in gconf.
If XKB configuration fails, g-s-d tries to filter out layouts/variants
not registered in base.xml - then configure XKB again.
http://bugzilla.gnome.org/show_bug.cgi?id=585259
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index 346fdba..86b5ea8 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -40,6 +40,7 @@
#include "gnome-settings-profile.h"
static XklEngine *xkl_engine;
+static XklConfigRegistry *xkl_registry = NULL;
static GkbdDesktopConfig current_config;
static GkbdKeyboardConfig current_kbd_config;
@@ -125,7 +126,7 @@ activation_error (void)
}
static void
-apply_settings (void)
+apply_desktop_settings (void)
{
if (!inited_ok)
return;
@@ -136,6 +137,79 @@ apply_settings (void)
gkbd_desktop_config_activate (&current_config);
}
+static gboolean
+try_activating_xkb_config_if_new (GkbdKeyboardConfig *current_sys_kbd_config)
+{
+ /* Activate - only if different! */
+ if (!gkbd_keyboard_config_equals
+ (&current_kbd_config, current_sys_kbd_config)) {
+ if (gkbd_keyboard_config_activate (&current_kbd_config)) {
+ if (pa_callback != NULL) {
+ (*pa_callback) (pa_callback_user_data);
+ return TRUE;
+ }
+ } else {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static gboolean
+filter_xkb_config (void)
+{
+ XklConfigItem *item;
+ gchar *lname;
+ gchar *vname;
+ GSList *lv;
+ GSList *filtered;
+ gboolean any_change = FALSE;
+
+ xkl_debug (100, "Filtering configuration against the registry\n");
+ if (!xkl_registry) {
+ xkl_registry = xkl_config_registry_get_instance (xkl_engine);
+ if (!xkl_config_registry_load (xkl_registry)) {
+ g_object_unref (xkl_registry);
+ xkl_registry = NULL;
+ return FALSE;
+ }
+ }
+ lv = current_kbd_config.layouts_variants;
+ item = xkl_config_item_new ();
+ while (lv) {
+ xkl_debug (100, "Checking [%s]\n", lv->data);
+ if (gkbd_keyboard_config_split_items(lv->data, &lname, &vname)) {
+ g_snprintf (item->name, sizeof (item->name), "%s", lname);
+ if (!xkl_config_registry_find_layout (xkl_registry, item)) {
+ xkl_debug (100, "Bad layout [%s]\n", lname);
+ filtered = lv;
+ lv = lv->next;
+ g_free (filtered->data);
+ current_kbd_config.layouts_variants = g_slist_delete_link (current_kbd_config.layouts_variants,
+ filtered);
+ any_change = TRUE;
+ continue;
+ }
+ if (vname) {
+ g_snprintf (item->name, sizeof (item->name), "%s", vname);
+ if (!xkl_config_registry_find_variant (xkl_registry, lname, item)) {
+ xkl_debug(100, "Bad variant [%s(%s)]\n", lname, vname);
+ filtered = lv;
+ lv = lv->next;
+ g_free (filtered->data);
+ current_kbd_config.layouts_variants = g_slist_delete_link (current_kbd_config.layouts_variants,
+ filtered);
+ any_change = TRUE;
+ continue;
+ }
+ }
+ }
+ lv = lv->next;
+ }
+ g_object_unref(item);
+ return any_change;
+}
+
static void
apply_xkb_settings (void)
{
@@ -201,16 +275,14 @@ apply_xkb_settings (void)
}
}
- /* Activate - only if different! */
- if (!gkbd_keyboard_config_equals
- (&current_kbd_config, &current_sys_kbd_config)) {
- if (gkbd_keyboard_config_activate (&current_kbd_config)) {
- if (pa_callback != NULL) {
- (*pa_callback) (pa_callback_user_data);
+ 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)) {
+ g_warning ("Could not activate the filtered XKB configuration");
+ activation_error ();
}
- } else {
- g_warning
- ("Could not activate the XKB configuration");
+ } else {
+ g_warning ("Could not activate the XKB configuration");
activation_error ();
}
} else
@@ -346,7 +418,7 @@ register_config_callback (GConfClient * client,
static void
gsd_keyboard_new_device (XklEngine * engine)
{
- apply_settings ();
+ apply_desktop_settings ();
apply_xkb_settings ();
}
@@ -383,7 +455,7 @@ gsd_keyboard_xkb_init (GConfClient * client)
register_config_callback (client,
GKBD_DESKTOP_CONFIG_DIR,
(GConfClientNotifyFunc)
- apply_settings);
+ apply_desktop_settings);
notify_keyboard =
register_config_callback (client,
@@ -406,9 +478,9 @@ gsd_keyboard_xkb_init (GConfClient * client)
XKLL_MANAGE_WINDOW_STATES);
gnome_settings_profile_end ("xkl_engine_start_listen");
- gnome_settings_profile_start ("apply_settings");
- apply_settings ();
- gnome_settings_profile_end ("apply_settings");
+ gnome_settings_profile_start ("apply_desktop_settings");
+ apply_desktop_settings ();
+ gnome_settings_profile_end ("apply_desktop_settings");
gnome_settings_profile_start ("apply_xkb_settings");
apply_xkb_settings ();
gnome_settings_profile_end ("apply_xkb_settings");
@@ -449,6 +521,10 @@ gsd_keyboard_xkb_shutdown (void)
notify_keyboard = 0;
}
+ if (xkl_registry) {
+ g_object_unref (xkl_registry);
+ }
+
g_object_unref (client);
g_object_unref (xkl_engine);

View File

@ -0,0 +1,51 @@
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index 346fdba..19ae642 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -158,18 +158,42 @@ apply_xkb_settings (void)
gdm_keyboard_layout = NULL;
if (gdm_layout != NULL) {
GSList *layouts;
+ GSList *found_node;
+
layouts = gconf_client_get_list (conf_client,
GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
GCONF_VALUE_STRING, NULL);
- if (layouts == NULL) {
- layouts =
- g_slist_append (layouts,
- g_strdup (gdm_layout));
+
+ /* Add the layout if it doesn't already exist. XKB limits the
+ * total number of layouts to four. If we already have four
+ * layouts configured, we replace the last one. This prevents the
+ * list from becoming full if the user has a habit of selecting
+ * many different keyboard layouts in GDM. */
+
+ found_node = g_slist_find_custom (layouts, gdm_layout, g_strcmp0);
+
+ if (found_node) {
+ if (g_slist_position (layouts, found_node) > 3) {
+ /* If the layout we found appears after the
+ * fourth entry, we move it up to fourth place.
+ * Otherwise, XKB will not activate it. */
+ g_free (found_node->data);
+ layouts = g_slist_delete_link (layouts, found_node);
+ found_node = NULL;
+ }
+ }
+
+ if (!found_node) {
+ /* Insert in fourth slot or at the end of list,
+ * whichever comes first */
+ layouts = g_slist_insert (layouts, g_strdup (gdm_layout), 3);
+
gconf_client_set_list (conf_client,
GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
GCONF_VALUE_STRING, layouts,
NULL);
}
+
g_slist_foreach (layouts, (GFunc) g_free, NULL);
g_slist_free (layouts);
}

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Thu Jun 11 15:30:37 CEST 2009 - vuntz@novell.com
- Add gnome-settings-daemon-filter-invalid-xkb.patch: when the xkb
config from gconf can't be used, try to remove invalid xkb
layouts first before showing an error dialog. The old gdm used to
have invalid layouts.
-------------------------------------------------------------------
Wed Jun 10 00:02:37 CEST 2009 - vuntz@novell.com
- Add gnome-settings-daemon-try-harder-gdm-layout.patch: try harder
to use the keyboard layout passed from GDM.
-------------------------------------------------------------------
Mon May 25 13:36:28 CDT 2009 - federico@novell.com

View File

@ -34,7 +34,7 @@ BuildRequires: xorg-x11
License: GPL v2 or later
Group: System/GUI/GNOME
Version: 2.27.1
Release: 2
Release: 3
Summary: Settings daemon for the GNOME desktop
Source: %{_name}-%{version}.tar.bz2
# PATCH-FEATURE-OPENSUSE gnome-settings-daemon-system-proxy-configuration.diff
@ -47,6 +47,10 @@ Patch8: gnome-settings-daemon-apport-monitor.patch
Patch10: gnome-settings-daemon-bnc462640-mute-action.patch
# PATCH-FEATURE-OPENSUSE gnome-settings-daemon-bnc461755-randr-rotate-wacom.diff bnc461755 federico@novell.com - Add the option of rotating a Wacom tablet when rotating the monitor with RANDR
Patch11: gnome-settings-daemon-bnc461755-randr-rotate-wacom.diff
# PATCH-FIX-UPSTREAM # gnome-settings-daemon-try-harder-gdm-layout.patch bgo585290 vuntz@novell.com -- Try harder to use the keyboard layout passed from GDM
Patch12: gnome-settings-daemon-try-harder-gdm-layout.patch
# PATCH-FIX-UPSTREAM gnome-settings-daemon-filter-invalid-xkb.patch bgo585259 vuntz@novell.com -- Filter invalid xkb layouts from the gconf config (usually added by old gdm)
Patch13: gnome-settings-daemon-filter-invalid-xkb.patch
Url: http://www.gnome.org
Requires: %{name}-lang = %{version}
Obsoletes: resapplet
@ -105,6 +109,8 @@ gnome-patch-translation-prepare
%patch8 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
gnome-patch-translation-update
%build
@ -160,6 +166,14 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/*.pc
%changelog
* Thu Jun 11 2009 vuntz@novell.com
- Add gnome-settings-daemon-filter-invalid-xkb.patch: when the xkb
config from gconf can't be used, try to remove invalid xkb
layouts first before showing an error dialog. The old gdm used to
have invalid layouts.
* Wed Jun 10 2009 vuntz@novell.com
- Add gnome-settings-daemon-try-harder-gdm-layout.patch: try harder
to use the keyboard layout passed from GDM.
* Mon May 25 2009 federico@novell.com
- Added gnome-settings-daemon-bnc461755-randr-rotate-wacom.diff to fix
bnc#461755 - Add the option of rotating Wacom tablets when the
@ -205,7 +219,7 @@ rm -rf $RPM_BUILD_ROOT
+ Updated translations.
- Drop gnome-settings-daemon-bnc473980-unknown-media-key.patch:
fixed upstream.
* Wed Feb 18 2009 vuntz@novell.com
* Thu Feb 19 2009 vuntz@novell.com
- Add gnome-settings-daemon-bnc462640-mute-button-always-mute.patch
to make it possible to always mute sound instead of toggling mute
status. Part of bnc#462640. The other part is in gconf2-branding,
@ -219,7 +233,7 @@ rm -rf $RPM_BUILD_ROOT
the features.
- Remove gstreamer-0_10-plugins-base-devel BuildRequires: it's not
needed anymore (replaced by use of libpulse).
* Wed Feb 04 2009 mboman@suse.de
* Thu Feb 05 2009 mboman@suse.de
- Update to version 2.25.90:
+ Initialize thread system (bgo#565515)
+ Better support for Eject and Sleep actions on BSD (bgo#565472)
@ -254,7 +268,7 @@ rm -rf $RPM_BUILD_ROOT
* Fri Jan 23 2009 vuntz@novell.com
- Re-enable gnome-settings-daemon-apport-monitor.patch, after
fixing some #include in the patch.
* Wed Jan 14 2009 federico@novell.com
* Thu Jan 15 2009 federico@novell.com
- Updated gnome-settings-daemon-randr-gerror.diff to fix bnc#465968 -
The RANDR plugin was displaying a confusing error message during
GDM's startup.
@ -297,7 +311,7 @@ rm -rf $RPM_BUILD_ROOT
of a signal
+ Translation updates
- Remove gnome-settings-daemon-randr-fnf7.diff. Fixed upstream
* Mon Dec 08 2008 federico@novell.com
* Tue Dec 09 2008 federico@novell.com
- Updated gnome-settings-daemon-system-proxy-configuration.diff to fix
https://bugzilla.novell.com/show_bug.cgi?id=456131 - the system's
proxy configuration was not being set in GNOME's proxy
@ -308,7 +322,7 @@ rm -rf $RPM_BUILD_ROOT
* Thu Oct 23 2008 vuntz@novell.com
- Add gnome-settings-daemon-low-disk-space.patch, to help drop
gnome-volume-manager.
* Fri Oct 03 2008 mboman@suse.de
* Sat Oct 04 2008 mboman@suse.de
- Update to version 2.24.0:
- Fix the fix for read-only home directories (bgo#530975)
- Make the volume popup not crash when invoking it on any screen but
@ -329,7 +343,7 @@ rm -rf $RPM_BUILD_ROOT
- Update to 2.23.92:
+ Try harder to use the keyboard layout passed by GDM (bgo#551062)
+ Updated translations
* Wed Sep 10 2008 federico@novell.com
* Thu Sep 11 2008 federico@novell.com
- Added gnome-settings-daemon-randr-fnf7.diff to support switching
between display output modes on laptop by using the Fn-F7 hotkey
(i.e. XF86Display).
@ -421,7 +435,7 @@ rm -rf $RPM_BUILD_ROOT
+ Apply keyboard settings on startup (bgo#525440)
+ Make "Home" keybinding work again
+ Updated translations.
* Thu Mar 13 2008 maw@suse.de
* Fri Mar 14 2008 maw@suse.de
- Update to version 2.22.0:
+ Actually link against libXi when building with XInput support
(bgo#519488)
@ -431,7 +445,7 @@ rm -rf $RPM_BUILD_ROOT
+ Updated translations.
* Thu Mar 13 2008 sbrabec@suse.cz
- Custom look'n'feel gconf keys moved to gconf2-branding-openSUSE.
* Tue Feb 19 2008 maw@suse.de
* Wed Feb 20 2008 maw@suse.de
- Update to version 2.21.91:
+ Use a flat directory instead of a hierarchy to install plugins
into (bgo#513246)