From 5fabd65b6368b8c22f90153594d902aa6e1bfb5b Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Sep 08 2011 05:03:03 +0000 Subject: Fixed Bug 735879 pre/postun scripts - Updated ibus-gjs 3.1.91.20110908 and 3.0.2.20110908 for gnome-shell. Fixed preedit active segments on gnome-shell and X11 apps. - Added ibus-xx-g-s-disable-preedit.patch Disabled preedit on gnome-shell for a workaround. --- diff --git a/.gitignore b/.gitignore index 5737ece..917506b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ ibus-1.3.6.tar.gz /ibus-gjs-3.0.2.20110823.tar.gz /ibus-gjs-3.1.4.20110823.tar.gz /ibus-1.3.99.20110817.tar.gz +/ibus-gjs-3.0.2.20110908.tar.gz +/ibus-gjs-3.1.91.20110908.tar.gz diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch index 9c381b5..04809a4 100644 --- a/ibus-541492-xkb.patch +++ b/ibus-541492-xkb.patch @@ -1,6 +1,6 @@ -From c7c1106dd675a86b7f7b59e3a05741e8048c53f3 Mon Sep 17 00:00:00 2001 +From 72785243dfb47e9028de47910bed603776e4ec6e Mon Sep 17 00:00:00 2001 From: fujiwarat -Date: Thu, 1 Sep 2011 14:51:37 +0900 +Date: Wed, 7 Sep 2011 15:27:26 +0900 Subject: [PATCH] Add XKB layouts --- @@ -29,8 +29,8 @@ Subject: [PATCH] Add XKB layouts xkb/gtkimcontextsimpleseqs.h | 4484 ++++++++++++++++++++++++++++++++++++++++++ xkb/ibus-engine-xkb-main.c | 303 +++ xkb/ibus-engine-xkb-main.h | 32 + - xkb/ibus-simple-engine.c | 1049 ++++++++++ - xkb/ibus-simple-engine.h | 11 + + xkb/ibus-simple-engine.c | 1003 ++++++++++ + xkb/ibus-simple-engine.h | 13 + xkb/ibus-xkb-main.c | 112 ++ xkb/xkblayout.xml.in | 16 + xkb/xkblayoutconfig.xml.in | 6 + @@ -38,7 +38,7 @@ Subject: [PATCH] Add XKB layouts xkb/xkblib.h | 41 + xkb/xkbxml.c | 345 ++++ xkb/xkbxml.h | 113 ++ - 34 files changed, 9567 insertions(+), 4 deletions(-) + 34 files changed, 9523 insertions(+), 4 deletions(-) create mode 100644 ibus/xkblayout.py.in create mode 100644 ibus/xkbxml.py.in create mode 100644 setup/xkbsetup.py @@ -7956,10 +7956,10 @@ index 0000000..255e952 +#endif diff --git a/xkb/ibus-simple-engine.c b/xkb/ibus-simple-engine.c new file mode 100644 -index 0000000..41702cb +index 0000000..815311b --- /dev/null +++ b/xkb/ibus-simple-engine.c -@@ -0,0 +1,1049 @@ +@@ -0,0 +1,1003 @@ +/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ +/* vim:set et sts=4: */ +#ifdef HAVE_CONFIG_H @@ -7976,6 +7976,11 @@ index 0000000..41702cb + +#define MAX_COMPOSE_LEN 7 + ++typedef enum { ++ IBUS_COMPOSE_TABLE_NONE = 0, ++ IBUS_COMPOSE_TABLE_CEDILLA, ++} IBusComposeAddOnTableType; ++ +typedef struct _IBusSimpleEngine IBusSimpleEngine; +typedef struct _IBusSimpleEngineClass IBusSimpleEngineClass; + @@ -7984,8 +7989,6 @@ index 0000000..41702cb + + IBusPropList *prop_list; + -+ GSList *tables; -+ + guint compose_buffer[MAX_COMPOSE_LEN + 1]; + gunichar tentative_match; + gint tentative_match_len; @@ -7996,14 +7999,7 @@ index 0000000..41702cb + +struct _IBusSimpleEngineClass { + IBusEngineClass parent; -+}; -+ -+typedef struct _GtkComposeTable GtkComposeTable; -+struct _GtkComposeTable -+{ -+ const guint16 *data; -+ gint max_seq_len; -+ gint n_seqs; ++ IBusComposeAddOnTableType compose_addon_table_type; +}; + +typedef struct _GtkComposeTableCompact GtkComposeTableCompact; @@ -8093,13 +8089,6 @@ index 0000000..41702cb + gunichar ch); +static void ibus_simple_engine_update_preedit_text + (IBusSimpleEngine *simple); -+static void ibus_simple_engine_add_table (IBusSimpleEngine *simple, -+ guint16 *data, -+ gint max_seq_len, -+ gint n_seqs); -+static void ibus_simple_engine_add_table_with_lang -+ (IBusSimpleEngine *simple, -+ const gchar *lang); + +G_DEFINE_TYPE (IBusSimpleEngine, ibus_simple_engine, IBUS_TYPE_ENGINE) + @@ -8108,6 +8097,7 @@ index 0000000..41702cb +{ + IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); + IBusEngineClass *engine_class = IBUS_ENGINE_CLASS (klass); ++ gchar *lang = NULL; + + ibus_object_class->destroy = (IBusObjectDestroyFunc) ibus_simple_engine_destroy; + @@ -8120,12 +8110,24 @@ index 0000000..41702cb + = ibus_simple_engine_property_activate; + engine_class->process_key_event + = ibus_simple_engine_process_key_event; ++ ++ klass->compose_addon_table_type = IBUS_COMPOSE_TABLE_NONE; ++ ++#ifdef ENABLE_NLS ++ lang = g_strdup (setlocale (LC_CTYPE, NULL)); ++#endif ++ if (lang == NULL) { ++ lang = g_strdup (g_getenv ("LANG")); ++ } ++ if (lang && g_ascii_strncasecmp (lang, "pt_BR", strlen ("pt_BR")) == 0) { ++ klass->compose_addon_table_type = IBUS_COMPOSE_TABLE_CEDILLA; ++ } ++ g_free (lang); +} + +static void +ibus_simple_engine_init (IBusSimpleEngine *simple) +{ -+ gchar *ling = NULL; +#ifdef ENABLE_SETUP_GUI + IBusText *label; + IBusText *tooltip; @@ -8147,15 +8149,6 @@ index 0000000..41702cb + g_object_ref_sink (prop); + ibus_prop_list_append (simple->prop_list, prop); +#endif -+ -+#ifdef ENABLE_NLS -+ ling = g_strdup (setlocale (LC_CTYPE, NULL)); -+#endif -+ if (ling == NULL) { -+ ling = g_strdup (g_getenv ("LANG")); -+ } -+ ibus_simple_engine_add_table_with_lang (simple, ling); -+ g_free (ling); +} + +static void @@ -8168,12 +8161,6 @@ index 0000000..41702cb + } +#endif + -+ if (simple->tables) { -+ g_slist_foreach (simple->tables, (GFunc) g_free, NULL); -+ g_slist_free (simple->tables); -+ simple->tables = NULL; -+ } -+ + ((IBusObjectClass *) ibus_simple_engine_parent_class)->destroy ((IBusObject *)simple); +} + @@ -8405,22 +8392,39 @@ index 0000000..41702cb + + +static gboolean -+check_table (IBusSimpleEngine *simple, -+ const GtkComposeTable *table, -+ gint n_compose) ++check_addon_table (IBusSimpleEngine *simple, ++ gint n_compose) +{ -+ gint row_stride = table->max_seq_len + 2; ++ IBusComposeAddOnTableType table_type; ++ const guint16 *data = NULL; ++ gint max_seq_len = 0; ++ gint n_seqs = 0; ++ gint row_stride = 0; + guint16 *seq; + ++ g_assert (IBUS_IS_SIMPLE_ENGINE (simple)); ++ ++ table_type = IBUS_SIMPLE_ENGINE_GET_CLASS (simple)->compose_addon_table_type; ++ ++ if (table_type == IBUS_COMPOSE_TABLE_CEDILLA) { ++ data = cedilla_compose_seqs; ++ max_seq_len = 4; ++ n_seqs = G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2); ++ } ++ else { ++ return FALSE; ++ } ++ + /* Will never match, if the sequence in the compose buffer is longer + * than the sequences in the table. Further, compare_seq (key, val) + * will overrun val if key is longer than val. */ -+ if (n_compose > table->max_seq_len) { ++ if (n_compose > max_seq_len) { + return FALSE; + } + ++ row_stride = max_seq_len + 2; + seq = bsearch (simple->compose_buffer, -+ table->data, table->n_seqs, ++ data, n_seqs, + sizeof (guint16) * row_stride, + compare_seq); + @@ -8430,7 +8434,7 @@ index 0000000..41702cb + /* Back up to the first sequence that matches to make sure + * we find the exact match if their is one. + */ -+ while (seq > table->data) { ++ while (seq > data) { + prev_seq = seq - row_stride; + if (compare_seq (simple->compose_buffer, prev_seq) != 0) { + break; @@ -8439,16 +8443,16 @@ index 0000000..41702cb + } + + /* complete sequence */ -+ if (n_compose == table->max_seq_len || seq[n_compose] == 0) { ++ if (n_compose == max_seq_len || seq[n_compose] == 0) { + guint16 *next_seq; + gunichar value = -+ 0x10000 * seq[table->max_seq_len] + seq[table->max_seq_len + 1]; ++ 0x10000 * seq[max_seq_len] + seq[max_seq_len + 1]; + + /* We found a tentative match. See if there are any longer + * sequences containing this subsequence + */ + next_seq = seq + row_stride; -+ if (next_seq < table->data + row_stride * table->n_seqs) { ++ if (next_seq < data + row_stride * n_seqs) { + if (compare_seq (simple->compose_buffer, next_seq) == 0) { + simple->tentative_match = value; + simple->tentative_match_len = n_compose; @@ -8945,14 +8949,10 @@ index 0000000..41702cb + } + } + else { -+ GSList *tmp_list = simple->tables; -+ while (tmp_list) { -+ if (check_table (simple, tmp_list->data, n_compose)) { -+ return TRUE; -+ } -+ tmp_list = tmp_list->next; -+ } + // TODO CONT ++ if (check_addon_table (simple, n_compose)) { ++ return TRUE; ++ } + if (check_compact_table (simple, >k_compose_table_compact, n_compose)) + return TRUE; + @@ -8963,58 +8963,12 @@ index 0000000..41702cb + /* The current compose_buffer doesn't match anything */ + return no_sequence_matches (simple, n_compose, keyval, keycode, modifiers); +} -+ -+static void -+ibus_simple_engine_add_table_with_lang (IBusSimpleEngine *simple, -+ const gchar *lang) -+{ -+ if (lang == NULL) { -+ return; -+ } -+ -+ if (g_strcmp0 (lang, "reset") == 0) { -+ if (simple->tables) { -+ g_slist_foreach (simple->tables, (GFunc) g_free, NULL); -+ g_slist_free (simple->tables); -+ simple->tables = NULL; -+ } -+ return; -+ } -+ -+ if (g_ascii_strncasecmp (lang, "pt_BR", strlen ("pt_BR")) == 0) { -+ ibus_simple_engine_add_table (simple, -+ cedilla_compose_seqs, -+ 4, -+ G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2)); -+ return; -+ } -+} -+ -+static void -+ibus_simple_engine_add_table (IBusSimpleEngine *simple, -+ guint16 *data, -+ gint max_seq_len, -+ gint n_seqs) -+{ -+ GtkComposeTable *table; -+ -+ g_return_if_fail (IBUS_IS_SIMPLE_ENGINE (simple)); -+ g_return_if_fail (data != NULL); -+ g_return_if_fail (max_seq_len <= MAX_COMPOSE_LEN); -+ -+ table = g_new (GtkComposeTable, 1); -+ table->data = data; -+ table->max_seq_len = max_seq_len; -+ table->n_seqs = n_seqs; -+ -+ simple->tables = g_slist_prepend (simple->tables, table); -+} diff --git a/xkb/ibus-simple-engine.h b/xkb/ibus-simple-engine.h new file mode 100644 -index 0000000..17ca57a +index 0000000..dbc725a --- /dev/null +++ b/xkb/ibus-simple-engine.h -@@ -0,0 +1,11 @@ +@@ -0,0 +1,13 @@ +#ifndef __IBUS_SIMPLE_ENGINE_H__ +#define __IBUS_SIMPLE_ENGINE_H__ + @@ -9022,6 +8976,8 @@ index 0000000..17ca57a + +#define IBUS_TYPE_SIMPLE_ENGINE (ibus_simple_engine_get_type ()) +#define IBUS_IS_SIMPLE_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_SIMPLE_ENGINE)) ++#define IBUS_SIMPLE_ENGINE_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_SIMPLE_ENGINE, IBusSimpleEngineClass)) + +GType ibus_simple_engine_get_type (void); + diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index d48afe8..c7cef2e 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -694,3 +694,102 @@ index 723b5fd..3c81688 100644 -- 1.7.5.4 +From 34518370fbb5f69f8dfa2153d0d0da4473d0344d Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 7 Sep 2011 15:09:01 +0900 +Subject: [PATCH] Added get methods for the members in IBusAttribute for non-C + language. + +--- + src/ibusattribute.c | 24 ++++++++++++++++++++++++ + src/ibusattribute.h | 39 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 63 insertions(+), 0 deletions(-) + +diff --git a/src/ibusattribute.c b/src/ibusattribute.c +index 816bcee..aac14d4 100644 +--- a/src/ibusattribute.c ++++ b/src/ibusattribute.c +@@ -124,6 +124,30 @@ ibus_attribute_new (guint type, + return attr; + } + ++guint ++ibus_attribute_get_attr_type (IBusAttribute *attr) ++{ ++ return attr->type; ++} ++ ++guint ++ibus_attribute_get_value (IBusAttribute *attr) ++{ ++ return attr->value; ++} ++ ++guint ++ibus_attribute_get_start_index (IBusAttribute *attr) ++{ ++ return attr->start_index; ++} ++ ++guint ++ibus_attribute_get_end_index (IBusAttribute *attr) ++{ ++ return attr->end_index; ++} ++ + IBusAttribute * + ibus_attr_underline_new (guint underline_type, + guint start_index, +diff --git a/src/ibusattribute.h b/src/ibusattribute.h +index 2628415..f44860c 100644 +--- a/src/ibusattribute.h ++++ b/src/ibusattribute.h +@@ -138,6 +138,45 @@ IBusAttribute *ibus_attribute_new (guint type, + guint value, + guint start_index, + guint end_index); ++ ++/** ++ * ibus_attribute_get_attr_type: ++ * @returns: An enum of IBusAttrType. ++ * ++ * Returns an enum of IBusAttrType. ++ */ ++guint ibus_attribute_get_attr_type ++ (IBusAttribute *attr); ++ ++/** ++ * ibus_attribute_get_value: ++ * @returns: An unsigned int value relative with IBusAttrType. ++ * ++ * Returns an unsigned int value relative with IBusAttrType. ++ * If the type is IBUS_ATTR_TYPE_UNDERLINE, the return value is ++ * IBusAttrUnderline. If the type is IBUS_ATTR_TYPE_FOREGROUND, ++ * the return value is the color RGB. ++ */ ++guint ibus_attribute_get_value (IBusAttribute *attr); ++ ++/** ++ * ibus_attribute_get_start_index: ++ * @returns: A start unsigned index ++ * ++ * Returns a start unsigned index ++ */ ++guint ibus_attribute_get_start_index ++ (IBusAttribute *attr); ++ ++/** ++ * ibus_attribute_get_end_index: ++ * @returns: A end unsigned index ++ * ++ * Returns a end unsigned index ++ */ ++guint ibus_attribute_get_end_index ++ (IBusAttribute *attr); ++ + /** + * ibus_attr_underline_new: + * @underline_type: Type of underline. +-- +1.7.5.4 + diff --git a/ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch b/ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch index 72c1f26..e9d8524 100644 --- a/ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch +++ b/ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch @@ -6,7 +6,7 @@ -GNOME_SHELL_VERSION=`GET_JS_VERSION 'Config.PACKAGE_VERSION'` -GJS_VERSION=`GET_JS_VERSION 'Config.GJS_VERSION'` -+GNOME_SHELL_VERSION=3.1.90 ++GNOME_SHELL_VERSION=3.1.91 +GJS_VERSION=1.29.17 AC_SUBST(GNOME_SHELL_VERSION) AC_SUBST(GJS_VERSION) diff --git a/ibus-xx-g-s-disable-preedit.patch b/ibus-xx-g-s-disable-preedit.patch new file mode 100644 index 0000000..99b6d03 --- /dev/null +++ b/ibus-xx-g-s-disable-preedit.patch @@ -0,0 +1,32 @@ +From 2238af14b654218696220f83b5ee39ae49c2ad98 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Wed, 7 Sep 2011 15:25:27 +0900 +Subject: [PATCH] Added a workaround to disable preedit in gnome-shell + +https://bugzilla.gnome.org/show_bug.cgi?id=658420 +--- + client/gtk2/ibusimcontext.c | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 327a5d9..39d2d0c 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -583,6 +583,14 @@ ibus_im_context_init (GObject *obj) + #else + ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS; + #endif ++ if (!g_getenv ("IBUS_GNOME_SHELL_ENABLE_PREEDIT_TEXT")) { ++ const gchar * prgname = g_get_prgname (); ++ if (g_strcmp0 (prgname, "gnome-shell") == 0) { ++ if (ibusimcontext->caps | IBUS_CAP_PREEDIT_TEXT) { ++ ibusimcontext->caps ^= IBUS_CAP_PREEDIT_TEXT; ++ } ++ } ++ } + + + // Create slave im context +-- +1.7.5.4 + diff --git a/ibus.spec b/ibus.spec index b56d4eb..4288961 100644 --- a/ibus.spec +++ b/ibus.spec @@ -7,11 +7,11 @@ %if 0%{?fedora} > 15 %define have_bridge_hotkey 1 -%define ibus_gjs_version 3.1.4.20110823 +%define ibus_gjs_version 3.1.91.20110908 %define ibus_gjs_build_failure 1 %else %define have_bridge_hotkey 0 -%define ibus_gjs_version 3.0.2.20110823 +%define ibus_gjs_version 3.0.2.20110908 %define ibus_gjs_build_failure 0 %endif @@ -24,7 +24,7 @@ Name: ibus Version: 1.3.99.20110817 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -45,6 +45,9 @@ Patch91: ibus-711632-fedora-fallback-icon.patch # Workaround gnome-shell build failure # http://koji.fedoraproject.org/koji/getfile?taskID=3317917&name=root.log Patch92: ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch +# Workaround to disable preedit on gnome-shell until bug 658420 is fixed. +# https://bugzilla.gnome.org/show_bug.cgi?id=658420 +Patch93: ibus-xx-g-s-disable-preedit.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -185,6 +188,7 @@ cd .. %endif %endif %patch0 -p1 +%patch93 -p1 -b .g-s-preedit cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c %patch1 -p1 -b .preload-sys %if %have_libxkbfile @@ -382,6 +386,14 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Thu Sep 08 2011 Takao Fujiwara - 1.3.99.20110817-4 +- Updated ibus-gjs 3.1.91.20110908 and 3.0.2.20110908 for gnome-shell. + Fixed preedit active segments on gnome-shell and X11 apps. +- Added ibus-xx-g-s-disable-preedit.patch + Disabled preedit on gnome-shell for a workaround. +- Updated ibus.spec + Fixed Bug 735879 pre/postun scripts + * Thu Sep 01 2011 Takao Fujiwara - 1.3.99.20110817-3 - Fixed Bug 700472 Use a symbol icon instead of an image icon. - Updated ibus-HEAD.patch for upstream. diff --git a/sources b/sources index 39c9118..62ddb92 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 52614e55e966b7c7101a19b276c51f10 ibus-1.3.99.20110817.tar.gz -c4df79742fb0de4d2794c6800a493d20 ibus-gjs-3.0.2.20110823.tar.gz -e97be8e1d0b22531b5000d4a6349dbbe ibus-gjs-3.1.4.20110823.tar.gz +96f29410fde5c56d371b5d5a1981885d ibus-gjs-3.0.2.20110908.tar.gz +97a34b96662fbcd83c82b5f2d4308368 ibus-gjs-3.1.91.20110908.tar.gz