From 6de984296be6c02d7476b388557d58c9ad9dea5e Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Thu, 20 Dec 2018 17:24:16 +0900 Subject: [PATCH] Connect to button-press-event only with IBUS_ENGINE_PREEDIT_COMMIT Use ISO 639-3 names instead of 639 --- ibus-HEAD.patch | 236 ++++++++++++++++++++++++++++++++++++++++++++++++ ibus.spec | 6 +- 2 files changed, 241 insertions(+), 1 deletion(-) diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index 893438b..7125c44 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -2050,3 +2050,239 @@ index ed7fea6e..ab7ff88a 100644 -- 2.19.1 +From 1cd5254811259befe50c8bd81584d1bfe2c63ed0 Mon Sep 17 00:00:00 2001 +From: glasseyes +Date: Mon, 17 Dec 2018 20:20:11 +0900 +Subject: [PATCH] src: use iso 639-3 to have names for more languages + +Keyman and others support them so they shouldn't be in "Other" + +BUG=https://github.com/ibus/ibus/issues/2064 +--- + ibus/lang.py | 8 ++++---- + src/ibusutil.c | 16 ++++++++-------- + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/ibus/lang.py b/ibus/lang.py +index 3b3f552f..64324bd8 100644 +--- a/ibus/lang.py ++++ b/ibus/lang.py +@@ -36,7 +36,7 @@ def get_language_name(_locale): + lang = lang.lower() + if lang in __languages_dict: + lang = __languages_dict[lang] +- lang = gettext.dgettext("iso_639", lang) ++ lang = gettext.dgettext("iso_639-3", lang) + else: + lang = _(u"Other") + lang = gettext.dgettext("ibus", lang) +@@ -46,7 +46,7 @@ def __start_element(name, attrs): + global __languages_dict + try: + name = attrs[u"name"] +- for attr_name in (u"iso_639_2B_code", u"iso_639_2T_code", u"iso_639_1_code"): ++ for attr_name in (u"id", u"part1_code", u"part2_code"): + if attr_name in attrs: + attr_value = attrs[attr_name] + __languages_dict[attr_value] = name +@@ -62,12 +62,12 @@ def __char_data(data): + def __load_lang(): + import os + import _config +- iso_639_xml = os.path.join(_config.ISOCODES_PREFIX, "share/xml/iso-codes/iso_639.xml") ++ iso_639_3_xml = os.path.join(_config.ISOCODES_PREFIX, "share/xml/iso-codes/iso_639-3.xml") + p = xml.parsers.expat.ParserCreate() + p.StartElementHandler = __start_element + p.EndElementHandler = __end_element + p.CharacterDataHandler = __char_data +- p.ParseFile(file(iso_639_xml)) ++ p.ParseFile(file(iso_639_3_xml)) + + __load_lang() + +diff --git a/src/ibusutil.c b/src/ibusutil.c +index 15e36f80..fd1da006 100644 +--- a/src/ibusutil.c ++++ b/src/ibusutil.c +@@ -45,7 +45,7 @@ _iso_codes_parse_xml_node (XMLNode *node) + GList *p; + g_assert (node); + +- if (G_UNLIKELY (g_strcmp0 (node->name, "iso_639_entries") != 0)) { ++ if (G_UNLIKELY (g_strcmp0 (node->name, "iso_639_3_entries") != 0)) { + return FALSE; + } + +@@ -57,9 +57,9 @@ _iso_codes_parse_xml_node (XMLNode + const gchar *key; + gchar *value; + } entries[] = { +- { "iso_639_2B_code", NULL }, +- { "iso_639_2T_code", NULL }, +- { "iso_639_1_code", NULL }, ++ { "id", NULL }, ++ { "part1_code", NULL }, ++ { "part2_code", NULL }, + }; + + if (sub_node->attributes == NULL) { +@@ -99,14 +99,14 @@ _load_lang() + struct stat buf; + + #ifdef ENABLE_NLS +- bindtextdomain ("iso_639", GLIB_LOCALE_DIR); +- bind_textdomain_codeset ("iso_639", "UTF-8"); ++ bindtextdomain ("iso_639-3", GLIB_LOCALE_DIR); ++ bind_textdomain_codeset ("iso_639-3", "UTF-8"); + #endif + + __languages_dict = g_hash_table_new_full (g_str_hash, + g_str_equal, g_free, g_free); + filename = g_build_filename (ISOCODES_PREFIX, +- "share/xml/iso-codes/iso_639.xml", ++ "share/xml/iso-codes/iso_639-3.xml", + NULL); + if (g_stat (filename, &buf) != 0) { + g_warning ("Can not get stat of file %s", filename); +@@ -157,7 +157,7 @@ ibus_get_language_name (const gchar *_lo + if (g_strcmp0 (retval, "Other") == 0) + return dgettext (GETTEXT_PACKAGE, N_("Other")); + else +- return dgettext ("iso_639", retval); ++ return dgettext ("iso_639-3", retval); + #else + return retval; + #endif +-- +2.19.1 + +From 9ae2d4658fff3d1e7262fb4fb7ca9ce1af0a27ec Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 20 Dec 2018 16:40:31 +0900 +Subject: [PATCH] client/gtk2: Use button-press-event only with + IBUS_ENGINE_PREEDIT_COMMIT + +BUG=https://github.com/ibus/ibus/issues/1980 +--- + client/gtk2/ibusimcontext.c | 66 ++++++++++++++++++++++++------------- + 1 file changed, 43 insertions(+), 23 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index ab7ff88a..f9310867 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -72,6 +72,8 @@ struct _IBusIMContext { + /* cancellable */ + GCancellable *cancellable; + GQueue *events_queue; ++ ++ gboolean use_button_press_event; + }; + + struct _IBusIMContextClass { +@@ -1109,6 +1111,7 @@ ibus_im_context_get_preedit_string (GtkIMContext *context, + } + + ++#if !GTK_CHECK_VERSION (3, 93, 0) + static gboolean + ibus_im_context_button_press_event_cb (GtkWidget *widget, + GdkEventButton *event, +@@ -1124,13 +1127,37 @@ ibus_im_context_button_press_event_cb (GtkWidget *widget, + return FALSE; + } + ++static void ++_connect_button_press_event (IBusIMContext *ibusimcontext, ++ gboolean do_connect) ++{ ++ GtkWidget *widget = NULL; ++ ++ g_assert (ibusimcontext->client_window); ++ gdk_window_get_user_data (ibusimcontext->client_window, ++ (gpointer *)&widget); ++ /* firefox needs GtkWidget instead of GtkWindow */ ++ if (GTK_IS_WIDGET (widget)) { ++ if (do_connect) { ++ g_signal_connect ( ++ widget, ++ "button-press-event", ++ G_CALLBACK (ibus_im_context_button_press_event_cb), ++ ibusimcontext); ++ } else { ++ g_signal_handlers_disconnect_by_func ( ++ widget, ++ G_CALLBACK (ibus_im_context_button_press_event_cb), ++ ibusimcontext); ++ } ++ } ++} ++#endif ++ + static void + ibus_im_context_set_client_window (GtkIMContext *context, GdkWindow *client) + { + IBusIMContext *ibusimcontext; +-#if !GTK_CHECK_VERSION (3, 93, 0) +- GtkWidget *widget; +-#endif + + IDEBUG ("%s", __FUNCTION__); + +@@ -1138,15 +1165,8 @@ ibus_im_context_set_client_window (GtkIMContext *context, GdkWindow *client) + + if (ibusimcontext->client_window) { + #if !GTK_CHECK_VERSION (3, 93, 0) +- gdk_window_get_user_data (ibusimcontext->client_window, +- (gpointer *)&widget); +- /* firefox needs GtkWidget instead of GtkWindow */ +- if (GTK_IS_WIDGET (widget)) { +- g_signal_handlers_disconnect_by_func ( +- widget, +- (GCallback)ibus_im_context_button_press_event_cb, +- ibusimcontext); +- } ++ if (ibusimcontext->use_button_press_event) ++ _connect_button_press_event (ibusimcontext, FALSE); + #endif + g_object_unref (ibusimcontext->client_window); + ibusimcontext->client_window = NULL; +@@ -1155,17 +1175,8 @@ ibus_im_context_set_client_window (GtkIMContext *context, GdkWindow *client) + if (client != NULL) { + ibusimcontext->client_window = g_object_ref (client); + #if !GTK_CHECK_VERSION (3, 93, 0) +- gdk_window_get_user_data (ibusimcontext->client_window, +- (gpointer *)&widget); +- +- /* firefox needs GtkWidget instead of GtkWindow */ +- if (GTK_IS_WIDGET (widget)) { +- g_signal_connect ( +- widget, +- "button-press-event", +- G_CALLBACK (ibus_im_context_button_press_event_cb), +- ibusimcontext); +- } ++ if (ibusimcontext->use_button_press_event) ++ _connect_button_press_event (ibusimcontext, TRUE); + #endif + } + if (ibusimcontext->slave) +@@ -1631,6 +1642,15 @@ _ibus_context_update_preedit_text_cb (IBusInputContext *ibuscontext, + ibusimcontext->preedit_attrs = NULL; + } + ++ if (!ibusimcontext->use_button_press_event && ++ mode == IBUS_ENGINE_PREEDIT_COMMIT) { ++#if !GTK_CHECK_VERSION (3, 93, 0) ++ if (ibusimcontext->client_window) ++ _connect_button_press_event (ibusimcontext, TRUE); ++#endif ++ ibusimcontext->use_button_press_event = TRUE; ++ } ++ + str = text->text; + ibusimcontext->preedit_string = g_strdup (str); + if (text->attrs) { +-- +2.19.1 + diff --git a/ibus.spec b/ibus.spec index 6ca8fc1..5bb5ab2 100644 --- a/ibus.spec +++ b/ibus.spec @@ -35,7 +35,7 @@ Name: ibus Version: 1.5.19 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -436,6 +436,10 @@ dconf update || : %{_datadir}/gtk-doc/html/* %changelog +* Thu Dec 20 2018 Takao Fujiwara - 1.5.19-12 +- Use ISO 639-3 names instead of 639 +- Connect to button-press-event only with IBUS_ENGINE_PREEDIT_COMMIT + * Wed Dec 12 2018 Takao Fujiwara - 1.5.19-11 - Fix SEGV on mouse clicks when ibus-daemon not running