summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-03-25 08:54:57 +0800
committerPeng Wu <alexepico@gmail.com>2022-03-25 08:54:57 +0800
commit19d845b68726822781dca7d2ab0c09fdeb8d34af (patch)
tree41c615fbf52f5b8575b168e072313c6caf37831a
parent1c3d9630c2c336b3e88221fa599161c1461f2e7e (diff)
downloadibus-libpinyin-19d845b68726822781dca7d2ab0c09fdeb8d34af.tar.gz
ibus-libpinyin-19d845b68726822781dca7d2ab0c09fdeb8d34af.tar.xz
ibus-libpinyin-19d845b68726822781dca7d2ab0c09fdeb8d34af.zip
Update PinyinEngine::processKeyEvent method
-rw-r--r--src/PYPPinyinEngine.cc22
-rw-r--r--src/PYTableEditor.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/src/PYPPinyinEngine.cc b/src/PYPPinyinEngine.cc
index 43f145e..d4e439d 100644
--- a/src/PYPPinyinEngine.cc
+++ b/src/PYPPinyinEngine.cc
@@ -364,7 +364,27 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers)
#endif
} else {
- /* TODO: Unknown */
+#ifdef IBUS_BUILD_TABLE_INPUT_MODE
+ // for table mode switch with tab key
+ if (keyval == IBUS_Tab &&
+ m_input_mode == MODE_INIT &&
+ PinyinConfig::instance ().tableInputMode ()) {
+ String text;
+ if (!PinyinConfig::instance ().doublePinyin ())
+ text = "u"; // full pinyin
+ else
+ text = "U"; // double pinyin
+ text += m_editors[m_input_mode]->text ();
+ m_editors[m_input_mode]->setText ("", 0);
+
+ m_input_mode = MODE_TABLE;
+ m_editors[m_input_mode]->setText (text, text.length ());
+ Editor * editor = m_editors[m_input_mode].get ();
+ ((TableEditor *)editor)->updateStateFromInput ();
+ m_editors[m_input_mode]->update ();
+ return TRUE;
+ }
+#endif
}
}
retval = m_editors[m_input_mode]->processKeyEvent (keyval, keycode, modifiers);
diff --git a/src/PYTableEditor.h b/src/PYTableEditor.h
index 471e941..8e29bc5 100644
--- a/src/PYTableEditor.h
+++ b/src/PYTableEditor.h
@@ -28,7 +28,10 @@
namespace PY {
+class PinyinEngine;
+
class TableEditor : public Editor {
+ friend class PinyinEngine;
public:
TableEditor (PinyinProperties &props, Config & config);
virtual ~TableEditor ();