diff options
author | Peng Wu <alexepico@gmail.com> | 2018-03-15 15:29:30 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2018-03-15 15:29:30 +0800 |
commit | 279a9da2cad9e0f5ee7c20f8a132b074eae67f34 (patch) | |
tree | 4014b2dd1cd1bb67c2cb50694be684b681bfadb7 /src/PYPBopomofoEditor.cc | |
parent | 942ba12b23960db691f092a76dd559f79931d675 (diff) | |
download | ibus-libpinyin-279a9da2cad9e0f5ee7c20f8a132b074eae67f34.tar.gz ibus-libpinyin-279a9da2cad9e0f5ee7c20f8a132b074eae67f34.tar.xz ibus-libpinyin-279a9da2cad9e0f5ee7c20f8a132b074eae67f34.zip |
fixes enter key
Diffstat (limited to 'src/PYPBopomofoEditor.cc')
-rw-r--r-- | src/PYPBopomofoEditor.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index 4588a34..5b9fa26 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -166,7 +166,7 @@ BopomofoEditor::processSelectKey (guint keyval, guint keycode, gboolean BopomofoEditor::processBopomofo (guint keyval, guint keycode, - guint modifiers) + guint modifiers) { if (G_UNLIKELY (cmshm_filter (modifiers) != 0)) return m_text ? TRUE : FALSE; @@ -211,6 +211,20 @@ BopomofoEditor::processKeyEvent (guint keyval, guint keycode, m_select_mode = TRUE; return processSpace (keyval, keycode, modifiers); + case IBUS_Return: + case IBUS_KP_Enter: + /* no user input */ + if (m_text.empty ()) + return FALSE; + + if (m_config.enterKey ()) + commit (); + else + PhoneticEditor::commit (m_text.c_str ()); + + reset (); + return TRUE; + case IBUS_Up: case IBUS_KP_Up: case IBUS_Down: case IBUS_KP_Down: case IBUS_Page_Up: case IBUS_KP_Page_Up: |