summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2011-01-18 10:12:40 -0500
committerPeng Huang <shawn.p.huang@gmail.com>2011-01-18 10:12:40 -0500
commita142d959cdba0406a2c614fadfa9367803c31286 (patch)
tree99d435039c3b2578fddccf7e4ca88b4ab1916308 /src
parent15b9b66b013ee83974b3ae16a76983cc10e9dbe8 (diff)
downloadibus-libpinyin-a142d959cdba0406a2c614fadfa9367803c31286.tar.gz
ibus-libpinyin-a142d959cdba0406a2c614fadfa9367803c31286.tar.xz
ibus-libpinyin-a142d959cdba0406a2c614fadfa9367803c31286.zip
Do not handle release key events, if engine is in init mode.
Most application only process key press events, but some process key release events. This change will let Pinyin engine to ignore some release events in init mode, and let applications have chance to get release key events. BUG=none TEST=Test within Ubuntu 10.10 Review URL: http://codereview.appspot.com/3975042
Diffstat (limited to 'src')
-rw-r--r--src/PYBopomofoEngine.cc12
-rw-r--r--src/PYPinyinEngine.cc12
2 files changed, 22 insertions, 2 deletions
diff --git a/src/PYBopomofoEngine.cc b/src/PYBopomofoEngine.cc
index a46f229..5945eb6 100644
--- a/src/PYBopomofoEngine.cc
+++ b/src/PYBopomofoEngine.cc
@@ -82,9 +82,19 @@ BopomofoEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers)
if (!m_editors[MODE_INIT]->text ().empty ())
m_editors[MODE_INIT]->reset ();
m_props.toggleModeChinese ();
+ return TRUE;
}
}
- return TRUE;
+
+ if (m_input_mode == MODE_INIT &&
+ m_editors[MODE_INIT]->text ().empty ()) {
+ /* If it is init mode, and no any previouse input text,
+ * we will let client applications to handle release key event */
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
}
/* Toggle simp/trad Chinese Mode when hotkey Ctrl + Shift + F pressed */
diff --git a/src/PYPinyinEngine.cc b/src/PYPinyinEngine.cc
index 9f7c167..f773675 100644
--- a/src/PYPinyinEngine.cc
+++ b/src/PYPinyinEngine.cc
@@ -84,9 +84,19 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers)
if (!m_editors[MODE_INIT]->text ().empty ())
m_editors[MODE_INIT]->reset ();
m_props.toggleModeChinese ();
+ return TRUE;
}
}
- return TRUE;
+
+ if (m_input_mode == MODE_INIT &&
+ m_editors[MODE_INIT]->text ().empty ()) {
+ /* If it is init mode, and no any previouse input text,
+ * we will let client applications to handle release key event */
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
}
/* Toggle simp/trad Chinese Mode when hotkey Ctrl + Shift + F pressed */