diff --git a/debian/changelog b/debian/changelog index 58e7e4e..32b7857 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ * New upstream release (r94). * Update patches/support-kfreebsd.patch. - - -- Nobuhiro Iwamatsu Fri, 27 Jan 2012 12:23:55 +0900 + * Update uim-mozc patch to r304. + + -- Nobuhiro Iwamatsu Fri, 27 Jan 2012 17:30:19 +0900 mozc (1.3.931.102-1) unstable; urgency=low diff --git a/debian/patches/uim-mozc.patch b/debian/patches/uim-mozc.patch index 1be24fa..2474206 100644 --- a/debian/patches/uim-mozc.patch +++ b/debian/patches/uim-mozc.patch @@ -1,22 +1,22 @@ -Origin: macuim project: http://macuim.googlecode.com/svn/trunk / r290 +Origin: macuim project: http://macuim.googlecode.com/svn/trunk / r304 Bug: none Bug-Debian: none -From a8dab019e89185c013853ba987992177fd38833d Mon Sep 17 00:00:00 2001 +From 2bee6c7a0e8b060bfde1a6fcdb1279405a73a82e Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu -Date: Sat, 17 Dec 2011 00:51:19 +0900 -Subject: [PATCH] Add uim-mozc r288 +Date: Fri, 27 Jan 2012 17:26:52 +0900 +Subject: [PATCH] Update uim-mozc to r304 Signed-off-by: Nobuhiro Iwamatsu --- - unix/uim/key_translator.cc | 436 ++++++++++++++++ + unix/uim/key_translator.cc | 436 ++++++++++++++ unix/uim/key_translator.h | 111 ++++ - unix/uim/mozc.cc | 1032 ++++++++++++++++++++++++++++++++++++++ - unix/uim/scm/mozc-custom.scm | 385 ++++++++++++++ + unix/uim/mozc.cc | 1190 ++++++++++++++++++++++++++++++++++++++ + unix/uim/scm/mozc-custom.scm | 390 +++++++++++++ unix/uim/scm/mozc-key-custom.scm | 74 +++ - unix/uim/scm/mozc.scm | 513 +++++++++++++++++++ - unix/uim/uim.gyp | 87 ++++ - 7 files changed, 2638 insertions(+), 0 deletions(-) + unix/uim/scm/mozc.scm | 555 ++++++++++++++++++ + unix/uim/uim.gyp | 87 +++ + 7 files changed, 2843 insertions(+), 0 deletions(-) create mode 100644 unix/uim/key_translator.cc create mode 100644 unix/uim/key_translator.h create mode 100644 unix/uim/mozc.cc @@ -27,12 +27,12 @@ diff --git a/unix/uim/key_translator.cc b/unix/uim/key_translator.cc new file mode 100644 -index 0000000..6020923 +index 0000000..c7c4c4a --- /dev/null +++ b/unix/uim/key_translator.cc @@ -0,0 +1,436 @@ +// Copyright 2010, Google Inc. -+// Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++// Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without @@ -469,12 +469,12 @@ +} // namespace mozc diff --git a/unix/uim/key_translator.h b/unix/uim/key_translator.h new file mode 100644 -index 0000000..fbcc365 +index 0000000..32f1659 --- /dev/null +++ b/unix/uim/key_translator.h @@ -0,0 +1,111 @@ +// Copyright 2010, Google Inc. -+// Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++// Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without @@ -586,13 +586,13 @@ +#endif // MOZC_UNIX_UIM_KEY_TRANSLATOR_H_ diff --git a/unix/uim/mozc.cc b/unix/uim/mozc.cc new file mode 100644 -index 0000000..88b9633 +index 0000000..d7e6498 --- /dev/null +++ b/unix/uim/mozc.cc -@@ -0,0 +1,1032 @@ +@@ -0,0 +1,1190 @@ +/* + -+ Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++ Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ + + All rights reserved. + @@ -694,6 +694,8 @@ +} *context_slot; + +static KeyTranslator *keyTranslator; ++static bool enable_reconversion; ++static void update_all(uim_lisp mc_, int id); + +static int +unused_context_id(void) @@ -724,6 +726,27 @@ + context_slot[id].session->SyncData(); + context_slot[id].last_sync_time = current_time; + } ++} ++ ++static void ++update_deletion_range(uim_lisp mc_, int id) ++{ ++ commands::Output *output = context_slot[id].output; ++ int offset, length; ++ ++ if (!enable_reconversion) ++ return; ++ ++ if (!output->has_deletion_range()) ++ return; ++ ++ offset = output->deletion_range().offset(); ++ length = output->deletion_range().length(); ++ ++ if (offset + length < 0) ++ return; ++ ++ uim_scm_callf("im-delete-text", "oyyii", mc_, "primary", "cursor", -offset, offset + length); +} + +static void @@ -914,12 +937,90 @@ +} + +static void ++execute_callback(uim_lisp mc_, int id) ++{ ++ commands::Output *output = context_slot[id].output; ++ ++ if (!enable_reconversion) ++ return; ++ ++ if (!output->has_callback()) ++ return; ++ ++ if (!output->callback().has_session_command()) ++ return; ++ ++ const commands::SessionCommand &command = output->callback().session_command(); ++ if (!command.has_type()) ++ return; ++ ++ const commands::SessionCommand::CommandType type = command.type(); ++ commands::SessionCommand session_command; ++ session_command.set_type(type); ++ int use_primary_text = 0; ++ ++ switch (type) { ++ case commands::SessionCommand::UNDO: ++ // do nothing. ++ break; ++ case commands::SessionCommand::CONVERT_REVERSE: ++ { ++ // try selected text first ++ uim_lisp ustr = uim_scm_callf("im-acquire-text", "oyyiy", mc_, "selection", "beginning", 0, "full"); ++ uim_lisp latter; ++ ++ if (TRUEP(ustr) && ++ !NULLP(latter = uim_scm_callf("ustr-latter-seq", "o", ustr))) { ++ uim_lisp str = CAR(latter); ++ ++ string text = REFER_C_STR(str); ++ session_command.set_text(text); ++ } else { ++#if 0 ++ // then primary text ++ uim_lisp former; ++ ustr = uim_scm_callf("im-acquire-text", "oyyyi", mc_, "primary", "cursor", "line", 0); ++ if (TRUEP(ustr) && !NULLP(former = uim_scm_callf("ustr-former-seq", "o", ustr))) { ++ uim_lisp str = CAR(former); ++ string text = REFER_C_STR(str); ++ session_command.set_text(text); ++ use_primary_text = 1; ++ } else ++ return; ++#else ++ // UNDO if no selection ++ session_command.set_type(commands::SessionCommand::UNDO); ++#endif ++ } ++ } ++ break; ++ default: ++ return; ++ } ++ ++ if (!context_slot[id].session->SendCommand(session_command, context_slot[id].output)) { ++ // callback command failed ++ return; ++ } ++ ++ if (type == commands::SessionCommand::CONVERT_REVERSE) { ++ if (use_primary_text) ++ uim_scm_callf("im-delete-text", "oyyyi", mc_, "primary", "cursor", "line", 0); ++ else ++ uim_scm_callf("im-delete-text", "oyyiy", mc_, "selection", "beginning", 0, "full"); ++ } ++ update_all(mc_, id); ++} ++ ++static void +update_all(uim_lisp mc_, int id) +{ ++ update_deletion_range(mc_, id); + update_result(mc_, id); + update_preedit(mc_, id); + update_candidates(mc_, id); + update_composition_mode(mc_, id); ++ execute_callback(mc_, id); +} + +static uim_lisp @@ -950,6 +1051,18 @@ +#if !USE_CASCADING_CANDIDATES + session->EnableCascadingWindow(false); +#endif ++ ++ if (!enable_reconversion) { ++ if (!FALSEP(uim_scm_callf("symbol-bound?", "y", "mozc-check-uim-version"))) ++ enable_reconversion = (bool)C_BOOL(uim_scm_callf("mozc-check-uim-version", "iii", 1, 7, 2)); ++ } ++ ++ if (enable_reconversion) { ++ commands::Capability capability; ++ capability.set_text_deletion(commands::Capability::DELETE_PRECEDING_TEXT); ++ session->set_client_capability(capability); ++ } ++ + + return MAKE_INT(id); +} @@ -1506,7 +1619,6 @@ + const int32 cand_id = context_slot[id].output->candidates().candidate(idx).id(); +#endif + -+ commands::Output output; + commands::SessionCommand command; + command.set_type(commands::SessionCommand::SELECT_CANDIDATE); + command.set_id(cand_id); @@ -1527,7 +1639,7 @@ + case config::Config::ROMAN: + rule = 0; + break; -+ case config::Config::KANA: ++ case config::Config::KANA: + rule = 1; + break; + default: @@ -1569,7 +1681,52 @@ + + return uim_scm_t(); +} -+ ++ ++static uim_lisp ++reconvert(uim_lisp mc_, uim_lisp id_) ++{ ++ if (!enable_reconversion) ++ return uim_scm_f(); ++ ++ int id = C_INT(id_); ++ commands::SessionCommand session_command; ++ session_command.set_type(commands::SessionCommand::CONVERT_REVERSE); ++ ++ // try selected text first, then primary text ++ uim_lisp ustr = uim_scm_callf("im-acquire-text", "oyyiy", mc_, "selection" , "beginning", 0, "full"); ++ uim_lisp former, latter; ++ int use_primary_text = 0; ++ ++ if (TRUEP(ustr) && ++ !NULLP(latter = uim_scm_callf("ustr-latter-seq", "o", ustr))) { ++ uim_lisp str = CAR(latter); ++ ++ string text = REFER_C_STR(str); ++ session_command.set_text(text); ++ } else { ++ ustr = uim_scm_callf("im-acquire-text", "oyyyi", mc_, "primary", "cursor", "line", 0); ++ if (TRUEP(ustr) && ++ !NULLP(former = uim_scm_callf("ustr-former-seq", "o", ustr))) { ++ uim_lisp str = CAR(former); ++ string text = REFER_C_STR(str); ++ session_command.set_text(text); ++ use_primary_text = 1; ++ } else ++ return uim_scm_f(); ++ } ++ ++ if (!context_slot[id].session->SendCommand(session_command, context_slot[id].output)) ++ return uim_scm_f(); ++ ++ if (use_primary_text) ++ uim_scm_callf("im-delete-text", "oyyyi", mc_, "primary", "cursor", "line", 0); ++ else ++ uim_scm_callf("im-delete-text", "oyyiy", mc_, "selection", "beginning", 0, "full"); ++ update_all(mc_, id); ++ ++ return uim_scm_t(); ++} ++ +} // namespace +} // namespace + @@ -1595,6 +1752,7 @@ + uim_scm_init_proc3("mozc-lib-set-candidate-index", mozc::uim::select_candidate); + uim_scm_init_proc1("mozc-lib-input-rule", mozc::uim::get_input_rule); + uim_scm_init_proc3("mozc-lib-set-input-rule", mozc::uim::set_input_rule); ++ uim_scm_init_proc2("mozc-lib-reconvert", mozc::uim::reconvert); + + int argc = 1; + static const char name[] = "uim-mozc"; @@ -1624,12 +1782,12 @@ +} diff --git a/unix/uim/scm/mozc-custom.scm b/unix/uim/scm/mozc-custom.scm new file mode 100644 -index 0000000..22df0c6 +index 0000000..f779728 --- /dev/null +++ b/unix/uim/scm/mozc-custom.scm -@@ -0,0 +1,385 @@ +@@ -0,0 +1,390 @@ +;;; -+;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +;;; +;;; All rights reserved. +;;; @@ -1776,7 +1934,12 @@ + 'mozc_tool_hand_writing + "H" + (N_ "Hand writing") -+ (N_ "Hand writing")))) ++ (N_ "Hand writing")) ++ (list 'action_mozc_reconvert ++ 'mozc_reconvert ++ "R" ++ (N_ "Reconvert") ++ (N_ "Reconvert")))) + + +;;; Buttons @@ -2015,12 +2178,12 @@ + (N_ "long description will be here.")) diff --git a/unix/uim/scm/mozc-key-custom.scm b/unix/uim/scm/mozc-key-custom.scm new file mode 100644 -index 0000000..fbc94ae +index 0000000..bcf8528 --- /dev/null +++ b/unix/uim/scm/mozc-key-custom.scm @@ -0,0 +1,74 @@ +;;; -+;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +;;; +;;; All rights reserved. +;;; @@ -2095,12 +2258,12 @@ + (_ "long description will be here")) diff --git a/unix/uim/scm/mozc.scm b/unix/uim/scm/mozc.scm new file mode 100644 -index 0000000..c66c799 +index 0000000..fc12561 --- /dev/null +++ b/unix/uim/scm/mozc.scm -@@ -0,0 +1,513 @@ +@@ -0,0 +1,555 @@ +;;; -+;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +;;; +;;; All rights reserved. +;;; @@ -2132,6 +2295,7 @@ +(require "util.scm") +(require "process.scm") +(require "japanese.scm") ++(require "ustr.scm") +(require-custom "generic-key-custom.scm") +(require-custom "mozc-custom.scm") +(require-custom "mozc-key-custom.scm") @@ -2177,6 +2341,7 @@ + #f)) + ((= 0 pid2) + (setenv "MALLOC_CHECK_" "0" 0) ++ (setenv "GTK_IM_MODULE" "gtk-im-context-simple" 0) + (if (= (process-execute file argv) -1) + (uim-notify-fatal (format (N_ "cannot execute ~a") file))) + (_exit 0)) @@ -2204,6 +2369,18 @@ + (else + #f)))) + ++(define mozc-reconvert ++ (lambda (mc) ++ (let ((mid (mozc-context-mc-id mc))) ++ (if mid ++ (begin ++ (if (not (mozc-context-on mc)) ++ (begin ++ (mozc-lib-set-on mid) ++ (mozc-context-set-on! mc #t))) ++ (mozc-lib-reconvert mc mid)) ++ #f)))) ++ +(register-action 'action_mozc_hiragana + (lambda (mc) ;; indication handler + '(ja_hiragana @@ -2408,6 +2585,18 @@ + (lambda (mc) + (mozc-tool-activate mc 'mozc-tool-hand-writing))) + ++(register-action 'action_mozc_reconvert ++;; (indication-alist-indicator 'action_mozc_reconvert ++;; mozc-tool-indication-alist) ++ (lambda (mc) ++ '(mozc_reconvert ++ "R" ++ "Reconvert" ++ "Reconvert")) ++ (lambda (mc) ++ #f) ++ (lambda (mc) ++ (mozc-reconvert mc))) + +;; Update widget definitions based on action configurations. The +;; procedure is needed for on-the-fly reconfiguration involving the @@ -2438,11 +2627,11 @@ +(define mozc-context-new + (lambda (id im name) + (let* ((mc (mozc-context-new-internal id im)) -+ (mc-id (if (symbol-bound? 'mozc-lib-alloc-context) ++ (mid (if (symbol-bound? 'mozc-lib-alloc-context) + (mozc-lib-alloc-context mc) + #f))) + (mozc-context-set-widgets! mc mozc-widgets) -+ (mozc-context-set-mc-id! mc mc-id) ++ (mozc-context-set-mc-id! mc mid) + mc))) + +(define mozc-separator @@ -2458,7 +2647,7 @@ + (if (mozc-on-key? key key-state) + (let ((mid (mozc-context-mc-id mc))) + (if mid -+ (mozc-lib-set-on (mozc-context-mc-id mc))) ++ (mozc-lib-set-on mid)) + (mozc-context-set-on! mc #t)) + (im-commit-raw mc)))) + @@ -2468,9 +2657,9 @@ + +(define mozc-release-handler + (lambda (mc) -+ (let ((mc-id (mozc-context-mc-id mc))) -+ (if mc-id -+ (mozc-lib-free-context mc-id) ++ (let ((mid (mozc-context-mc-id mc))) ++ (if mid ++ (mozc-lib-free-context mid) + #f) + #f))) + @@ -2588,6 +2777,22 @@ + (let ((mid (mozc-context-mc-id mc))) + (mozc-lib-set-candidate-index mc mid idx)))) + ++(define mozc-check-uim-version ++ (lambda (request-major request-minor request-patch) ++ (let* ((version (string-split (uim-version) ".")) ++ (len (length version)) ++ (major (if (>= len 1) (string->number (list-ref version 0)) 0)) ++ (minor (if (>= len 2) (string->number (list-ref version 1)) 0)) ++ (patch (if (>= len 3) (string->number (list-ref version 2)) 0))) ++ (or (> major request-major) ++ (and ++ (= major request-major) ++ (> minor request-minor)) ++ (and ++ (= major request-major) ++ (= minor request-minor) ++ (>= patch request-patch)))))) ++ +(mozc-configure-widgets) + +(register-im @@ -2614,12 +2819,12 @@ +) diff --git a/unix/uim/uim.gyp b/unix/uim/uim.gyp new file mode 100644 -index 0000000..9fe04ca +index 0000000..3bbc62f --- /dev/null +++ b/unix/uim/uim.gyp @@ -0,0 +1,87 @@ +# -+# Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/ ++# Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/ +# +# All rights reserved. +# @@ -2706,5 +2911,5 @@ + ], +} -- -1.7.7.3 +1.7.8.3