diff options
-rw-r--r-- | src/ZYZPhoneticEditor.h | 3 | ||||
-rw-r--r-- | src/ZYZZhuyinEngine.cc | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ZYZPhoneticEditor.h b/src/ZYZPhoneticEditor.h index cd38d04..ae82615 100644 --- a/src/ZYZPhoneticEditor.h +++ b/src/ZYZPhoneticEditor.h @@ -30,6 +30,8 @@ namespace ZY { +class ZhuyinEngine; + class PhoneticSection; typedef std::shared_ptr<PhoneticSection> PhoneticSectionPtr; @@ -37,6 +39,7 @@ class SymbolSection; typedef std::shared_ptr<SymbolSection> SymbolSectionPtr; class PhoneticEditor : public EnhancedEditor { + friend class ZhuyinEngine; friend class SymbolSection; friend class PhoneticSection; diff --git a/src/ZYZZhuyinEngine.cc b/src/ZYZZhuyinEngine.cc index 596386d..55cf039 100644 --- a/src/ZYZZhuyinEngine.cc +++ b/src/ZYZZhuyinEngine.cc @@ -96,12 +96,20 @@ ZhuyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers) triggered = TRUE; } - if (triggered && m_editors[m_input_mode]->text ().empty ()) { + if (triggered) { + /* ibus-chewing always switch Chinese mode, + when the shift key is pressed. */ + PhoneticEditor *editor = dynamic_cast<PhoneticEditor *> + (m_editors[MODE_INIT].get ()); + assert (NULL != editor); + /* switch input editor. */ m_props.toggleModeChinese (); switch (m_input_mode) { case MODE_INIT: + if (editor->text ().size ()) + editor->commit (); m_input_mode = MODE_RAW; break; case MODE_RAW: |