diff options
author | Peng Wu <alexepico@gmail.com> | 2012-12-31 10:54:52 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-12-31 10:54:52 +0800 |
commit | 96ab2c13f03aee400def935e4ff0e9c68fe17b07 (patch) | |
tree | c3e05edc9ff7927bfccbea59098f65aaa253cd6e /src/PYPPinyinEngine.cc | |
parent | 477e9add7c6a009cc7a03077eddace878832b172 (diff) | |
download | ibus-libpinyin-96ab2c13f03aee400def935e4ff0e9c68fe17b07.tar.gz ibus-libpinyin-96ab2c13f03aee400def935e4ff0e9c68fe17b07.tar.xz ibus-libpinyin-96ab2c13f03aee400def935e4ff0e9c68fe17b07.zip |
add ctrl switch to pinyin engine
Diffstat (limited to 'src/PYPPinyinEngine.cc')
-rw-r--r-- | src/PYPPinyinEngine.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/PYPPinyinEngine.cc b/src/PYPPinyinEngine.cc index 4e5be29..ce74be1 100644 --- a/src/PYPPinyinEngine.cc +++ b/src/PYPPinyinEngine.cc @@ -100,20 +100,30 @@ LibPinyinPinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modif { gboolean retval = FALSE; - /* check Shift + Release hotkey, + /* check Shift or Ctrl + Release hotkey, * and then ignore other Release key event */ if (modifiers & IBUS_RELEASE_MASK) { /* press and release keyval are same, * and no other key event between the press and release key event */ + gboolean triggered = FALSE; + if (m_prev_pressed_key == keyval){ - if (keyval == IBUS_Shift_L || keyval == IBUS_Shift_R) { - if (!m_editors[MODE_INIT]->text ().empty ()) - m_editors[MODE_INIT]->reset (); - m_props.toggleModeChinese (); - return TRUE; + if (LibPinyinPinyinConfig::instance ().ctrlSwitch ()) { + if (keyval == IBUS_Control_L || keyval == IBUS_Control_R) + triggered = TRUE; + } else { + if (keyval == IBUS_Shift_L || keyval == IBUS_Shift_R) + triggered = TRUE; } } + if (triggered) { + if (!m_editors[MODE_INIT]->text ().empty ()) + m_editors[MODE_INIT]->reset (); + m_props.toggleModeChinese (); + return TRUE; + } + if (m_input_mode == MODE_INIT && m_editors[MODE_INIT]->text ().empty ()) { /* If it is in init mode, and no any previous input text, |