diff options
author | Peng Wu <alexepico@gmail.com> | 2012-12-31 11:02:52 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-12-31 11:02:52 +0800 |
commit | 8868b88483de6f92b8c7f35604540f30c2dd6816 (patch) | |
tree | 15898741376ac4e5afbe83f2bc1453406f3a8f0e | |
parent | 96ab2c13f03aee400def935e4ff0e9c68fe17b07 (diff) | |
download | ibus-libpinyin-8868b88483de6f92b8c7f35604540f30c2dd6816.tar.gz ibus-libpinyin-8868b88483de6f92b8c7f35604540f30c2dd6816.tar.xz ibus-libpinyin-8868b88483de6f92b8c7f35604540f30c2dd6816.zip |
add ctrl switch to bopomofo engine
-rw-r--r-- | src/PYPBopomofoEngine.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/PYPBopomofoEngine.cc b/src/PYPBopomofoEngine.cc index 27883a4..9be5ad2 100644 --- a/src/PYPBopomofoEngine.cc +++ b/src/PYPBopomofoEngine.cc @@ -64,20 +64,30 @@ LibPinyinBopomofoEngine::processKeyEvent (guint keyval, guint keycode, guint mod { 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 (LibPinyinBopomofoConfig::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 init mode, and no any previous input text, |