summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-06-05 13:59:30 +0800
committerPeng Wu <alexepico@gmail.com>2015-06-05 13:59:30 +0800
commit0756be97e0cf85e926183fc842ab173a03429db6 (patch)
tree7cd3c9753cdc0d184b938f8e3e1030af24c394af /src
parentedde3c5afc1d617cd4261c7c502739cc50a5b1a4 (diff)
downloadibus-libzhuyin-0756be97e0cf85e926183fc842ab173a03429db6.tar.gz
ibus-libzhuyin-0756be97e0cf85e926183fc842ab173a03429db6.tar.xz
ibus-libzhuyin-0756be97e0cf85e926183fc842ab173a03429db6.zip
fixes shift behavior
Diffstat (limited to 'src')
-rw-r--r--src/ZYZPhoneticEditor.h3
-rw-r--r--src/ZYZZhuyinEngine.cc10
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: