summaryrefslogtreecommitdiffstats
path: root/src/PYPBopomofoEngine.cc
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-10-10 15:48:29 +0800
committerPeng Wu <alexepico@gmail.com>2013-10-10 15:48:33 +0800
commit69f50424ba5be49c4b31543df7bd7970361d4753 (patch)
tree2e525ed4aca9a882b3039b4d343438bb073a9b5f /src/PYPBopomofoEngine.cc
parentcf8ab7d8e76ed70c182c7588cfe1ebbce8e5174b (diff)
downloadibus-libpinyin-69f50424ba5be49c4b31543df7bd7970361d4753.tar.gz
ibus-libpinyin-69f50424ba5be49c4b31543df7bd7970361d4753.tar.xz
ibus-libpinyin-69f50424ba5be49c4b31543df7bd7970361d4753.zip
support setContentType method
Diffstat (limited to 'src/PYPBopomofoEngine.cc')
-rw-r--r--src/PYPBopomofoEngine.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/PYPBopomofoEngine.cc b/src/PYPBopomofoEngine.cc
index 9be5ad2..9d2666f 100644
--- a/src/PYPBopomofoEngine.cc
+++ b/src/PYPBopomofoEngine.cc
@@ -40,6 +40,10 @@ LibPinyinBopomofoEngine::LibPinyinBopomofoEngine (IBusEngine *engine)
{
gint i;
+#if IBUS_CHECK_VERSION (1, 5, 4)
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
+#endif
+
/* create editors */
m_editors[MODE_INIT].reset (new LibPinyinBopomofoEditor (m_props, LibPinyinBopomofoConfig::instance ()));
m_editors[MODE_PUNCT].reset (new PunctEditor (m_props, LibPinyinBopomofoConfig::instance ()));
@@ -64,6 +68,11 @@ LibPinyinBopomofoEngine::processKeyEvent (guint keyval, guint keycode, guint mod
{
gboolean retval = FALSE;
+#if IBUS_CHECK_VERSION (1, 5, 4)
+ if (IBUS_INPUT_PURPOSE_PASSWORD == m_input_purpose)
+ return retval;
+#endif
+
/* check Shift or Ctrl + Release hotkey,
* and then ignore other Release key event */
if (modifiers & IBUS_RELEASE_MASK) {
@@ -140,9 +149,22 @@ LibPinyinBopomofoEngine::focusIn (void)
void
LibPinyinBopomofoEngine::focusOut (void)
{
+
+#if IBUS_CHECK_VERSION (1, 5, 4)
+ m_input_purpose = IBUS_INPUT_PURPOSE_FREE_FORM;
+#endif
+
reset ();
}
+#if IBUS_CHECK_VERSION(1, 5, 4)
+void
+LibPinyinBopomofoEngine::setContentType (guint purpose, guint hints)
+{
+ m_input_purpose = (IBusInputPurpose) purpose;
+}
+#endif
+
void
LibPinyinBopomofoEngine::reset (void)
{