diff --git a/base/util.cc b/base/util.cc index 41f30e7..5a8fd7e 100755 --- a/base/util.cc +++ b/base/util.cc @@ -2441,11 +2441,7 @@ << "Can't get passwd entry for uid " << uid << "."; CHECK_LT(0, strlen(pw.pw_dir)) << "Home directory for uid " << uid << " is not set."; -#if defined(OS_CHROMEOS) - dir = Util::JoinPath(pw.pw_dir, "user/.mozc"); -#else dir = Util::JoinPath(pw.pw_dir, ".mozc"); -#endif // OS_CHROMEOS #endif Util::CreateDirectory(dir); @@ -3117,16 +3113,12 @@ // http://b/2430094 // This is why we use VerifyVersionInfo here instead of GetVersion(Ex). - if (IsWindowsX64() && !Util::IsVistaOrLater()) { - // NT 5.x OSes are excluded from Mozc 64-bit support. - return false; // not supported - } // You can find a table of version number for each version of Windows in // the following page. // http://msdn.microsoft.com/en-us/library/ms724833.aspx { // Windows 7 <= |OSVERSION|: supported - OSVERSIONINFOEX osvi = { 0 }; + OSVERSIONINFOEX osvi = {}; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 6; osvi.dwMinorVersion = 1; @@ -3140,7 +3132,7 @@ } { // Windows Vista SP1 <= |OSVERSION| < Windows 7: supported - OSVERSIONINFOEX osvi = { 0 }; + OSVERSIONINFOEX osvi = {}; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 6; osvi.dwMinorVersion = 0; @@ -3156,8 +3148,28 @@ } } { - // Windows Server 2003 <= |OSVERSION| < Windows Vista SP1: not supported - OSVERSIONINFOEX osvi = { 0 }; + // Windows Vista RTM <= |OSVERSION| < Windows Vista SP1: not supported + OSVERSIONINFOEX osvi = {}; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + osvi.dwMajorVersion = 6; + osvi.dwMinorVersion = 0; + osvi.wServicePackMajor = 0; + DWORDLONG conditional = 0; + VER_SET_CONDITION(conditional, VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditional, VER_MINORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditional, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); + const DWORD typemask = VER_MAJORVERSION | VER_MINORVERSION | + VER_SERVICEPACKMAJOR; + if (::VerifyVersionInfo(&osvi, typemask, conditional) != 0) { + return false; // not supported + } + } + { + // Windows XP x64/Server 2003 <= |OSVERSION| < Windows Vista RTM: supported + // --- + // Note: We do not oficially support these platforms but allows users to + // install Mozc into them. See b/5182031 for the background information. + OSVERSIONINFOEX osvi = {}; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 5; osvi.dwMinorVersion = 2; @@ -3166,12 +3178,12 @@ VER_SET_CONDITION(conditional, VER_MINORVERSION, VER_GREATER_EQUAL); const DWORD typemask = VER_MAJORVERSION | VER_MINORVERSION; if (::VerifyVersionInfo(&osvi, typemask, conditional) != 0) { - return false; // not supported + return true; // supported } } { - // Windows XP SP2 <= |OSVERSION| < Windows Server 2003: supported - OSVERSIONINFOEX osvi = { 0 }; + // Windows XP SP2 <= |OSVERSION| < Windows XP x64/Server 2003: supported + OSVERSIONINFOEX osvi = {}; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 5; osvi.dwMinorVersion = 1; diff --git a/base/util_test.cc b/base/util_test.cc index a881309..9638589 100755 --- a/base/util_test.cc +++ b/base/util_test.cc @@ -2018,9 +2018,9 @@ "\xE3\x87\xB6\xE3\x87\xB7\xE3\x87\xB8\xE3\x87\xB9\xE3\x87\xBA" "\xE3\x87\xBB\xE3\x87\xBC\xE3\x87\xBD\xE3\x87\xBE\xE3\x87\xBF", Util::KATAKANA)); - // "𛀀" U+1B000: KATAKANA LETTER ARCHAIC E + // "𛀀›€€" U+1B000: KATAKANA LETTER ARCHAIC E EXPECT_TRUE(Util::IsScriptType("\xF0\x9B\x80\x80", Util::KATAKANA)); - // "𛀁" U+1B001: HIRAGANA LETTER ARCHAIC YE + // "𛀁›€" U+1B001: HIRAGANA LETTER ARCHAIC YE EXPECT_TRUE(Util::IsScriptType("\xF0\x9B\x80\x81", Util::HIRAGANA)); EXPECT_TRUE(Util::IsScriptType("012", Util::NUMBER)); @@ -2105,9 +2105,9 @@ "\xE3\x87\xB1\xE3\x87\xB2\xE3\x87\xB3\xE3\x87\xB4\xE3\x87\xB5" "\xE3\x87\xB6\xE3\x87\xB7\xE3\x87\xB8\xE3\x87\xB9\xE3\x87\xBA" "\xE3\x87\xBB\xE3\x87\xBC\xE3\x87\xBD\xE3\x87\xBE\xE3\x87\xBF")); - // "𛀀" U+1B000 KATAKANA LETTER ARCHAIC E + // "𛀀" U+1B000 KATAKANA LETTER ARCHAIC E EXPECT_EQ(Util::KATAKANA, Util::GetScriptType("\xF0\x9B\x80\x80")); - // "𛀁" U+1B001 HIRAGANA LETTER ARCHAIC YE + // "𛀁" U+1B001 HIRAGANA LETTER ARCHAIC YE EXPECT_EQ(Util::HIRAGANA, Util::GetScriptType("\xF0\x9B\x80\x81")); // "!グーグル" @@ -2221,11 +2221,11 @@ EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xE9\xBE\xBB")); // U+9FFF is not assigned yet but reserved for CJK Unified Ideographs. EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xE9\xBE\xFF")); - // "𠮟咤" U+20B9F U+54A4 + // "𠮟咤" U+20B9F U+54A4 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xA0\xAE\x9F\xE5\x92\xA4")); - // "ð ®·野" U+20BB7 U+91CE + // "𠮷野" U+20BB7 U+91CE EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xA0\xAE\xB7\xE9\x87\x8E")); - // "巽" U+2F884 + // "巽" U+2F884 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xAF\xA2\x84")); } diff --git a/base/win_sandbox.cc b/base/win_sandbox.cc index a93df04..86a157b 100755 --- a/base/win_sandbox.cc +++ b/base/win_sandbox.cc @@ -537,7 +537,7 @@ PSECURITY_ATTRIBUTES security_attributes_ptr = NULL; SECURITY_ATTRIBUTES security_attributes = {}; - if (!WinSandbox::MakeSecurityAttributes(&security_attributes)) { + if (WinSandbox::MakeSecurityAttributes(&security_attributes)) { security_attributes_ptr = &security_attributes; // Override the impersonation thread token's DACL to avoid http://b/1728895 // On Windows Server, the objects created by a member of diff --git a/build_mozc.py b/build_mozc.py index d9afab8..6981e6a 100755 --- a/build_mozc.py +++ b/build_mozc.py @@ -363,9 +363,10 @@ help='Specifies the DEPS file.') parser.add_option('--gyp_generator', dest='gyp_generator', help='Specifies the generator for GYP.') - parser.add_option('--onepass', '-1', dest='onepass', action='store_true', - default=False, help='Builds mozc in one pass. ' - 'Not recommended, intended to use only for Debug build.') + parser.add_option('--deprecated_onepass', '-1', dest='onepass', + action='store_true', + default=False, + help='Not supported. Builds mozc in one pass.') parser.add_option('--branding', dest='branding', default='Mozc') parser.add_option('--gypdir', dest='gypdir', default='third_party/gyp') parser.add_option('--noqt', action='store_true', dest='noqt', default=False) diff --git a/build_tools/__init__.pyc b/build_tools/__init__.pyc deleted file mode 100644 index 9f4ecf3..0000000 Binary files a/build_tools/__init__.pyc and /dev/null differ diff --git a/build_tools/mozc_version.pyc b/build_tools/mozc_version.pyc deleted file mode 100644 index d3c4adf..0000000 Binary files a/build_tools/mozc_version.pyc and /dev/null differ diff --git a/build_tools/run_after_chdir.py b/build_tools/run_after_chdir.py index 1560cd3..ad8450e 100755 --- a/build_tools/run_after_chdir.py +++ b/build_tools/run_after_chdir.py @@ -58,7 +58,7 @@ # We don't capture stdout and stderr from Popen. The output will just # be emitted to a terminal or console. print sys.argv - process = subprocess.Popen(sys.argv) + sys.exit(subprocess.call(sys.argv)) if __name__ == '__main__': main() diff --git a/config/stats_config_util.cc b/config/stats_config_util.cc index f6f8be6..7ffdd00 100755 --- a/config/stats_config_util.cc +++ b/config/stats_config_util.cc @@ -57,9 +57,11 @@ #include "base/util.h" namespace mozc { - namespace { + +#ifdef GOOGLE_JAPANESE_INPUT_BUILD #ifdef OS_WINDOWS + const wchar_t kOmahaGUID[] = L"{DDCCD2A9-025E-4142-BCEB-F467B88CF830}"; const wchar_t kOmahaUsageKey[] = L"Software\\Google\\Update\\ClientState\\" @@ -218,39 +220,34 @@ #endif // MACOSX -#ifdef OS_LINUX -class LinuxStatsConfigUtilImpl : public StatsConfigUtilInterface { - // TODO(toshiyuki): implement this +#endif // GOOGLE_JAPANESE_INPUT_BUILD + +class NullStatsConfigUtilImpl : public StatsConfigUtilInterface { public: - LinuxStatsConfigUtilImpl(); - virtual ~LinuxStatsConfigUtilImpl(); - bool IsEnabled(); - bool SetEnabled(bool val); + NullStatsConfigUtilImpl() {} + virtual ~NullStatsConfigUtilImpl() {} + bool IsEnabled() { + return false; + } + bool SetEnabled(bool val) { + return true; + } }; -LinuxStatsConfigUtilImpl::LinuxStatsConfigUtilImpl() {} - -LinuxStatsConfigUtilImpl::~LinuxStatsConfigUtilImpl() {} - -bool LinuxStatsConfigUtilImpl::IsEnabled() { - return false; -} - -bool LinuxStatsConfigUtilImpl::SetEnabled(bool val) { - return true; -} -#endif // OS_LINUX - StatsConfigUtilInterface *g_stats_config_util_handler = NULL; // GetStatsConfigUtil and SetHandler are not thread safe. -#ifdef OS_WINDOWS +#if !defined(GOOGLE_JAPANESE_INPUT_BUILD) +// For non-official build, use null implementation. +typedef NullStatsConfigUtilImpl DefaultConfigUtilImpl; +#elif defined(OS_WINDOWS) typedef WinStatsConfigUtilImpl DefaultConfigUtilImpl; #elif defined(OS_MACOSX) typedef MacStatsConfigUtilImpl DefaultConfigUtilImpl; #else -typedef LinuxStatsConfigUtilImpl DefaultConfigUtilImpl; +// Fall back mode. Use null implementation. +typedef NullStatsConfigUtilImpl DefaultConfigUtilImpl; #endif StatsConfigUtilInterface &GetStatsConfigUtil() { diff --git a/config/stats_config_util_test.cc b/config/stats_config_util_test.cc index 8babb47..a49dd08 100755 --- a/config/stats_config_util_test.cc +++ b/config/stats_config_util_test.cc @@ -40,6 +40,7 @@ #endif +#ifdef GOOGLE_JAPANESE_INPUT_BUILD #ifdef OS_WINDOWS namespace { @@ -504,46 +505,8 @@ EXPECT_EQ(1, value); EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - // Check if SetEnabled(true) merges kHKLM_ClientStateMedium. - test.ClearUsagestatsValue(); - test.SetUsagestatsValue(kHKLM_ClientStateMedium, 1); - EXPECT_TRUE(StatsConfigUtil::SetEnabled(true)); - EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState)); - EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState)); - test.GetUsagestatsValue(kHKLM_ClientState, &value); - EXPECT_EQ(1, value); - EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - - test.ClearUsagestatsValue(); - test.SetUsagestatsValue(kHKLM_ClientStateMedium, 0); - EXPECT_TRUE(StatsConfigUtil::SetEnabled(true)); - EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState)); - EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState)); - test.GetUsagestatsValue(kHKLM_ClientState, &value); - EXPECT_EQ(1, value); - EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - // Check if SetEnabled(false) works as expected. test.ClearUsagestatsValue(); - EXPECT_TRUE(StatsConfigUtil::SetEnabled(false)); - EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState)); - EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState)); - test.GetUsagestatsValue(kHKLM_ClientState, &value); - EXPECT_EQ(0, value); - EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - - // Check if SetEnabled(false) works as expected. - test.ClearUsagestatsValue(); - test.SetUsagestatsValue(kHKLM_ClientStateMedium, 1); - EXPECT_TRUE(StatsConfigUtil::SetEnabled(false)); - EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState)); - EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState)); - test.GetUsagestatsValue(kHKLM_ClientState, &value); - EXPECT_EQ(0, value); - EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - - test.ClearUsagestatsValue(); - test.SetUsagestatsValue(kHKLM_ClientStateMedium, 0); EXPECT_TRUE(StatsConfigUtil::SetEnabled(false)); EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState)); EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState)); @@ -720,35 +683,6 @@ } #endif // !CHANNEL_DEV -TEST_F(StatsConfigUtilTestWin, IsEnabledForRunLevelLow) { - RegistryEmulator<__COUNTER__> test; - - test.SetRunLevel(kRunLevelHigh); - // Enabling usagestats with proper style. - test.SetUsagestatsValue(kHKLM_ClientState, 1); - // Disable usagestats with wrong style. - test.SetUsagestatsValue(kHKCU_ClientState, 0); - - test.SetRunLevel(kRunLevelLow); - -#if defined(CHANNEL_DEV) - // In dev channel, IsEnabled always returns true regardless of the registry - // settings. - EXPECT_TRUE(StatsConfigUtil::IsEnabled()); -#else - // In beta and stable channels, disabling entry with wrong style should be - // honored even if it is enabled in |kHKLM_ClientState| - EXPECT_FALSE(StatsConfigUtil::IsEnabled()); -#endif - - // If the runlevel is low, we cannot remove the entry under HKCU. - // The previous states should remain as it were. - EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium)); - EXPECT_TRUE(test.HasUsagestatsValue(kHKCU_ClientState)); - DWORD value = 0; - test.GetUsagestatsValue(kHKCU_ClientState, &value); - EXPECT_EQ(0, value); -} } // namespace mozc #endif // OS_WINDOWS @@ -761,3 +695,9 @@ EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); } #endif // OS_LINUX + +#else // !GOOGLE_JAPANESE_INPUT_BUILD +TEST(StatsConfigUtilTestNonOfficialBuild, DefaultValueTest) { + EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); +} +#endif diff --git a/hangul/unix/ibus/mozc-hangul.xml b/hangul/unix/ibus/mozc-hangul.xml index 6450016..3b1afb6 100755 --- a/hangul/unix/ibus/mozc-hangul.xml +++ b/hangul/unix/ibus/mozc-hangul.xml @@ -16,7 +16,6 @@ kr(kr104) mozc-hangul Mozc Hangul - Shift+space,Hangul diff --git a/mozc_version_template.txt b/mozc_version_template.txt index 08302d1..ae98308 100755 --- a/mozc_version_template.txt +++ b/mozc_version_template.txt @@ -1,4 +1,4 @@ MAJOR=1 MINOR=2 -BUILD=831 +BUILD=855 REVISION=102 diff --git a/rewriter/rewriter.cc b/rewriter/rewriter.cc index 896ad25..5b908b4 100755 --- a/rewriter/rewriter.cc +++ b/rewriter/rewriter.cc @@ -47,8 +47,8 @@ #include "rewriter/variants_rewriter.h" #include "rewriter/version_rewriter.h" #include "rewriter/zipcode_rewriter.h" -#if defined(OS_MACOSX) || defined(OS_WINDOWS) -// TODO(horo): Usage is available only in Mac and Windows now. +#if defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS) +// TODO(horo): Usage is available only in Mac and Windows and ChromeOS now. #include "rewriter/usage_rewriter.h" #endif DEFINE_bool(use_history_rewriter, true, "Use history rewriter or not."); @@ -82,12 +82,12 @@ AddRewriter(new DateRewriter); AddRewriter(new FortuneRewriter); AddRewriter(new VersionRewriter); -#if defined(OS_MACOSX) || defined(OS_WINDOWS) +#if defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS) // TODO(horo): Because infolist renderer window is implimented - // only in Mac and Windows, usage is available only - // in Mac and Winnows. + // only in Mac and Windows and ChromeOS, + // usage is available only in these OS. AddRewriter(new UsageRewriter); -#endif // defined(OS_MACOSX) || defined(OS_WINDOWS) +#endif // defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS) } RewriterInterface *g_rewriter = NULL; diff --git a/rewriter/rewriter.gyp b/rewriter/rewriter.gyp index eb7958a..aa60c03 100755 --- a/rewriter/rewriter.gyp +++ b/rewriter/rewriter.gyp @@ -80,9 +80,9 @@ 'calculator/calculator.gyp:calculator', 'rewriter_base.gyp:gen_rewriter_files', ], - # TODO(horo): usage is available only in Mac and Win now. + # TODO(horo): usage is available only in Mac and Win and ChromeOS now. 'conditions': [ - ['OS=="mac" or OS=="win"', { + ['OS=="mac" or OS=="win" or chromeos==1', { 'sources': [ '<(gen_out_dir)/usage_rewriter_data.h', 'usage_rewriter.cc', diff --git a/rewriter/rewriter_base.gyp b/rewriter/rewriter_base.gyp index c7dd781..1d2d129 100755 --- a/rewriter/rewriter_base.gyp +++ b/rewriter/rewriter_base.gyp @@ -169,46 +169,38 @@ '<@(input_files)', ], }, - { - 'action_name': 'gen_usage_rewriter_data', - 'variables': { - 'usage_data_file': [ - '<(DEPTH)/third_party/japanese_usage_dictionary/usage_dict.txt', - ], - 'cforms_file': [ - '../data/rules/cforms.def', - ], - }, - 'inputs': [ - '<@(usage_data_file)', - '<@(cforms_file)', - ], - 'conditions': [['two_pass_build==0', { - 'inputs': [ - '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main', - ], - }]], - 'outputs': [ - '<(gen_out_dir)/usage_rewriter_data.h', - ], - 'action': [ - '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main', - '--usage_data_file=<@(usage_data_file)', - '--cforms_file=<@(cforms_file)', - '--logtostderr', - '--output=<(gen_out_dir)/usage_rewriter_data.h', - ], - }, - ], - 'conditions': [['two_pass_build==0', { - 'dependencies': [ - 'install_gen_collocation_data_main', - 'install_gen_emoticon_rewriter_dictionary_main', - 'install_gen_single_kanji_rewriter_dictionary_main', - 'install_gen_symbol_rewriter_dictionary_main', - 'install_gen_usage_rewriter_dictionary_main', - ], - }]], + ], + 'conditions': [ + ['OS=="mac" or OS=="win" or chromeos==1', { + 'actions': [ + { + 'action_name': 'gen_usage_rewriter_data', + 'variables': { + 'usage_data_file': [ + '<(DEPTH)/third_party/japanese_usage_dictionary/usage_dict.txt', + ], + 'cforms_file': [ + '../data/rules/cforms.def', + ], + }, + 'inputs': [ + '<@(usage_data_file)', + '<@(cforms_file)', + ], + 'outputs': [ + '<(gen_out_dir)/usage_rewriter_data.h', + ], + 'action': [ + '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main', + '--usage_data_file=<@(usage_data_file)', + '--cforms_file=<@(cforms_file)', + '--logtostderr', + '--output=<(gen_out_dir)/usage_rewriter_data.h', + ], + }, + ], + }], + ], }, { 'target_name': 'gen_collocation_data_main', diff --git a/unix/ibus/gen_mozc_xml.py b/unix/ibus/gen_mozc_xml.py index b8f666f..95b3972 100755 --- a/unix/ibus/gen_mozc_xml.py +++ b/unix/ibus/gen_mozc_xml.py @@ -83,9 +83,6 @@ 'longname': ['%s (Japanese keyboard layout)', '%s (US keyboard layout)', '%s (US Dvorak keyboard layout)'], 'layout': ['jp', 'us', 'us(dvorak)'], - # hotkeys property is Chrome/Chromium OS specific. Upstream ibus-daemon - # doesn't support this. - 'hotkeys': ['Henkan,Zenkaku_Hankaku', '', ''], }, } @@ -165,9 +162,6 @@ for key in engine_common: OutputCppVariable(product_name, 'Engine', key, engine_common[key]) for key in engines: - if key == 'hotkeys': - # Skip hotkeys because it is not used from C++ code. - continue print 'const char* kEngine%sArray[] = {' % key.capitalize() for i in range(len(engines[key])): print '"%s",' % EmbedProductName(product_name, engines[key][i]) diff --git a/unix/ibus/main.cc b/unix/ibus/main.cc index 8339797..effeb36 100755 --- a/unix/ibus/main.cc +++ b/unix/ibus/main.cc @@ -140,14 +140,16 @@ int main(gint argc, gchar **argv) { InitGoogle(argv[0], &argc, &argv, true); +#ifdef OS_CHROMEOS + // On Chrome OS, mozc does not store the config data to a local file. + mozc::config::ConfigHandler::SetConfigFileName("memory://config.1.db"); + mozc::session::JapaneseSessionFactory session_factory; + mozc::session::SessionFactoryManager::SetSessionFactory(&session_factory); +#endif // OS_CHROMEOS ibus_init(); InitIBusComponent(FLAGS_ibus); #ifdef OS_CHROMEOS - // On Chrome OS, mozc does not store the config data to a local file. - mozc::config::ConfigHandler::SetConfigFileName("memory://config.1.db"); mozc::ibus::MozcEngine::InitConfig(g_config); - mozc::session::JapaneseSessionFactory session_factory; - mozc::session::SessionFactoryManager::SetSessionFactory(&session_factory); #else #ifndef NO_LOGGING EnableVerboseLog(); diff --git a/unix/ibus/mozc_engine.cc b/unix/ibus/mozc_engine.cc index 9214824..83b1555 100755 --- a/unix/ibus/mozc_engine.cc +++ b/unix/ibus/mozc_engine.cc @@ -949,43 +949,7 @@ for (int i = 0; i < candidates.candidate_size(); ++i) { const commands::Candidates::Candidate &candidate = candidates.candidate(i); - -#ifdef OS_CHROMEOS - const bool has_description = candidate.has_annotation() && - candidate.annotation().has_description(); - IBusText *text = NULL; - if (has_description) { - // |kDelimiter| divides a candidate and an annotation. - static const char kDelimiter[] = " "; - - // Append an annotation to a candidate word. Both are separated - // by |kDelimiter|. - text = ibus_text_new_from_string( - (candidate.value() + kDelimiter + - candidate.annotation().description()).c_str()); - - // The candidate window on Chrome OS will know - // the start index of an annotation by specific number (e.g. 0x888888). - // TODO(nhiroki): We should modify the way when iBus supports annotations. - const guint kAnnotationForegroundColor = 0x888888; - - // Insert an attribute. It incidates annotation's - // start and end index. - const guint start = Util::CharsLen(candidate.value() + kDelimiter); - const guint end = start + - Util::CharsLen(candidate.annotation().description()); - ibus_text_append_attribute(text, - IBUS_ATTR_TYPE_FOREGROUND, - kAnnotationForegroundColor, - start, - end); - } else { - text = ibus_text_new_from_string(candidate.value().c_str()); - } -#else IBusText *text = ibus_text_new_from_string(candidate.value().c_str()); -#endif - ibus_lookup_table_append_candidate(table, text); // |text| is released by ibus_engine_update_lookup_table along with |table|. @@ -1003,6 +967,34 @@ // |label| is released by ibus_engine_update_lookup_table along with // |table|. } + +#if defined(OS_CHROMEOS) and IBUS_CHECK_VERSION(1, 3, 99) + // The function ibus_serializable_set_attachment() had been changed + // to use GVariant in ibus-1.3.99. + // https://github.com/ibus/ibus/commit/ac9dfac13cef34288440a2ecdf067cd827fb2f8f + // But these codes are valid only for ChromeOS since: + // 1) IBus's default panel (main.py) does not support the attachment. + // 2) Ubuntu 10.10 uses ibus-1.3.99, but the version of ibus it uses is + // very old. + // If we only use IBUS_CHECK_VERSION, ibus-mozc does not compile on + // Ubuntu 10.10. + // Also we do not use only OS_CHROMEOS, because we will compile ibus-mozc for + // ChromeOS on Ubuntu for debugging even if following feature is missed. + if (output.has_candidates()) { + string buf; + output.candidates().SerializeToString(&buf); + + GByteArray *bytearray = g_byte_array_sized_new(buf.length()); + g_byte_array_append(bytearray, + reinterpret_cast(buf.c_str()), buf.length()); + GVariant* variant = g_variant_new_from_data(G_VARIANT_TYPE("ay"), + bytearray->data, bytearray->len, TRUE, + reinterpret_cast(g_byte_array_unref), bytearray); + ibus_serializable_set_attachment( + IBUS_SERIALIZABLE(table), "mozc.candidates", variant); + } +#endif + ibus_engine_update_lookup_table(engine, table, TRUE); // |table| is released by ibus_engine_update_lookup_table. diff --git a/unix/scim/mozc_connection.cc b/unix/scim/mozc_connection.cc index 9849801..38e30d0 100755 --- a/unix/scim/mozc_connection.cc +++ b/unix/scim/mozc_connection.cc @@ -48,14 +48,12 @@ mozc::client::ServerLauncherInterface *server_launcher, mozc::IPCClientFactoryInterface *client_factory) : translator_(new ScimKeyTranslator), - server_launcher_(server_launcher), - client_factory_(client_factory), preedit_method_(mozc::config::Config::ROMAN) { VLOG(1) << "MozcConnection is created"; mozc::client::ClientInterface *client = mozc::client::ClientFactory::NewClient(); - client->SetServerLauncher(server_launcher_); - client->SetIPCClientFactory(client_factory_.get()); + client->SetServerLauncher(server_launcher); + client->SetIPCClientFactory(client_factory); client_.reset(client); mozc::config::Config config; diff --git a/unix/scim/mozc_connection.h b/unix/scim/mozc_connection.h index 8fcf90d..65da5a2 100755 --- a/unix/scim/mozc_connection.h +++ b/unix/scim/mozc_connection.h @@ -124,8 +124,6 @@ const scoped_ptr translator_; scoped_ptr client_; - mozc::client::ServerLauncherInterface *server_launcher_; - scoped_ptr client_factory_; mozc::config::Config::PreeditMethod preedit_method_; DISALLOW_COPY_AND_ASSIGN(MozcConnection); diff --git a/upstream-debian/changelog b/upstream-debian/changelog index 8437060..0095d8c 100755 --- a/upstream-debian/changelog +++ b/upstream-debian/changelog @@ -1,3 +1,9 @@ +mozc (1.2.855.102) lucid; urgency=low + + * Ver. 1.2.855.102 on 2011-09-27 + + -- Tsuyoshi Horo Tue, 27 Sep 2011 15:55:43 +0900 + mozc (1.2.831.102) lucid; urgency=low * Updated dictionary.