From: Peng Huang Date: Tue, 18 Jan 2011 15:12:40 +0000 (-0500) Subject: Do not handle release key events, if engine is in init mode. X-Git-Tag: 1.4.0~188 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a142d959cdba0406a2c614fadfa9367803c31286;p=platform%2Fupstream%2Fibus-libpinyin.git 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 --- 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 */