Resolves: rhbz#1150199 - many kbd layouts not selectable

This commit is contained in:
Rui Matos 2014-10-21 15:37:55 +02:00
parent cf205c9301
commit a7ec84a834
3 changed files with 231 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 4999cfd5fb9ff3bedef2c6bafc0b34832a94b029 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Thu, 28 Aug 2014 19:16:05 +0200
Subject: [PATCH 1/2] gnome-xkb-info: Fix adding layouts to language and
country tables
Layout->xkb_name isn't unique so we can't use it as a key in the hash
table. Layout->id is the unique identifier that we should be using,
otherwise some layouts would never get added.
https://bugzilla.gnome.org/show_bug.cgi?id=729210
---
libgnome-desktop/gnome-xkb-info.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index eec1224..0cd089f 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -367,7 +367,7 @@ add_layout_to_table (GHashTable *table,
{
GHashTable *set;
- if (!layout->xkb_name)
+ if (!layout->id)
return;
set = g_hash_table_lookup (table, key);
@@ -378,10 +378,10 @@ add_layout_to_table (GHashTable *table,
}
else
{
- if (g_hash_table_contains (set, layout->xkb_name))
+ if (g_hash_table_contains (set, layout->id))
return;
}
- g_hash_table_replace (set, layout->xkb_name, layout);
+ g_hash_table_replace (set, layout->id, layout);
}
static void
--
1.9.0

View File

@ -0,0 +1,179 @@
From 959146efdd88f20270384ee1186189310de13b1d Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 18 Nov 2013 15:42:02 +0100
Subject: [PATCH 2/2] gnome-xkb-info: Apply main layout locale metadata to
variants
If a variant doesn't specify language/country metadata then we should
file it under its main layout's language/country.
https://bugzilla.gnome.org/show_bug.cgi?id=711291
---
libgnome-desktop/gnome-xkb-info.c | 100 ++++++++++++++++++++++++++++----------
1 file changed, 74 insertions(+), 26 deletions(-)
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index 0cd089f..480836d 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -56,6 +56,8 @@ struct _Layout
gchar *description;
gboolean is_variant;
const Layout *main_layout;
+ GSList *iso639Ids;
+ GSList *iso3166Ids;
};
typedef struct _XkbOption XkbOption;
@@ -104,6 +106,8 @@ free_layout (gpointer data)
g_free (layout->xkb_name);
g_free (layout->short_desc);
g_free (layout->description);
+ g_slist_free_full (layout->iso639Ids, g_free);
+ g_slist_free_full (layout->iso3166Ids, g_free);
g_slice_free (Layout, layout);
}
@@ -385,6 +389,60 @@ add_layout_to_table (GHashTable *table,
}
static void
+add_layout_to_locale_tables (Layout *layout,
+ GHashTable *layouts_by_language,
+ GHashTable *layouts_by_country)
+{
+ GSList *l, *lang_codes, *country_codes;
+ gchar *language, *country;
+
+ lang_codes = layout->iso639Ids;
+ country_codes = layout->iso3166Ids;
+
+ if (layout->is_variant)
+ {
+ if (!lang_codes)
+ lang_codes = layout->main_layout->iso639Ids;
+ if (!country_codes)
+ country_codes = layout->main_layout->iso3166Ids;
+ }
+
+ for (l = lang_codes; l; l = l->next)
+ {
+ language = gnome_get_language_from_code ((gchar *) l->data, NULL);
+ if (language)
+ {
+ add_layout_to_table (layouts_by_language, language, layout);
+ g_free (language);
+ }
+ }
+
+ for (l = country_codes; l; l = l->next)
+ {
+ country = gnome_get_country_from_code ((gchar *) l->data, NULL);
+ if (country)
+ {
+ add_layout_to_table (layouts_by_country, country, layout);
+ g_free (country);
+ }
+ }
+}
+
+static void
+add_iso639 (Layout *layout,
+ gchar *id)
+{
+ layout->iso639Ids = g_slist_prepend (layout->iso639Ids, id);
+}
+
+static void
+add_iso3166 (Layout *layout,
+ gchar *id)
+{
+ layout->iso3166Ids = g_slist_prepend (layout->iso3166Ids, id);
+}
+
+static void
parse_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer data,
@@ -412,6 +470,9 @@ parse_end_element (GMarkupParseContext *context,
g_hash_table_replace (priv->layouts_table,
priv->current_parser_layout->id,
priv->current_parser_layout);
+ add_layout_to_locale_tables (priv->current_parser_layout,
+ priv->layouts_by_language,
+ priv->layouts_by_country);
priv->current_parser_layout = NULL;
}
else if (strcmp (element_name, "variant") == 0)
@@ -431,12 +492,13 @@ parse_end_element (GMarkupParseContext *context,
g_hash_table_replace (priv->layouts_table,
priv->current_parser_variant->id,
priv->current_parser_variant);
+ add_layout_to_locale_tables (priv->current_parser_variant,
+ priv->layouts_by_language,
+ priv->layouts_by_country);
priv->current_parser_variant = NULL;
}
else if (strcmp (element_name, "iso639Id") == 0)
{
- gchar *language;
-
if (!priv->current_parser_iso639Id)
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
@@ -444,23 +506,15 @@ parse_end_element (GMarkupParseContext *context,
return;
}
- language = gnome_get_language_from_code (priv->current_parser_iso639Id, NULL);
- if (language)
- {
- if (priv->current_parser_variant)
- add_layout_to_table (priv->layouts_by_language, language, priv->current_parser_variant);
- else if (priv->current_parser_layout)
- add_layout_to_table (priv->layouts_by_language, language, priv->current_parser_layout);
-
- g_free (language);
- }
+ if (priv->current_parser_variant)
+ add_iso639 (priv->current_parser_variant, priv->current_parser_iso639Id);
+ else if (priv->current_parser_layout)
+ add_iso639 (priv->current_parser_layout, priv->current_parser_iso639Id);
- g_clear_pointer (&priv->current_parser_iso639Id, g_free);
+ priv->current_parser_iso639Id = NULL;
}
else if (strcmp (element_name, "iso3166Id") == 0)
{
- gchar *country;
-
if (!priv->current_parser_iso3166Id)
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
@@ -468,18 +522,12 @@ parse_end_element (GMarkupParseContext *context,
return;
}
- country = gnome_get_country_from_code (priv->current_parser_iso3166Id, NULL);
- if (country)
- {
- if (priv->current_parser_variant)
- add_layout_to_table (priv->layouts_by_country, country, priv->current_parser_variant);
- else if (priv->current_parser_layout)
- add_layout_to_table (priv->layouts_by_country, country, priv->current_parser_layout);
-
- g_free (country);
- }
+ if (priv->current_parser_variant)
+ add_iso3166 (priv->current_parser_variant, priv->current_parser_iso3166Id);
+ else if (priv->current_parser_layout)
+ add_iso3166 (priv->current_parser_layout, priv->current_parser_iso3166Id);
- g_clear_pointer (&priv->current_parser_iso3166Id, g_free);
+ priv->current_parser_iso3166Id = NULL;
}
else if (strcmp (element_name, "group") == 0)
{
--
1.9.0

View File

@ -7,11 +7,13 @@
Summary: Shared code among gnome-panel, gnome-session, nautilus, etc Summary: Shared code among gnome-panel, gnome-session, nautilus, etc
Name: gnome-desktop3 Name: gnome-desktop3
Version: 3.10.2 Version: 3.10.2
Release: 2%{?dist} Release: 3%{?dist}
URL: http://www.gnome.org URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/gnome-desktop/3.10/gnome-desktop-%{version}.tar.xz Source0: http://download.gnome.org/sources/gnome-desktop/3.10/gnome-desktop-%{version}.tar.xz
Patch0: 0001-default-input-sources-Switch-ja_JP-default-to-ibus-k.patch Patch0: 0001-default-input-sources-Switch-ja_JP-default-to-ibus-k.patch
Patch1: 0001-idle-monitor-Check-if-a-monitor-exists-before-creati.patch Patch1: 0001-idle-monitor-Check-if-a-monitor-exists-before-creati.patch
Patch2: 0001-gnome-xkb-info-Fix-adding-layouts-to-language-and-co.patch
Patch3: 0002-gnome-xkb-info-Apply-main-layout-locale-metadata-to-.patch
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
@ -68,6 +70,8 @@ libgnomedesktop.
%setup -q -n gnome-desktop-%{version} %setup -q -n gnome-desktop-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%build %build
%configure --with-pnp-ids-path="/usr/share/hwdata/pnp.ids" %configure --with-pnp-ids-path="/usr/share/hwdata/pnp.ids"
@ -104,6 +108,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
%doc %{_datadir}/gtk-doc/html/gnome-desktop3/ %doc %{_datadir}/gtk-doc/html/gnome-desktop3/
%changelog %changelog
* Tue Oct 21 2014 Rui Matos <rmatos@redhat.com> - 3.10.2-3
- Resolves: rhbz#1150199 - many kbd layouts not selectable
* Tue Nov 26 2013 Rui Matos <rmatos@redhat.com> - 3.10.2-2 * Tue Nov 26 2013 Rui Matos <rmatos@redhat.com> - 3.10.2-2
- Resolves: rhbz#1008965 - mouse cursor sometimes disappears on login - Resolves: rhbz#1008965 - mouse cursor sometimes disappears on login