diff options
author | Peng Wu <alexepico@gmail.com> | 2018-10-31 13:18:22 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2018-10-31 13:18:22 +0800 |
commit | 0401ff95be8f8b906d7a79feded7482c4172b28f (patch) | |
tree | 3492205b93ab05e53b3fcd20c3f7b24f639283c1 | |
parent | 17ec73fad0f05cb23c2213ddc0ec2b798bbe6ab3 (diff) | |
download | ibus-libpinyin-0401ff95be8f8b906d7a79feded7482c4172b28f.tar.gz ibus-libpinyin-0401ff95be8f8b906d7a79feded7482c4172b28f.tar.xz ibus-libpinyin-0401ff95be8f8b906d7a79feded7482c4172b28f.zip |
fixes lua build1.10.92
-rw-r--r-- | src/PYEngine.cc | 1 | ||||
-rw-r--r-- | src/PYPPhoneticEditor.cc | 4 | ||||
-rw-r--r-- | src/PYPPhoneticEditor.h | 4 | ||||
-rw-r--r-- | src/PYPPinyinEngine.cc | 14 | ||||
-rw-r--r-- | src/PYPPinyinEngine.h | 6 | ||||
-rw-r--r-- | src/PYPSuggestionEditor.cc | 4 | ||||
-rw-r--r-- | src/PYPSuggestionEditor.h | 2 |
7 files changed, 30 insertions, 5 deletions
diff --git a/src/PYEngine.cc b/src/PYEngine.cc index 5ec1d27..291f2f2 100644 --- a/src/PYEngine.cc +++ b/src/PYEngine.cc @@ -21,7 +21,6 @@ #include "PYEngine.h" #include <cstring> -#include "lua-plugin.h" #include "PYPPinyinEngine.h" #include "PYPBopomofoEngine.h" diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc index 00c4f64..e39b6ba 100644 --- a/src/PYPPhoneticEditor.cc +++ b/src/PYPPhoneticEditor.cc @@ -45,15 +45,15 @@ PhoneticEditor::PhoneticEditor (PinyinProperties &props, PhoneticEditor::~PhoneticEditor (){ } +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean PhoneticEditor::setLuaPlugin (IBusEnginePlugin *plugin) { -#ifdef IBUS_BUILD_LUA_EXTENSION m_lua_trigger_candidates.setLuaPlugin (plugin); m_lua_converter_candidates.setLuaPlugin (plugin); -#endif return TRUE; } +#endif gboolean PhoneticEditor::processSpace (guint keyval, guint keycode, diff --git a/src/PYPPhoneticEditor.h b/src/PYPPhoneticEditor.h index 64750d7..346c54c 100644 --- a/src/PYPPhoneticEditor.h +++ b/src/PYPPhoneticEditor.h @@ -21,7 +21,9 @@ #ifndef __PY_LIB_PINYIN_BASE_EDITOR_H_ #define __PY_LIB_PINYIN_BASE_EDITOR_H_ +#ifdef IBUS_BUILD_LUA_EXTENSION #include "lua-plugin.h" +#endif #include <vector> #include <pinyin.h> @@ -65,7 +67,9 @@ public: virtual gboolean fillLookupTable (); virtual void commit (const gchar *str) = 0; +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean setLuaPlugin (IBusEnginePlugin *plugin); +#endif protected: virtual int selectCandidateInternal (EnhancedCandidate & candidate); diff --git a/src/PYPPinyinEngine.cc b/src/PYPPinyinEngine.cc index 0c71ca3..efb518e 100644 --- a/src/PYPPinyinEngine.cc +++ b/src/PYPPinyinEngine.cc @@ -53,7 +53,9 @@ PinyinEngine::PinyinEngine (IBusEngine *engine) { gint i; +#ifdef IBUS_BUILD_LUA_EXTENSION initLuaPlugin (); +#endif m_double_pinyin = PinyinConfig::instance ().doublePinyin (); @@ -61,12 +63,16 @@ PinyinEngine::PinyinEngine (IBusEngine *engine) DoublePinyinEditor *editor = new DoublePinyinEditor (m_props, PinyinConfig::instance ()); m_editors[MODE_INIT].reset (editor); +#ifdef IBUS_BUILD_LUA_EXTENSION editor->setLuaPlugin (m_lua_plugin); +#endif } else { FullPinyinEditor *editor = new FullPinyinEditor (m_props, PinyinConfig::instance ()); m_editors[MODE_INIT].reset (editor); +#ifdef IBUS_BUILD_LUA_EXTENSION editor->setLuaPlugin (m_lua_plugin); +#endif } m_editors[MODE_PUNCT].reset @@ -98,7 +104,9 @@ PinyinEngine::PinyinEngine (IBusEngine *engine) SuggestionEditor *editor = new SuggestionEditor (m_props, PinyinConfig::instance ()); m_editors[MODE_SUGGESTION].reset (editor); +#ifdef IBUS_BUILD_LUA_EXTENSION editor->setLuaPlugin (m_lua_plugin); +#endif } m_props.signalUpdateProperty ().connect @@ -116,6 +124,7 @@ PinyinEngine::~PinyinEngine (void) { } +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean PinyinEngine::initLuaPlugin (void) { @@ -137,6 +146,7 @@ PinyinEngine::loadLuaScript (const char * filename) { return !ibus_engine_plugin_load_lua_script (m_lua_plugin, filename); } +#endif /* keep synced with bopomofo engine. */ gboolean @@ -335,7 +345,9 @@ PinyinEngine::focusIn (void) DoublePinyinEditor *editor = new DoublePinyinEditor (m_props, PinyinConfig::instance ()); m_editors[MODE_INIT].reset (editor); +#ifdef IBUS_BUILD_LUA_EXTENSION editor->setLuaPlugin (m_lua_plugin); +#endif connectEditorSignals (m_editors[MODE_INIT]); } m_double_pinyin = TRUE; @@ -345,7 +357,9 @@ PinyinEngine::focusIn (void) FullPinyinEditor *editor = new FullPinyinEditor (m_props, PinyinConfig::instance ()); m_editors[MODE_INIT].reset (editor); +#ifdef IBUS_BUILD_LUA_EXTENSION editor->setLuaPlugin (m_lua_plugin); +#endif connectEditorSignals (m_editors[MODE_INIT]); } m_double_pinyin = FALSE; diff --git a/src/PYPPinyinEngine.h b/src/PYPPinyinEngine.h index 4c34ed3..2bc7475 100644 --- a/src/PYPPinyinEngine.h +++ b/src/PYPPinyinEngine.h @@ -22,7 +22,9 @@ #ifndef __PY_LIB_PINYIN_PINYIN_ENGINE_H_ #define __PY_LIB_PINYIN_PINYIN_ENGINE_H_ +#ifdef IBUS_BUILD_LUA_EXTENSION #include "lua-plugin.h" +#endif #include "PYEngine.h" #include "PYPinyinProperties.h" @@ -50,8 +52,10 @@ public: void candidateClicked (guint index, guint button, guint state); private: +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean initLuaPlugin (void); gboolean loadLuaScript (const char * filename); +#endif gboolean processPunct (guint keyval, guint keycode, guint modifiers); @@ -83,7 +87,9 @@ private: EditorPtr m_editors[MODE_LAST]; EditorPtr m_fallback_editor; +#ifdef IBUS_BUILD_LUA_EXTENSION Pointer<IBusEnginePlugin> m_lua_plugin; +#endif }; }; diff --git a/src/PYPSuggestionEditor.cc b/src/PYPSuggestionEditor.cc index 7c1fab2..8dbda4c 100644 --- a/src/PYPSuggestionEditor.cc +++ b/src/PYPSuggestionEditor.cc @@ -50,15 +50,15 @@ SuggestionEditor::~SuggestionEditor (void) m_instance = NULL; } +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean SuggestionEditor::setLuaPlugin (IBusEnginePlugin *plugin) { -#ifdef IBUS_BUILD_LUA_EXTENSION m_lua_trigger_candidates.setLuaPlugin (plugin); m_lua_converter_candidates.setLuaPlugin (plugin); -#endif return TRUE; } +#endif gboolean SuggestionEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) diff --git a/src/PYPSuggestionEditor.h b/src/PYPSuggestionEditor.h index ed45c2f..86df3e0 100644 --- a/src/PYPSuggestionEditor.h +++ b/src/PYPSuggestionEditor.h @@ -51,7 +51,9 @@ public: virtual void reset (void); virtual void candidateClicked (guint index, guint button, guint state); +#ifdef IBUS_BUILD_LUA_EXTENSION gboolean setLuaPlugin (IBusEnginePlugin *plugin); +#endif protected: virtual int selectCandidateInternal (EnhancedCandidate & candidate); |