--- ibus-1.5.18/src/ibusenginesimple.c.orig	2018-05-28 16:06:35.470256814 +0900
+++ ibus-1.5.18/src/ibusenginesimple.c	2018-05-28 16:58:24.661274712 +0900
@@ -2,7 +2,7 @@
 /* vim:set et sts=4: */
 /* ibus - The Input Bus
  * Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
  * Copyright (C) 2014-2017 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -30,8 +30,10 @@
 #include "ibusenginesimple.h"
 #include "ibusenginesimpleprivate.h"
 
+#include "ibusinternal.h"
 #include "ibuskeys.h"
 #include "ibuskeysyms.h"
+#include "ibusmarshalers.h"
 #include "ibusutil.h"
 
 /* This file contains the table of the compose sequences,
@@ -69,6 +71,11 @@
         (index) = EMOJI_SOURCE_LEN;                                     \
 }
 
+enum {
+    COMMITTING_TEXT,
+    LAST_SIGNAL
+};
+
 typedef struct {
     GHashTable *dict;
     int         max_seq_len;
@@ -102,6 +109,8 @@ const IBusComposeTableCompact ibus_compo
 };
 
 static GSList *global_tables;
+static guint   simple_signals[LAST_SIGNAL] = { 0 };
+
 
 /* functions prototype */
 static void     ibus_engine_simple_destroy      (IBusEngineSimple   *simple);
@@ -130,6 +139,7 @@ G_DEFINE_TYPE (IBusEngineSimple, ibus_en
 static void
 ibus_engine_simple_class_init (IBusEngineSimpleClass *class)
 {
+    GObjectClass *gobject_class = G_OBJECT_CLASS (class);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
     IBusEngineClass *engine_class = IBUS_ENGINE_CLASS (class);
 
@@ -144,6 +154,36 @@ ibus_engine_simple_class_init (IBusEngin
     engine_class->candidate_clicked
                             = ibus_engine_simple_candidate_clicked;
 
+    /* install signals */
+    /**
+     * IBusEngineSimple::committing-text:
+     * @simple: An #IBusEngineSimple.
+     * @text: A committing #IBusText.
+     *
+     * Emitted before @text is committed.
+     * Your engine needs to inherit IBusEngineSimple to forward the key events
+     * to the parent IBusEngimpeSimple. And if the forwarded key events are
+     * matched to compose sequences, this signal is emitted with a compose
+     * string. @text can be an output of the compose sequences likes "á".
+     * IBusEngineSimpleClass::committing-text signal can be connected.
+     *
+     * Returns: %TRUE if your engine let IBusEngineSimple to commit the text;
+     *          %FALSE otherwise.
+     *
+     * <note><para>Argument @user_data is ignored in this function.</para>
+     * </note>
+     */
+    simple_signals[COMMITTING_TEXT] =
+        g_signal_new (I_("committing-text"),
+            G_TYPE_FROM_CLASS (gobject_class),
+            G_SIGNAL_RUN_LAST,
+            0,
+            g_signal_accumulator_true_handled, NULL,
+            _ibus_marshal_BOOLEAN__OBJECT,
+            G_TYPE_BOOLEAN,
+            1,
+            IBUS_TYPE_TEXT);
+
     g_type_class_add_private (class, sizeof (IBusEngineSimplePrivate));
 }
 
@@ -198,6 +238,21 @@ ibus_engine_simple_reset (IBusEngine *en
 }
 
 static void
+ibus_engine_simple_commit_text_with_signal (IBusEngineSimple *simple,
+                                            IBusText         *text)
+{
+    gboolean retval = FALSE;
+    g_signal_emit (simple,
+                   simple_signals[COMMITTING_TEXT],
+                   0,
+                   text,
+                   &retval);
+    if (retval)
+        return;
+    ibus_engine_commit_text ((IBusEngine *)simple, text);
+}
+
+static void
 ibus_engine_simple_commit_char (IBusEngineSimple *simple,
                                 gunichar          ch)
 {
@@ -217,7 +272,8 @@ ibus_engine_simple_commit_char (IBusEngi
         ibus_engine_simple_update_preedit_text (simple);
     }
 
-    ibus_engine_commit_text ((IBusEngine *)simple,
+    ibus_engine_simple_commit_text_with_signal (
+            simple,
             ibus_text_new_from_unichar (ch));
 }
 
@@ -244,7 +300,8 @@ ibus_engine_simple_commit_str (IBusEngin
         ibus_engine_simple_update_preedit_text (simple);
     }
 
-    ibus_engine_commit_text ((IBusEngine *)simple,
+    ibus_engine_simple_commit_text_with_signal (
+            simple,
             ibus_text_new_from_string (backup_str));
     g_free (backup_str);
 }
--- ibus-1.5.18/src/ibusmarshalers.list.orig	2018-05-28 16:29:18.100721430 +0900
+++ ibus-1.5.18/src/ibusmarshalers.list	2018-05-28 16:54:35.662334809 +0900
@@ -9,6 +9,7 @@ BOOL:POINTER,POINTER
 BOOL:UINT,UINT
 BOOL:UINT,UINT,UINT
 BOOL:ULONG
+BOOLEAN:OBJECT
 VOID:INT,INT,INT,INT
 VOID:UINT,UINT
 VOID:INT,UINT
--- ibus-1.5.18/po/POTFILES.in.orig	2018-05-28 18:16:54.847361592 +0900
+++ ibus-1.5.18/po/POTFILES.in	2018-05-28 18:17:08.031358849 +0900
@@ -43,6 +43,7 @@ src/ibusbus.c
 src/ibusconfig.c
 src/ibusemojigen.h
 src/ibusengine.c
+src/ibusenginesimple.c
 src/ibusfactory.c
 src/ibushotkey.c
 src/ibusinputcontext.c
