diff options
Diffstat (limited to 'src/ZYZPinyinEditor.cc')
-rw-r--r-- | src/ZYZPinyinEditor.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/ZYZPinyinEditor.cc b/src/ZYZPinyinEditor.cc index aac58c0..4206713 100644 --- a/src/ZYZPinyinEditor.cc +++ b/src/ZYZPinyinEditor.cc @@ -173,29 +173,35 @@ PinyinEditor::updatePreeditText (void) } gboolean -PinyinEditor::insert (gint ch) +PinyinEditor::insert (guint keyval, guint keycode, guint modifiers) { - if (IS_PINYIN (ch)) { - insert_phonetic (m_text, m_cursor++, ch); + /* let client applications to handle shortcut key event */ + modifiers = cmshm_filter (modifiers); + + if (modifiers != 0 && m_text.empty ()) + return FALSE; + + if (IS_PINYIN (keyval)) { + insert_phonetic (m_text, m_cursor++, keyval); updateZhuyin (); update (); return TRUE; } - if (insertPunct (ch)) { + if (insertPunct (keyval)) { updateZhuyin (); update (); return TRUE; } - if (insertEnglish (ch)) { + if (insertEnglish (keyval)) { updateZhuyin (); update (); return TRUE; } - if (insertNumbers (ch)) { + if (insertNumbers (keyval)) { updateZhuyin (); update (); return TRUE; @@ -225,7 +231,7 @@ PinyinEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) if (processUserSymbolKey (keyval, keycode, modifiers)) return TRUE; - if (insert (keyval)) + if (insert (keyval, keycode, modifiers)) return TRUE; if (processEnter (keyval, keycode, modifiers)) |