public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Takao Fujiwara <tfujiwar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ibus] autotool: Fix Bug 1618682 - SEGV with ASCII on emojier in Wayland
Date: Sun, 31 May 2026 02:06:58 GMT	[thread overview]
Message-ID: <178019321893.1.12256700967552974425.rpms-ibus-3a447b791643@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/ibus
            Branch : autotool
            Commit : 3a447b7916433fa39d3885713cf537f6b53c5b7f
            Author : Takao Fujiwara <tfujiwar@redhat.com>
            Date   : 2018-08-30T13:44:22+09:00
            Stats  : +365/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/ibus/c/3a447b7916433fa39d3885713cf537f6b53c5b7f?branch=autotool

            Log:
            Fix Bug 1618682 - SEGV with ASCII on emojier in Wayland

- Support Shift-Space on emojier preedit
- Do not move Emojier popup with the active candidate in Xorg

---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index c983a4a..2bbad4b 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -35,3 +35,360 @@ index 85dcdceb..637ae049 100644
 -- 
 2.17.1
 
+From 28d22176aee6be97d88dd6c60fa5395c79563ec0 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Thu, 30 Aug 2018 12:57:33 +0900
+Subject: [PATCH] ui/gtk3: Fix SEGV when type ASCII on emojier
+
+Emojier still included Gtk.Entry, accepted key events in Wayland,
+reset the lookup table and it caused SEGV because IBus.Text
+is NULL in the lookup table in Emojier.get_current_candidate().
+Now Gtk.Entry is deleted completely.
+
+BUG=rhbz#1618682
+---
+ ui/gtk3/emojier.vala | 139 +------------------------------------------
+ 1 file changed, 1 insertion(+), 138 deletions(-)
+
+diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
+index 637ae049..0f455800 100644
+--- a/ui/gtk3/emojier.vala
++++ b/ui/gtk3/emojier.vala
+@@ -283,7 +283,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+ 
+     private ThemedRGBA m_rgba;
+     private Gtk.Box m_vbox;
+-    private EEntry m_entry;
+     /* If emojier is emoji category list or Unicode category list,
+      * m_annotation is "" and preedit is also "".
+      * If emojier is candidate mode, m_annotation is an annotation and
+@@ -367,23 +366,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+         m_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
+         add(m_vbox);
+ 
+-        m_entry = new EEntry();
+-        m_entry.set_placeholder_text(_("Type annotation or choose emoji"));
+-        //m_vbox.add(m_entry);
+-        m_entry.changed.connect(() => {
+-            update_candidate_window();
+-        });
+-        m_entry.icon_release.connect((icon_pos, event) => {
+-            hide_candidate_panel();
+-        });
+-
+-        /* Set the accessible role of the label to a status bar so it
+-         * will emit name changed events that can be used by screen
+-         * readers.
+-         */
+-        Atk.Object obj = m_entry.get_accessible();
+-        obj.set_role (Atk.Role.STATUSBAR);
+-
+         // The constructor of IBus.LookupTable does not support more than
+         // 16 pages.
+         m_lookup_table = new IBus.LookupTable(1, 0, true, true);
+@@ -1806,18 +1788,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+                 m_lookup_table.cursor_up();
+             else if (keyval == Gdk.Key.Right)
+                 m_lookup_table.cursor_down();
+-        } else if (m_entry.get_text().length > 0) {
+-            int step = 0;
+-            if (keyval == Gdk.Key.Left)
+-                step = -1;
+-            else if (keyval == Gdk.Key.Right)
+-                step = 1;
+-            GLib.Signal.emit_by_name(
+-                    m_entry, "move-cursor",
+-                    Gtk.MovementStep.VISUAL_POSITIONS,
+-                    step,
+-                    (modifiers & Gdk.ModifierType.SHIFT_MASK) != 0
+-                            ? true : false);
+         } else {
+             // For Gdk.Key.f and Gdk.Key.b
+             if (keyval == Gdk.Key.Left)
+@@ -1880,20 +1850,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+             }
+             return true;
+         }
+-        if (m_entry.get_text().length > 0) {
+-            int step = 0;
+-            if (keyval == Gdk.Key.Home)
+-                step = -1;
+-            else if (keyval == Gdk.Key.End)
+-                step = 1;
+-            GLib.Signal.emit_by_name(
+-                    m_entry, "move-cursor",
+-                    Gtk.MovementStep.DISPLAY_LINE_ENDS,
+-                    step,
+-                    (modifiers & Gdk.ModifierType.SHIFT_MASK) != 0
+-                            ? true : false);
+-            return true;
+-        }
+         return category_list_cursor_move(keyval);
+     }
+ 
+@@ -1941,28 +1897,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+     }
+ 
+ 
+-    private void entry_enter_keyval(uint keyval) {
+-        unichar ch = IBus.keyval_to_unicode(keyval);
+-        if (ch.iscntrl())
+-            return;
+-        string str = ch.to_string();
+-
+-        // what gtk_entry_commit_cb() do
+-        if (m_entry.get_selection_bounds(null, null)) {
+-            m_entry.delete_selection();
+-        } else {
+-            if (m_entry.get_overwrite_mode()) {
+-               uint text_length = m_entry.get_buffer().get_length();
+-               if (m_entry.cursor_position < text_length)
+-                   m_entry.delete_from_cursor(Gtk.DeleteType.CHARS, 1);
+-            }
+-        }
+-        int pos = m_entry.get_position();
+-        m_entry.insert_text(str, -1, ref pos);
+-        m_entry.set_position(pos);
+-    }
+-
+-
+     private Gdk.Rectangle get_monitor_geometry() {
+         Gdk.Rectangle monitor_area = { 0, };
+ 
+@@ -2245,10 +2179,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+         /* Let gtk recalculate the window size. */
+         resize(1, 1);
+ 
+-        m_entry.set_text("");
+-
+         show_category_list();
+-        m_entry.set_activates_default(true);
+         show_all();
+ 
+         /* Some window managers, e.g. MATE, GNOME, Plasma desktops,
+@@ -2289,13 +2220,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+         m_loop.run();
+         m_loop = null;
+ 
+-        // Need focus-out on Gtk.Entry to send the emoji to applications.
+-        Gdk.Event fevent = new Gdk.Event(Gdk.EventType.FOCUS_CHANGE);
+-        fevent.focus_change.in = 0;
+-        fevent.focus_change.window  = get_window();
+-        m_entry.send_focus_change(fevent);
+-        fevent.focus_change.window  = null;
+-
+         hide();
+         // Make sure the switcher is hidden before returning from this function.
+         while (Gtk.events_pending())
+@@ -2357,36 +2281,9 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+                 hide();
+             }
+             return true;
+-        case Gdk.Key.BackSpace:
+-            if (m_entry.get_text().length > 0) {
+-                if ((modifiers & Gdk.ModifierType.CONTROL_MASK) != 0) {
+-                    GLib.Signal.emit_by_name(m_entry, "delete-from-cursor",
+-                                             Gtk.DeleteType.WORD_ENDS, -1);
+-                } else {
+-                    GLib.Signal.emit_by_name(m_entry, "backspace");
+-                }
+-                return true;
+-            }
+-            break;
+-        case Gdk.Key.Delete:
+-        case Gdk.Key.KP_Delete:
+-            if (m_entry.get_text().length > 0) {
+-                if ((modifiers & Gdk.ModifierType.CONTROL_MASK) != 0) {
+-                    GLib.Signal.emit_by_name(m_entry, "delete-from-cursor",
+-                                             Gtk.DeleteType.WORD_ENDS, 1);
+-                } else {
+-                    GLib.Signal.emit_by_name(m_entry, "delete-from-cursor",
+-                                             Gtk.DeleteType.CHARS, 1);
+-                }
+-                return true;
+-            }
+-            break;
+         case Gdk.Key.space:
+         case Gdk.Key.KP_Space:
+-            if ((modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) {
+-                if (m_entry.get_text().length > 0)
+-                    entry_enter_keyval(keyval);
+-            } else if (m_candidate_panel_is_visible) {
++            if (m_candidate_panel_is_visible) {
+                 enter_notify_disable_with_timer();
+                 m_lookup_table.cursor_down();
+                 show_candidate_panel();
+@@ -2436,10 +2333,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+             key_press_cursor_home_end(Gdk.Key.End, modifiers);
+             show_all();
+             return true;
+-        case Gdk.Key.Insert:
+-        case Gdk.Key.KP_Insert:
+-            GLib.Signal.emit_by_name(m_entry, "toggle-overwrite");
+-            return true;
+         }
+ 
+         if ((modifiers & Gdk.ModifierType.CONTROL_MASK) != 0) {
+@@ -2470,27 +2363,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+                 key_press_cursor_home_end(Gdk.Key.End, modifiers);
+                 show_all();
+                 return true;
+-            case Gdk.Key.u:
+-                if (m_entry.get_text().length > 0) {
+-                    GLib.Signal.emit_by_name(m_entry,
+-                                             "delete-from-cursor",
+-                                             Gtk.DeleteType.PARAGRAPH_ENDS,
+-                                             -1);
+-                    return true;
+-                }
+-                break;
+-            case Gdk.Key.a:
+-                if (m_entry.get_text().length > 0) {
+-                    m_entry.select_region(0, -1);
+-                    return true;
+-                }
+-                break;
+-            case Gdk.Key.x:
+-                if (m_entry.get_text().length > 0) {
+-                    GLib.Signal.emit_by_name(m_entry, "cut-clipboard");
+-                    return true;
+-                }
+-                break;
+             case Gdk.Key.C:
+             case Gdk.Key.c:
+                 if ((modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) {
+@@ -2503,19 +2375,11 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+                         clipboard.store();
+                         return true;
+                     }
+-                } else if (m_entry.get_text().length > 0) {
+-                    GLib.Signal.emit_by_name(m_entry, "copy-clipboard");
+-                    return true;
+                 }
+                 break;
+-            case Gdk.Key.v:
+-                GLib.Signal.emit_by_name(m_entry, "paste-clipboard");
+-                return true;
+             }
+             return false;
+         }
+-
+-        entry_enter_keyval(keyval);
+         return true;
+     }
+ 
+@@ -2595,7 +2459,6 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+ 
+         uint32 timestamp = event.get_time();
+         present_with_time(timestamp);
+-        m_entry.set_activates_default(true);
+     }
+ 
+ 
+-- 
+2.17.1
+
+From e6badb494e0a31b7aca3a5078a5dc5b27b83390d Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Thu, 30 Aug 2018 12:57:46 +0900
+Subject: [PATCH] ui/gtk3: Support Shift-Space to insert a Space on Emojier
+ preedit
+
+Implemented Shift-Space on preedit since Shift-Space had worked on
+Emojier's GtkEntry in the previous release.
+---
+ ui/gtk3/panelbinding.vala | 27 ++++++++++++++++++++-------
+ 1 file changed, 20 insertions(+), 7 deletions(-)
+
+diff --git a/ui/gtk3/panelbinding.vala b/ui/gtk3/panelbinding.vala
+index 981b5509..4ebff8da 100644
+--- a/ui/gtk3/panelbinding.vala
++++ b/ui/gtk3/panelbinding.vala
+@@ -548,6 +548,19 @@ class PanelBinding : IBus.PanelService {
+     }
+ 
+ 
++    private bool key_press_keyval(uint keyval) {
++        unichar ch = IBus.keyval_to_unicode(keyval);
++        if (ch.iscntrl())
++                return false;
++        string str = ch.to_string();
++        m_preedit.append_text(str);
++        string annotation = m_preedit.get_text();
++        m_emojier.set_annotation(annotation);
++        m_preedit.set_emoji("");
++        return true;
++    }
++
++
+     private bool key_press_enter() {
+         if (m_extension_name != "unicode" && is_emoji_lookup_table()) {
+             // Check if variats exist
+@@ -899,6 +912,12 @@ class PanelBinding : IBus.PanelService {
+             break;
+         case Gdk.Key.space:
+         case Gdk.Key.KP_Space:
++            if ((modifiers & Gdk.ModifierType.SHIFT_MASK) != 0) {
++                if (!key_press_keyval(keyval))
++                    return true;
++                show_candidate = is_emoji_lookup_table();
++                break;
++            }
+             show_candidate = key_press_space();
+             if (m_extension_name == "unicode") {
+                 key_press_enter();
+@@ -979,14 +998,8 @@ class PanelBinding : IBus.PanelService {
+                 show_candidate = key_press_control_keyval(keyval, modifiers);
+                 break;
+             }
+-            unichar ch = IBus.keyval_to_unicode(keyval);
+-            if (ch.iscntrl())
++            if (!key_press_keyval(keyval))
+                 return true;
+-            string str = ch.to_string();
+-            m_preedit.append_text(str);
+-            string annotation = m_preedit.get_text();
+-            m_emojier.set_annotation(annotation);
+-            m_preedit.set_emoji("");
+             show_candidate = is_emoji_lookup_table();
+             break;
+         }
+-- 
+2.17.1
+
+From 809d880337e75b7cee429292a238bf53899bef6a Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Thu, 30 Aug 2018 12:58:57 +0900
+Subject: [PATCH] ui/gtk3: Do not move Emojier popup with the active
+ candidate in Xorg
+
+Probably I think it's not useful to change the popup position frequently.
+The popup size is always slightly changed with the emoji annotation length.
+---
+ ui/gtk3/emojier.vala | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
+index 0f455800..9811fde5 100644
+--- a/ui/gtk3/emojier.vala
++++ b/ui/gtk3/emojier.vala
+@@ -1944,7 +1944,15 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+             x = 0;
+ 
+         bool changed = false;
+-        if (window_right_bottom.y > monitor_bottom) {
++        // Do not up side down frequently.
++        // The first pos does not show the lookup table yet but the
++        // preedit only and the second pos shows the lookup table.
++        if (m_lookup_table.get_cursor_pos() != 1) {
++            if (m_is_up_side_down)
++                y = m_cursor_location.y - allocation.height;
++            else
++                y = cursor_right_bottom.y;
++        } else if (window_right_bottom.y > monitor_bottom) {
+             y = m_cursor_location.y - allocation.height;
+             // Do not up side down in Wayland
+             if (m_input_context_path == "") {
+-- 
+2.17.1
+

diff --git a/ibus.spec b/ibus.spec
index 463191e..c46f7d3 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -31,7 +31,7 @@
 
 Name:           ibus
 Version:        1.5.19
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Intelligent Input Bus for Linux OS
 License:        LGPLv2+
 Group:          System Environment/Libraries
@@ -78,6 +78,8 @@ BuildRequires:  qt5-qtbase-devel
 BuildRequires:  cldr-emoji-annotation
 BuildRequires:  unicode-emoji
 BuildRequires:  unicode-ucd
+# for ibus-keypress
+BuildRequires:  libXtst-devel
 
 Requires:       %{name}-libs%{?_isa}   = %{version}-%{release}
 Requires:       %{name}-gtk2%{?_isa}   = %{version}-%{release}
@@ -426,6 +428,11 @@ dconf update || :
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Thu Aug 30 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-3
+- Fix Bug 1618682 - SEGV with ASCII on emojier in Wayland
+- Support Shift-Space on emojier preedit
+- Do not move Emojier popup with the active candidate in Xorg
+
 * Wed Aug 22 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-2
 - Do not clear Unicode data when emoji annotation lang is changed
 

                 reply	other threads:[~2026-05-31  2:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178019321893.1.12256700967552974425.rpms-ibus-3a447b791643@fedoraproject.org \
    --to=tfujiwar@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox