From 73a38625e7d76912804938713cd0e75b0eb204c5 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 9 Nov 2021 04:54:52 -0500 Subject: [PATCH] import ibus-1.5.19-13.el8 --- .gitignore | 2 +- .ibus.metadata | 2 +- SOURCES/ibus-1897548-emoji-unicode.patch | 288 +++++++++++++++++++++++ SPECS/ibus.spec | 28 ++- 4 files changed, 315 insertions(+), 5 deletions(-) create mode 100644 SOURCES/ibus-1897548-emoji-unicode.patch diff --git a/.gitignore b/.gitignore index da491fc..50c6f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/ibus-1.5.19.tar.gz -SOURCES/ibus-po-1.5.19-20180822.tar.gz +SOURCES/ibus-po-1.5.19-20210706.tar.gz diff --git a/.ibus.metadata b/.ibus.metadata index 9765a27..bd3d283 100644 --- a/.ibus.metadata +++ b/.ibus.metadata @@ -1,2 +1,2 @@ fdda025d81247e40ad7acf953c2a0a606d18e965 SOURCES/ibus-1.5.19.tar.gz -36b017eddba8bc0dd970acaa2cab41d0053d6c9f SOURCES/ibus-po-1.5.19-20180822.tar.gz +236f5dc3c072d0587e107ae75084454c791bbf73 SOURCES/ibus-po-1.5.19-20210706.tar.gz diff --git a/SOURCES/ibus-1897548-emoji-unicode.patch b/SOURCES/ibus-1897548-emoji-unicode.patch new file mode 100644 index 0000000..556ad16 --- /dev/null +++ b/SOURCES/ibus-1897548-emoji-unicode.patch @@ -0,0 +1,288 @@ +From cddde2dbcbb4d78a32c342c7416aef9a5c5eb7cd Mon Sep 17 00:00:00 2001 +From: Takao Fujiwara +Date: Thu, 8 Jul 2021 03:58:09 -0400 +Subject: [PATCH] Backport IBus Unicode feature + +--- + ui/gtk3/emojier.vala | 37 ++++++++++++++-------- + ui/gtk3/emojierapp.vala | 66 +++++++++++++++++++++++++++------------ + ui/gtk3/panelbinding.vala | 13 ++++++-- + 3 files changed, 80 insertions(+), 36 deletions(-) + +diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala +index 3eac2f2..9e6e926 100644 +--- a/ui/gtk3/emojier.vala ++++ b/ui/gtk3/emojier.vala +@@ -2,7 +2,7 @@ + * + * ibus - The Input Bus + * +- * Copyright (c) 2017-2018 Takao Fujiwara ++ * Copyright (c) 2017-2019 Takao Fujiwara + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -320,6 +320,7 @@ public class IBusEmojier : Gtk.ApplicationWindow { + + public signal void candidate_clicked(uint index, uint button, uint state); + public signal void commit_text(string text); ++ public signal void cancel(); + + public IBusEmojier() { + GLib.Object( +@@ -864,7 +865,7 @@ public class IBusEmojier : Gtk.ApplicationWindow { + row.get_allocation(out alloc); + var adjustment = m_scrolled_window.get_vadjustment(); + adjustment.clamp_page(alloc.y, alloc.y + alloc.height); +- return_val_if_fail(m_category_active_index >= 0, false); ++ return_if_fail(m_category_active_index >= 0); + m_lookup_table.set_cursor_pos((uint)m_category_active_index); + } + +@@ -936,8 +937,13 @@ public class IBusEmojier : Gtk.ApplicationWindow { + update_unicode_blocks(); + return; + } else { +- unowned GLib.SList emojis = +- m_category_to_emojis_dict.lookup(category); ++ // Use copy_deep() since vala 0.43.4 does not allow to assign ++ // a weak pointer to the full one in SList: ++ // emojier.vala:885.48-886.62: error: Assignment: Cannot convert ++ // from `GLib.SList' to `GLib.SList?' ++ GLib.SList emojis = ++ m_category_to_emojis_dict.lookup(category).copy_deep( ++ GLib.strdup); + m_lookup_table.clear(); + m_candidate_panel_mode = true; + foreach (unowned string emoji in emojis) { +@@ -1601,8 +1607,8 @@ public class IBusEmojier : Gtk.ApplicationWindow { + m_vbox.add(widget); + widget.show_all(); + } +- unowned GLib.SList? annotations = +- data.get_annotations(); ++ GLib.SList annotations = ++ data.get_annotations().copy_deep(GLib.strdup); + var buff = new GLib.StringBuilder(); + int i = 0; + foreach (unowned string annotation in annotations) { +@@ -1784,8 +1790,7 @@ public class IBusEmojier : Gtk.ApplicationWindow { + show_emoji_variants(emojis); + return true; + } +- if (m_input_context_path != "") +- m_result = text; ++ m_result = text; + if (need_commit_signal) + commit_text(text); + return false; +@@ -1892,6 +1897,7 @@ public class IBusEmojier : Gtk.ApplicationWindow { + // PageUp/PageDown. + remove_all_children(); + } ++ cancel(); + return false; + } + +@@ -2055,17 +2061,20 @@ public class IBusEmojier : Gtk.ApplicationWindow { + ) as IBus.EmojiData; + m_emoji_to_data_dict.insert(favorite, new_data); + } else { +- unowned GLib.SList annotations = data.get_annotations(); ++ GLib.SList annotations = ++ data.get_annotations().copy_deep(GLib.strdup); + if (annotations.find_custom(annotation, GLib.strcmp) == null) { + annotations.append(annotation); +- data.set_annotations(annotations.copy()); ++ data.set_annotations(annotations.copy_deep(GLib.strdup)); + } + } + unowned GLib.SList emojis = + m_annotation_to_emojis_dict.lookup(annotation); + if (emojis.find_custom(favorite, GLib.strcmp) == null) { + emojis.append(favorite); +- m_annotation_to_emojis_dict.replace(annotation, emojis.copy()); ++ m_annotation_to_emojis_dict.replace( ++ annotation, ++ emojis.copy_deep(GLib.strdup)); + } + } + } +@@ -2117,7 +2126,7 @@ public class IBusEmojier : Gtk.ApplicationWindow { + public string get_current_candidate() { + // If category_list mode, do not show the category name on preedit. + // If candidate_panel mode, the first space key does not show the +- // lookup table but the first candidate is avaiable on preedit. ++ // lookup table but the first candidate is available on preedit. + if (!m_candidate_panel_mode) + return ""; + uint cursor = m_lookup_table.get_cursor_pos(); +@@ -2139,11 +2148,13 @@ public class IBusEmojier : Gtk.ApplicationWindow { + ncandidates)); + int char_count = text.text.char_count(); + int start_index = -1; ++ unowned string title = text.text; + for (int i = 0; i < char_count; i++) { +- if (text.text.utf8_offset(i).has_prefix(language)) { ++ if (title.has_prefix(language)) { + start_index = i; + break; + } ++ title = title.next_char(); + } + if (start_index >= 0) { + var attr = new IBus.Attribute( +diff --git a/ui/gtk3/emojierapp.vala b/ui/gtk3/emojierapp.vala +index fab99d9..783c611 100644 +--- a/ui/gtk3/emojierapp.vala ++++ b/ui/gtk3/emojierapp.vala +@@ -3,6 +3,7 @@ + * ibus - The Input Bus + * + * Copyright (c) 2017 Peng Wu ++ * Copyright (c) 2017-2019 Takao Fujiwara + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -40,6 +41,33 @@ public class EmojiApplication : Gtk.Application { + } + + ++ private void save_selected_string(string? selected_string, ++ bool cancelled) { ++ if (cancelled) { ++ m_command_line.print("%s\n", _("Canceled to choose an emoji.")); ++ return; ++ } ++ GLib.return_if_fail(selected_string != null); ++ Gtk.Clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD); ++ clipboard.set_text(selected_string, -1); ++ clipboard.store(); ++ ++ var emojier_favorites = m_settings_emoji.get_strv("favorites"); ++ bool has_favorite = false; ++ foreach (unowned string favorite in emojier_favorites) { ++ if (favorite == selected_string) { ++ has_favorite = true; ++ break; ++ } ++ } ++ if (!has_favorite) { ++ emojier_favorites += selected_string; ++ m_settings_emoji.set_strv("favorites", emojier_favorites); ++ } ++ m_command_line.print("%s\n", _("Copied an emoji to your clipboard.")); ++ } ++ ++ + private void show_dialog(ApplicationCommandLine command_line) { + m_command_line = command_line; + m_emojier.reset(); +@@ -55,7 +83,7 @@ public class EmojiApplication : Gtk.Application { + return; + if (button == IBusEmojier.BUTTON_CLOSE_BUTTON) { + m_emojier.hide(); +- m_command_line.print("%s\n", _("Canceled to choose an emoji.")); ++ save_selected_string(null, true); + m_command_line = null; + return; + } +@@ -74,23 +102,7 @@ public class EmojiApplication : Gtk.Application { + } + string emoji = m_emojier.get_current_candidate(); + m_emojier.hide(); +- Gtk.Clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD); +- clipboard.set_text(emoji, -1); +- clipboard.store(); +- +- var emojier_favorites = m_settings_emoji.get_strv("favorites"); +- bool has_favorite = false; +- foreach (unowned string favorite in emojier_favorites) { +- if (favorite == emoji) { +- has_favorite = true; +- break; +- } +- } +- if (!has_favorite) { +- emojier_favorites += emoji; +- m_settings_emoji.set_strv("favorites", emojier_favorites); +- } +- m_command_line.print("%s\n", _("Copied an emoji to your clipboard.")); ++ save_selected_string(emoji, false); + m_command_line = null; + } + +@@ -202,6 +214,21 @@ public class EmojiApplication : Gtk.Application { + m_emojier.candidate_clicked.connect((i, b, s) => { + candidate_clicked_lookup_table(i, b, s); + }); ++ m_emojier.cancel.connect(() => { ++ if (m_command_line == null) ++ return; ++ m_emojier.hide(); ++ save_selected_string(null, true); ++ m_command_line = null; ++ }); ++ m_emojier.commit_text.connect(() => { ++ if (m_command_line == null) ++ return; ++ m_emojier.hide(); ++ string selected_string = m_emojier.get_selected_string(); ++ save_selected_string(selected_string, false); ++ m_command_line = null; ++ }); + } + + activate_dialog(command_line); +diff --git a/ui/gtk3/panelbinding.vala b/ui/gtk3/panelbinding.vala +index cfedb2d..861255b 100644 +--- a/ui/gtk3/panelbinding.vala ++++ b/ui/gtk3/panelbinding.vala +@@ -3,7 +3,7 @@ + * ibus - The Input Bus + * + * Copyright(c) 2018 Peng Huang +- * Copyright(c) 2018 Takao Fujwiara ++ * Copyright(c) 2018-2020 Takao Fujwiara + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -190,7 +190,7 @@ class Preedit : Gtk.Window { + + public IBus.Text get_commit_text() { + string extension_text = m_extension_preedit_emoji.get_text(); +- if (extension_text.length == 0) ++ if (extension_text.length == 0 && m_prefix != "u") + extension_text = m_extension_preedit_text.get_text(); + return new IBus.Text.from_string(extension_text); + } +@@ -237,9 +237,14 @@ class PanelBinding : IBus.PanelService { + GLib.Object(connection : bus.get_connection(), + object_path : IBus.PATH_PANEL_EXTENSION_EMOJI); + ++#if USE_GDK_WAYLAND + Type instance_type = Gdk.Display.get_default().get_type(); + Type wayland_type = typeof(GdkWayland.Display); + m_is_wayland = instance_type.is_a(wayland_type); ++#else ++ m_is_wayland = false; ++ warning("Checking Wayland is disabled"); ++#endif + + m_bus = bus; + m_application = application; +@@ -551,8 +556,10 @@ class PanelBinding : IBus.PanelService { + + private bool key_press_keyval(uint keyval) { + unichar ch = IBus.keyval_to_unicode(keyval); ++ if (m_extension_name == "unicode" && !ch.isxdigit()) ++ return false; + if (ch.iscntrl()) +- return false; ++ return false; + string str = ch.to_string(); + m_preedit.append_text(str); + string annotation = m_preedit.get_text(); +-- +2.18.2 + diff --git a/SPECS/ibus.spec b/SPECS/ibus.spec index 2814f36..edefe58 100644 --- a/SPECS/ibus.spec +++ b/SPECS/ibus.spec @@ -31,7 +31,7 @@ Name: ibus Version: 1.5.19 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -39,7 +39,7 @@ URL: https://github.com/ibus/%name/wiki Source0: https://github.com/ibus/%name/releases/download/%{version}/%{name}-%{version}.tar.gz Source1: %{name}-xinput Source2: %{name}.conf.5 -Source3: https://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.5.19-20180822.tar.gz +Source3: https://fujiwara.fedorapeople.org/ibus/po/%{name}-po-1.5.19-20210706.tar.gz # Patch0: %%{name}-HEAD.patch # RHEL 8.0 From upstreamed patches Patch0: %{name}-HEAD.patch @@ -57,6 +57,8 @@ Patch5: %{name}-1750836-server-auth-observer.patch Patch6: %{name}-1682157-ci.patch # RHEL 8.2 Bug 1713606 - Fix hangul preedit commit with mouse click Patch7: %{name}-1713606-hangul-with-mouse.patch +# RHEL 8.5 Bug 1897548 - Enable to lookup Unicode names +Patch8: %{name}-1897548-emoji-unicode.patch # RHEL 8.0 Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577 Patch100: %{name}-1385349-segv-bus-proxy.patch @@ -68,7 +70,6 @@ BuildRequires: glib2-doc BuildRequires: gtk2-devel BuildRequires: gtk3-devel BuildRequires: dbus-glib-devel -BuildRequires: dbus-python-devel >= %{dbus_python_version} BuildRequires: desktop-file-utils BuildRequires: gtk-doc BuildRequires: dconf-devel @@ -80,6 +81,7 @@ BuildRequires: python3-gobject # https://bugzilla.gnome.org/show_bug.cgi?id=759334 # Need python2 for gsettings-schema-convert BuildRequires: python2-devel +BuildRequires: dbus-python-devel >= %{dbus_python_version} %endif BuildRequires: vala BuildRequires: vala-devel @@ -285,6 +287,15 @@ cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : zcat %SOURCE3 | tar xfv - +cp /usr/share/unicode/ucd/Blocks.txt . +NL=/usr/share/unicode/ucd/NamesList.txt +sed -e '/^@@.*3300.*CJK Compatibility/i\ +@ Japanese era name\ +32FF SQUARE ERA NAME REIWA\ + # 4EE4 548C' $NL > NamesList.txt +diff $NL NamesList.txt || : + + # prep test for f in ibusimcontext.c ibusim.c do @@ -319,11 +330,15 @@ autoreconf -f -i -v %endif --enable-introspection \ --enable-install-tests \ + --with-ucd-dir=$PWD \ %{nil} make -C ui/gtk3 maintainer-clean-generic make %{?_smp_mflags} +env PAGER=: git diff src/ibusemojigen.h +env PAGER=: git diff src/ibusunicodegen.h + %install make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' rm -f $RPM_BUILD_ROOT%{_libdir}/libibus-*%{ibus_api_version}.la @@ -486,6 +501,13 @@ dconf update || : %{_datadir}/installed-tests/ibus %changelog +* Tue Jul 06 2021 Takao Fujiwara - 1.5.19-13 +- Resolves: #1897548 - Rebuild IBus emoji with unicode-emoji-13.0-4 and cldr-emoji-annotation-39-2 +- Rebuild ibusemojigen.h and ibusunicodegen.h +- Add ibus-1897548-emoji-unicode.patch to lookup Unicode names +- Add U+32FF to IBusUnicodeData +- Add ibus-po-1.5.19-20210706.tar.gz + * Thu Jun 04 2020 Takao Fujiwara - 1.5.19-12 - Resolves: #1713606 - Fix hangul preedit commit with mouse click - Update 1682157-ci.patch