diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /app-i18n/mozc/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'app-i18n/mozc/files')
7 files changed, 716 insertions, 0 deletions
diff --git a/app-i18n/mozc/files/50mozc-gentoo.el b/app-i18n/mozc/files/50mozc-gentoo.el new file mode 100644 index 000000000000..121c62249eb7 --- /dev/null +++ b/app-i18n/mozc/files/50mozc-gentoo.el @@ -0,0 +1,4 @@ +;;; app-i18n/ibus-mozc site-lisp configuration + +(add-to-list 'load-path "@SITELISP@") +(autoload 'mozc-mode "mozc" nil t) diff --git a/app-i18n/mozc/files/mozc-1.10.1390.102-drop-Werror.patch b/app-i18n/mozc/files/mozc-1.10.1390.102-drop-Werror.patch new file mode 100644 index 000000000000..e254f38b8745 --- /dev/null +++ b/app-i18n/mozc/files/mozc-1.10.1390.102-drop-Werror.patch @@ -0,0 +1,12 @@ +diff --git a/gyp/common.gypi b/gyp/common.gypi +index 6c176ff..3613b1b 100755 +--- a/gyp/common.gypi ++++ b/gyp/common.gypi +@@ -58,7 +58,6 @@ + # warning_cflags will be shared with Mac and Linux. + 'warning_cflags': [ + '-Wall', +- '-Werror', + '-Wno-char-subscripts', + '-Wno-sign-compare', + '-Wno-deprecated-declarations', diff --git a/app-i18n/mozc/files/mozc-1.13.1651.102-gtk-renderer.patch b/app-i18n/mozc/files/mozc-1.13.1651.102-gtk-renderer.patch new file mode 100644 index 000000000000..bff0822a602d --- /dev/null +++ b/app-i18n/mozc/files/mozc-1.13.1651.102-gtk-renderer.patch @@ -0,0 +1,13 @@ +diff --git a/unix/ibus/mozc_engine.cc b/unix/ibus/mozc_engine.cc +index e256ea4..534262e 100755 +--- a/unix/ibus/mozc_engine.cc ++++ b/unix/ibus/mozc_engine.cc +@@ -250,8 +250,6 @@ MozcEngine::MozcEngine() + #ifdef ENABLE_GTK_RENDERER + gtk_candidate_window_handler_(new GtkCandidateWindowHandler( + new renderer::RendererClient())), +-#else +- gtk_candidate_window_handler_(NULL), + #endif // ENABLE_GTK_RENDERER + ibus_candidate_window_handler_(new IBusCandidateWindowHandler()), + preedit_method_(config::Config::ROMAN) { diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch new file mode 100644 index 000000000000..2b2828b79997 --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch @@ -0,0 +1,291 @@ +--- /src/gyp/defines.gypi ++++ /src/gyp/defines.gypi +@@ -71,6 +71,12 @@ + # use_libibus represents if ibus library is used or not. + # This option is only for Linux. + 'use_libibus%': '0', ++ ++ # use_libgtest represents if gtest library is used or not. ++ 'use_libgtest%': '0', ++ ++ # use_libjsoncpp represents if jsoncpp library is used or not. ++ 'use_libjsoncpp%': '0', + }, + 'target_defaults': { + 'defines': [ +--- /src/net/jsoncpp.gyp ++++ /src/net/jsoncpp.gyp +@@ -31,32 +31,57 @@ + 'targets': [ + { + 'target_name': 'jsoncpp', +- 'type': 'static_library', +- 'variables': { +- 'jsoncpp_root': '<(third_party_dir)/jsoncpp', +- 'jsoncpp_srcs': [ +- '<(jsoncpp_root)/src/lib_json/json_reader.cpp', +- '<(jsoncpp_root)/src/lib_json/json_value.cpp', +- '<(jsoncpp_root)/src/lib_json/json_writer.cpp', +- ], +- 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'], +- 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'], +- }, +- 'defines': [ +- '<@(jsoncpp_additional_macros)', ++ 'conditions': [ ++ ['use_libjsoncpp==1', { ++ 'type': 'none', ++ 'variables': { ++ 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'], ++ }, ++ 'all_dependent_settings': { ++ 'defines': [ ++ '<@(jsoncpp_additional_macros)', ++ ], ++ 'cflags': [ ++ '<!@(pkg-config --cflags jsoncpp)', ++ ], ++ 'link_settings': { ++ 'libraries': [ ++ '<!@(pkg-config --libs-only-l jsoncpp)', ++ ], ++ 'ldflags': [ ++ '<!@(pkg-config --libs-only-L jsoncpp)', ++ ], ++ } ++ }, ++ }, { ++ 'type': 'static_library', ++ 'variables': { ++ 'jsoncpp_root': '<(third_party_dir)/jsoncpp', ++ 'jsoncpp_srcs': [ ++ '<(jsoncpp_root)/src/lib_json/json_reader.cpp', ++ '<(jsoncpp_root)/src/lib_json/json_value.cpp', ++ '<(jsoncpp_root)/src/lib_json/json_writer.cpp', ++ ], ++ 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'], ++ 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'], ++ }, ++ 'defines': [ ++ '<@(jsoncpp_additional_macros)', ++ ], ++ 'sources': [ ++ '<@(jsoncpp_srcs)', ++ 'jsoncpp.h', ++ ], ++ 'include_dirs': [ ++ '<@(jsoncpp_include_dirs)', ++ ], ++ 'all_dependent_settings': { ++ 'defines': [ ++ '<@(jsoncpp_additional_macros)', ++ ], ++ }, ++ }], + ], +- 'sources': [ +- '<@(jsoncpp_srcs)', +- 'jsoncpp.h', +- ], +- 'include_dirs': [ +- '<@(jsoncpp_include_dirs)', +- ], +- 'all_dependent_settings': { +- 'defines': [ +- '<@(jsoncpp_additional_macros)', +- ], +- }, + }, + ], + } +--- /src/net/jsoncpp.h ++++ /src/net/jsoncpp.h +@@ -35,7 +35,7 @@ + // Mozc basically disables C++ exception. + #define JSON_USE_EXCEPTION 0 + #endif // !JSON_USE_EXCEPTION +-#include "third_party/jsoncpp/include/json/json.h" ++#include <json/json.h> + #define MOZC_JSONCPP_JSON_H_INCLUDED + #endif // !MOZC_JSONCPP_JSON_H_INCLUDED + +--- /src/testing/testing.gyp ++++ /src/testing/testing.gyp +@@ -53,76 +53,111 @@ + 'targets': [ + { + 'target_name': 'testing', +- 'type': 'static_library', +- 'variables': { +- 'gtest_defines': [ +- 'GTEST_LANG_CXX11=1', +- 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple. +- ], +- 'gtest_dir': '<(third_party_dir)/gtest/googletest', +- 'gmock_dir': '<(third_party_dir)/gtest/googlemock', +- 'conditions': [ +- ['_toolset=="target" and target_platform=="Android"', { +- 'gtest_defines': [ +- 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this. +- 'GTEST_HAS_CLONE=0', +- 'GTEST_HAS_GLOBAL_WSTRING=0', +- 'GTEST_HAS_POSIX_RE=0', +- 'GTEST_HAS_STD_WSTRING=0', +- 'GTEST_OS_LINUX=1', +- 'GTEST_OS_LINUX_ANDROID=1', +- ], +- }], +- ], +- }, +- 'sources': [ +- '<(gmock_dir)/src/gmock-cardinalities.cc', +- '<(gmock_dir)/src/gmock-internal-utils.cc', +- '<(gmock_dir)/src/gmock-matchers.cc', +- '<(gmock_dir)/src/gmock-spec-builders.cc', +- '<(gmock_dir)/src/gmock.cc', +- '<(gtest_dir)/src/gtest-death-test.cc', +- '<(gtest_dir)/src/gtest-filepath.cc', +- '<(gtest_dir)/src/gtest-port.cc', +- '<(gtest_dir)/src/gtest-printers.cc', +- '<(gtest_dir)/src/gtest-test-part.cc', +- '<(gtest_dir)/src/gtest-typed-test.cc', +- '<(gtest_dir)/src/gtest.cc', +- ], +- 'include_dirs': [ +- '<(gmock_dir)', +- '<(gmock_dir)/include', +- '<(gtest_dir)', +- '<(gtest_dir)/include', +- ], +- 'defines': [ +- '<@(gtest_defines)', +- ], +- 'all_dependent_settings': { +- 'defines': [ +- '<@(gtest_defines)', +- ], +- 'include_dirs': [ +- '<(gmock_dir)/include', +- '<(gtest_dir)/include', +- ], +- }, + 'conditions': [ +- ['(_toolset=="target" and compiler_target=="clang") or ' +- '(_toolset=="host" and compiler_host=="clang")', { +- 'cflags': [ +- '-Wno-missing-field-initializers', +- '-Wno-unused-private-field', ++ ['use_libgtest==1', { ++ 'type': 'none', ++ 'variables': { ++ 'gtest_defines': [ ++ 'GTEST_LANG_CXX11=1', ++ 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple. ++ ], ++ 'conditions': [ ++ ['_toolset=="target" and target_platform=="Android"', { ++ 'gtest_defines': [ ++ 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this. ++ 'GTEST_HAS_CLONE=0', ++ 'GTEST_HAS_GLOBAL_WSTRING=0', ++ 'GTEST_HAS_POSIX_RE=0', ++ 'GTEST_HAS_STD_WSTRING=0', ++ 'GTEST_OS_LINUX=1', ++ 'GTEST_OS_LINUX_ANDROID=1', ++ ], ++ }], ++ ], ++ }, ++ 'all_dependent_settings': { ++ 'defines': [ ++ '<@(gtest_defines)', ++ ], ++ 'link_settings': { ++ 'libraries': [ ++ '-lgmock -lgtest', ++ ], ++ }, ++ }, ++ }, { ++ 'type': 'static_library', ++ 'variables': { ++ 'gtest_defines': [ ++ 'GTEST_LANG_CXX11=1', ++ 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple. ++ ], ++ 'gtest_dir': '<(third_party_dir)/gtest/googletest', ++ 'gmock_dir': '<(third_party_dir)/gtest/googlemock', ++ 'conditions': [ ++ ['_toolset=="target" and target_platform=="Android"', { ++ 'gtest_defines': [ ++ 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this. ++ 'GTEST_HAS_CLONE=0', ++ 'GTEST_HAS_GLOBAL_WSTRING=0', ++ 'GTEST_HAS_POSIX_RE=0', ++ 'GTEST_HAS_STD_WSTRING=0', ++ 'GTEST_OS_LINUX=1', ++ 'GTEST_OS_LINUX_ANDROID=1', ++ ], ++ }], ++ ], ++ }, ++ 'sources': [ ++ '<(gmock_dir)/src/gmock-cardinalities.cc', ++ '<(gmock_dir)/src/gmock-internal-utils.cc', ++ '<(gmock_dir)/src/gmock-matchers.cc', ++ '<(gmock_dir)/src/gmock-spec-builders.cc', ++ '<(gmock_dir)/src/gmock.cc', ++ '<(gtest_dir)/src/gtest-death-test.cc', ++ '<(gtest_dir)/src/gtest-filepath.cc', ++ '<(gtest_dir)/src/gtest-port.cc', ++ '<(gtest_dir)/src/gtest-printers.cc', ++ '<(gtest_dir)/src/gtest-test-part.cc', ++ '<(gtest_dir)/src/gtest-typed-test.cc', ++ '<(gtest_dir)/src/gtest.cc', ++ ], ++ 'include_dirs': [ ++ '<(gmock_dir)', ++ '<(gmock_dir)/include', ++ '<(gtest_dir)', ++ '<(gtest_dir)/include', ++ ], ++ 'defines': [ ++ '<@(gtest_defines)', + ], ++ 'all_dependent_settings': { ++ 'defines': [ ++ '<@(gtest_defines)', ++ ], ++ 'include_dirs': [ ++ '<(gmock_dir)/include', ++ '<(gtest_dir)/include', ++ ], ++ }, ++ 'conditions': [ ++ ['(_toolset=="target" and compiler_target=="clang") or ' ++ '(_toolset=="host" and compiler_host=="clang")', { ++ 'cflags': [ ++ '-Wno-missing-field-initializers', ++ '-Wno-unused-private-field', ++ ], ++ }], ++ ], ++ 'xcode_settings': { ++ # Remove the force included file. This is not necessary for third ++ # party libraries, and it causes a build error. ++ 'OTHER_CFLAGS!' : [ ++ '-include base/namespace.h', ++ ], ++ }, + }], + ], +- 'xcode_settings': { +- # Remove the force included file. This is not necessary for third +- # party libraries, and it causes a build error. +- 'OTHER_CFLAGS!' : [ +- '-include base/namespace.h', +- ], +- }, + }, + { + 'target_name': 'gen_mozc_data_dir_header', diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch new file mode 100644 index 000000000000..b8b4477437f8 --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch @@ -0,0 +1,27 @@ +--- /src/net/json_util_test.cc ++++ /src/net/json_util_test.cc +@@ -784,13 +784,13 @@ + for (size_t i = 0; i < arraysize(kNumS32ValueKeys); ++i) { + { + Json::Value json_value; +- json_value[kNumS32ValueKeys[i]] = -2147483649ll; ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::Int64>(-2147483649ll); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } + { + Json::Value json_value; +- json_value[kNumS32ValueKeys[i]] = 2147483648ull; ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::UInt64>(2147483648ull); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } +@@ -805,7 +805,7 @@ + } + { + Json::Value json_value; +- json_value[kNumU32ValueKeys[i]] = 4294967296ull; ++ json_value[kNumU32ValueKeys[i]] = static_cast<Json::Value::UInt64>(4294967296ull); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch new file mode 100644 index 000000000000..28c5486de50d --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch @@ -0,0 +1,70 @@ +Disable test leaving mozc_server orphan process. + +--- /src/unix/ibus/mozc_engine_test.cc ++++ /src/unix/ibus/mozc_engine_test.cc +@@ -41,65 +41,5 @@ + namespace mozc { + namespace ibus { + +-class LaunchToolTest : public testing::Test { +- public: +- LaunchToolTest() { +- g_type_init(); +- } +- +- protected: +- virtual void SetUp() { +- mozc_engine_.reset(new MozcEngine()); +- +- mock_ = new client::ClientMock(); +- mock_->ClearFunctionCounter(); +- mozc_engine_->client_.reset(mock_); +- } +- +- virtual void TearDown() { +- mozc_engine_.reset(); +- } +- +- client::ClientMock* mock_; +- unique_ptr<MozcEngine> mozc_engine_; +- +- private: +- DISALLOW_COPY_AND_ASSIGN(LaunchToolTest); +-}; +- +-TEST_F(LaunchToolTest, LaunchToolTest) { +- commands::Output output; +- +- // Launch config dialog +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch dictionary tool +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::DICTIONARY_TOOL); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch word register dialog +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::WORD_REGISTER_DIALOG); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch no tool(means do nothing) +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false); +- output.set_launch_tool_mode(commands::Output::NO_TOOL); +- EXPECT_FALSE(mozc_engine_->LaunchTool(output)); +- +- // Something occurring in client::Client::LaunchTool +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false); +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG); +- EXPECT_FALSE(mozc_engine_->LaunchTool(output)); +-} +- + } // namespace ibus + } // namespace mozc diff --git a/app-i18n/mozc/files/mozc-ibus-1.5.4.patch b/app-i18n/mozc/files/mozc-ibus-1.5.4.patch new file mode 100644 index 000000000000..619b1d251507 --- /dev/null +++ b/app-i18n/mozc/files/mozc-ibus-1.5.4.patch @@ -0,0 +1,299 @@ +Index: engine_interface.h +=================================================================== +--- unix/ibus/engine_interface.h (revision 177) ++++ unix/ibus/engine_interface.h (working copy) +@@ -106,6 +106,11 @@ + gint y, + gint w, + gint h) = 0; ++ ++ // The interface function for the "set-content-type" signal ++ virtual void SetContentType(IBusEngine *engine, ++ guint purpose, ++ guint hints) = 0; + }; + + } // namespace ibus +Index: engine_registrar.cc +=================================================================== +--- unix/ibus/engine_registrar.cc (revision 177) ++++ unix/ibus/engine_registrar.cc (working copy) +@@ -63,7 +63,9 @@ + engine_class->reset = Reset; + engine_class->set_capabilities = SetCapabilities; + engine_class->set_cursor_location = SetCursorLocation; +- ++#if defined(MOZC_ENABLE_IBUS_INPUT_PURPOSE) ++ engine_class->set_content_type = SetContentType; ++#endif // MOZC_ENABLE_IBUS_INPUT_PURPOSE + return true; + } + +@@ -87,6 +89,9 @@ + engine_class->reset = NULL; + engine_class->set_capabilities = NULL; + engine_class->set_cursor_location = NULL; ++#if defined(MOZC_ENABLE_IBUS_INPUT_PURPOSE) ++ engine_class->set_content_type = NULL; ++#endif // MOZC_ENABLE_IBUS_INPUT_PURPOSE + + mozc::ibus::EngineInterface *previous = g_engine; + g_engine = NULL; +@@ -179,5 +184,12 @@ + g_engine->SetCursorLocation(engine, x, y, w, h); + } + ++void EngineRegistrar::SetContentType( ++ IBusEngine *engine, ++ guint purpose, ++ guint hints) { ++ g_engine->SetContentType(engine, purpose, hints); ++} ++ + } // namespace ibus + } // namespace mozc +Index: engine_registrar.h +=================================================================== +--- unix/ibus/engine_registrar.h (revision 177) ++++ unix/ibus/engine_registrar.h (working copy) +@@ -84,6 +84,9 @@ + gint y, + gint w, + gint h); ++ static void SetContentType(IBusEngine *engine, ++ guint purpose, ++ guint hints); + }; + + } // namespace ibus +Index: ibus_header.h +=================================================================== +--- unix/ibus/ibus_header.h (revision 177) ++++ unix/ibus/ibus_header.h (working copy) +@@ -36,5 +36,10 @@ + #error "ibus-mozc now requires IBus>=1.4.1" + #endif // libibus (<1.4.1) + ++#if IBUS_CHECK_VERSION(1, 5, 4) ++#if !defined(MOZC_ENABLE_IBUS_INPUT_PURPOSE) ++#define MOZC_ENABLE_IBUS_INPUT_PURPOSE ++#endif // !MOZC_ENABLE_IBUS_INPUT_PURPOSE ++#endif // libibus(>=1.5.4) + + #endif // MOZC_UNIX_IBUS_IBUS_HEADER_H_ +Index: mozc_engine.cc +=================================================================== +--- unix/ibus/mozc_engine.cc (revision 177) ++++ unix/ibus/mozc_engine.cc (working copy) +@@ -372,6 +372,7 @@ + + void MozcEngine::FocusOut(IBusEngine *engine) { + GetCandidateWindowHandler(engine)->Hide(engine); ++ property_handler_->ResetContentType(engine); + + // Do not call SubmitSession or RevertSession. Preedit string will commit on + // Focus Out event automatically by ibus_engine_update_preedit_text_with_mode +@@ -397,6 +398,11 @@ + VLOG(2) << "keyval: " << keyval + << ", keycode: " << keycode + << ", modifiers: " << modifiers; ++ if (property_handler_->IsDisabled()) { ++ // It is each enginze's responsibility for ignoreing keyevents on ++ // the password field on the locked screen since IBus 1.5.4. ++ return FALSE; ++ } + + // Send current caret location to mozc_server to manage suggest window + // position. +@@ -501,6 +507,18 @@ + // Do nothing + } + ++void MozcEngine::SetContentType(IBusEngine *engine, ++ guint purpose, ++ guint hints) { ++ const bool prev_disabled = ++ property_handler_->IsDisabled(); ++ property_handler_->UpdateContentType(engine); ++ if (!prev_disabled && property_handler_->IsDisabled()) { ++ // Make sure on-going composition is reverted. ++ RevertSession(engine); ++ } ++} ++ + GType MozcEngine::GetType() { + static GType type = 0; + +Index: mozc_engine.h +=================================================================== +--- unix/ibus/mozc_engine.h (revision 177) ++++ unix/ibus/mozc_engine.h (working copy) +@@ -99,6 +99,9 @@ + gint y, + gint w, + gint h); ++ void SetContentType(IBusEngine *engine, ++ guint purpose, ++ guint hints); + + // Returns the GType which this class represents. + static GType GetType(); +Index: property_handler.cc +=================================================================== +--- unix/ibus/property_handler.cc (revision 177) ++++ unix/ibus/property_handler.cc (working copy) +@@ -61,6 +61,19 @@ + bool IsMozcToolAvailable() { + return FileUtil::FileExists(SystemUtil::GetToolPath()); + } ++ ++bool GetDisabled(IBusEngine *engine) { ++ bool disabled = false; ++#if defined(MOZC_ENABLE_IBUS_INPUT_PURPOSE) ++ guint purpose = IBUS_INPUT_PURPOSE_FREE_FORM; ++ guint hints = IBUS_INPUT_HINT_NONE; ++ ibus_engine_get_content_type(engine, &purpose, &hints); ++ disabled = (purpose == IBUS_INPUT_PURPOSE_PASSWORD || ++ purpose == IBUS_INPUT_PURPOSE_PIN); ++#endif // MOZC_ENABLE_IBUS_INPUT_PURPOSE ++ return disabled; ++} ++ + } // namespace + + PropertyHandler::PropertyHandler(MessageTranslatorInterface *translator, +@@ -71,7 +84,8 @@ + client_(client), + translator_(translator), + original_composition_mode_(kMozcEngineInitialCompositionMode), +- is_activated_(true) { ++ is_activated_(true), ++ is_disabled_(false) { + + AppendCompositionPropertyToPanel(); + #ifndef OS_CHROMEOS +@@ -105,6 +119,7 @@ + + void PropertyHandler::Register(IBusEngine *engine) { + ibus_engine_register_properties(engine, prop_root_); ++ UpdateContentType(engine); + } + + // TODO(nona): do not use kMozcEngine*** directory. +@@ -228,8 +243,34 @@ + ibus_prop_list_append(prop_root_, prop_mozc_tool_); + } + ++void PropertyHandler::UpdateContentTypeImpl(IBusEngine *engine, ++ bool disabled) { ++ const bool prev_is_disabled = is_disabled_; ++ is_disabled_ = disabled; ++ if (prev_is_disabled == is_disabled_) { ++ return; ++ } ++ const commands::CompositionMode visible_mode = ++ (prev_is_disabled && !is_disabled_ && IsActivated()) ++ ? original_composition_mode_ : ++ kMozcEnginePropertyIMEOffState->composition_mode; ++ UpdateCompositionModeIcon(engine, visible_mode); ++} ++ ++void PropertyHandler::ResetContentType(IBusEngine *engine) { ++ UpdateContentTypeImpl(engine, false); ++} ++ ++void PropertyHandler::UpdateContentType(IBusEngine *engine) { ++ UpdateContentTypeImpl(engine, GetDisabled(engine)); ++} ++ + void PropertyHandler::Update(IBusEngine *engine, + const commands::Output &output) { ++ if (IsDisabled()) { ++ return; ++ } ++ + if (output.has_status() && + (output.status().activated() != is_activated_ || + output.status().mode() != original_composition_mode_)) { +@@ -325,6 +366,10 @@ + const gchar *property_name, + guint property_state) { + #ifndef OS_CHROMEOS ++ if (IsDisabled()) { ++ return; ++ } ++ + if (prop_mozc_tool_) { + for (guint prop_index = 0; ; ++prop_index) { + IBusProperty *prop = ibus_prop_list_get( +@@ -371,9 +416,13 @@ + } + + bool PropertyHandler::IsActivated() const { +- return is_activated_; ++ return is_activated_ && !IsDisabled(); + } + ++bool PropertyHandler::IsDisabled() const { ++ return is_disabled_; ++} ++ + commands::CompositionMode PropertyHandler::GetOriginalCompositionMode() const { + return original_composition_mode_; + } +Index: property_handler.h +=================================================================== +--- unix/ibus/property_handler.h (revision 177) ++++ unix/ibus/property_handler.h (working copy) +@@ -54,14 +54,19 @@ + virtual ~PropertyHandler(); + + virtual void Register(IBusEngine *engine); ++ virtual void ResetContentType(IBusEngine *engine); ++ virtual void UpdateContentType(IBusEngine *engine); + virtual void Update(IBusEngine *engine, const commands::Output &output); + virtual void ProcessPropertyActivate(IBusEngine *engine, + const gchar *property_name, + guint property_state); + virtual bool IsActivated() const; ++ virtual bool IsDisabled() const; + virtual commands::CompositionMode GetOriginalCompositionMode() const; + + private: ++ void UpdateContentTypeImpl(IBusEngine *engine, bool disabled); ++ + // Appends composition properties into panel + void AppendCompositionPropertyToPanel(); + // Appends tool properties into panel +@@ -79,6 +84,7 @@ + scoped_ptr<MessageTranslatorInterface> translator_; + commands::CompositionMode original_composition_mode_; + bool is_activated_; ++ bool is_disabled_; + }; + + } // namespace ibus +Index: property_handler_interface.h +=================================================================== +--- unix/ibus/property_handler_interface.h (revision 177) ++++ unix/ibus/property_handler_interface.h (working copy) +@@ -45,6 +45,9 @@ + // Registers current properties into engine. + virtual void Register(IBusEngine *engine) ABSTRACT; + ++ virtual void ResetContentType(IBusEngine *engine) ABSTRACT; ++ virtual void UpdateContentType(IBusEngine *engine) ABSTRACT; ++ + // Update properties. + virtual void Update(IBusEngine *engine, + const commands::Output &output) ABSTRACT; +@@ -55,6 +58,9 @@ + // Returns if IME is activated or not. + virtual bool IsActivated() const ABSTRACT; + ++ // Returns if IME is forcesully disabled, e.g. on a password field. ++ virtual bool IsDisabled() const ABSTRACT; ++ + // Returns original composition mode before. + virtual commands::CompositionMode GetOriginalCompositionMode() const ABSTRACT; + }; |