Codebase list mozc / debian/1.3.975.102-1
Update uim-mozc to r304 Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> Nobuhiro Iwamatsu 12 years ago
2 changed file(s) with 246 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
11
22 * New upstream release (r94).
33 * Update patches/support-kfreebsd.patch.
4
5 -- Nobuhiro Iwamatsu <iwamatsu@debian.org> Fri, 27 Jan 2012 12:23:55 +0900
4 * Update uim-mozc patch to r304.
5
6 -- Nobuhiro Iwamatsu <iwamatsu@debian.org> Fri, 27 Jan 2012 17:30:19 +0900
67
78 mozc (1.3.931.102-1) unstable; urgency=low
89
0 Origin: macuim project: http://macuim.googlecode.com/svn/trunk / r290
0 Origin: macuim project: http://macuim.googlecode.com/svn/trunk / r304
11 Bug: none
22 Bug-Debian: none
33
4 From a8dab019e89185c013853ba987992177fd38833d Mon Sep 17 00:00:00 2001
4 From 2bee6c7a0e8b060bfde1a6fcdb1279405a73a82e Mon Sep 17 00:00:00 2001
55 From: Nobuhiro Iwamatsu <iwamatsu@debian.org>
6 Date: Sat, 17 Dec 2011 00:51:19 +0900
7 Subject: [PATCH] Add uim-mozc r288
6 Date: Fri, 27 Jan 2012 17:26:52 +0900
7 Subject: [PATCH] Update uim-mozc to r304
88
99 Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org>
1010 ---
11 unix/uim/key_translator.cc | 436 ++++++++++++++++
11 unix/uim/key_translator.cc | 436 ++++++++++++++
1212 unix/uim/key_translator.h | 111 ++++
13 unix/uim/mozc.cc | 1032 ++++++++++++++++++++++++++++++++++++++
14 unix/uim/scm/mozc-custom.scm | 385 ++++++++++++++
13 unix/uim/mozc.cc | 1190 ++++++++++++++++++++++++++++++++++++++
14 unix/uim/scm/mozc-custom.scm | 390 +++++++++++++
1515 unix/uim/scm/mozc-key-custom.scm | 74 +++
16 unix/uim/scm/mozc.scm | 513 +++++++++++++++++++
17 unix/uim/uim.gyp | 87 ++++
18 7 files changed, 2638 insertions(+), 0 deletions(-)
16 unix/uim/scm/mozc.scm | 555 ++++++++++++++++++
17 unix/uim/uim.gyp | 87 +++
18 7 files changed, 2843 insertions(+), 0 deletions(-)
1919 create mode 100644 unix/uim/key_translator.cc
2020 create mode 100644 unix/uim/key_translator.h
2121 create mode 100644 unix/uim/mozc.cc
2626
2727 diff --git a/unix/uim/key_translator.cc b/unix/uim/key_translator.cc
2828 new file mode 100644
29 index 0000000..6020923
29 index 0000000..c7c4c4a
3030 --- /dev/null
3131 +++ b/unix/uim/key_translator.cc
3232 @@ -0,0 +1,436 @@
3333 +// Copyright 2010, Google Inc.
34 +// Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
34 +// Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
3535 +// All rights reserved.
3636 +//
3737 +// Redistribution and use in source and binary forms, with or without
468468 +} // namespace mozc
469469 diff --git a/unix/uim/key_translator.h b/unix/uim/key_translator.h
470470 new file mode 100644
471 index 0000000..fbcc365
471 index 0000000..32f1659
472472 --- /dev/null
473473 +++ b/unix/uim/key_translator.h
474474 @@ -0,0 +1,111 @@
475475 +// Copyright 2010, Google Inc.
476 +// Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
476 +// Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
477477 +// All rights reserved.
478478 +//
479479 +// Redistribution and use in source and binary forms, with or without
585585 +#endif // MOZC_UNIX_UIM_KEY_TRANSLATOR_H_
586586 diff --git a/unix/uim/mozc.cc b/unix/uim/mozc.cc
587587 new file mode 100644
588 index 0000000..88b9633
588 index 0000000..d7e6498
589589 --- /dev/null
590590 +++ b/unix/uim/mozc.cc
591 @@ -0,0 +1,1032 @@
591 @@ -0,0 +1,1190 @@
592592 +/*
593593 +
594 + Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
594 + Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
595595 +
596596 + All rights reserved.
597597 +
693693 +} *context_slot;
694694 +
695695 +static KeyTranslator *keyTranslator;
696 +static bool enable_reconversion;
697 +static void update_all(uim_lisp mc_, int id);
696698 +
697699 +static int
698700 +unused_context_id(void)
723725 + context_slot[id].session->SyncData();
724726 + context_slot[id].last_sync_time = current_time;
725727 + }
728 +}
729 +
730 +static void
731 +update_deletion_range(uim_lisp mc_, int id)
732 +{
733 + commands::Output *output = context_slot[id].output;
734 + int offset, length;
735 +
736 + if (!enable_reconversion)
737 + return;
738 +
739 + if (!output->has_deletion_range())
740 + return;
741 +
742 + offset = output->deletion_range().offset();
743 + length = output->deletion_range().length();
744 +
745 + if (offset + length < 0)
746 + return;
747 +
748 + uim_scm_callf("im-delete-text", "oyyii", mc_, "primary", "cursor", -offset, offset + length);
726749 +}
727750 +
728751 +static void
913936 +}
914937 +
915938 +static void
939 +execute_callback(uim_lisp mc_, int id)
940 +{
941 + commands::Output *output = context_slot[id].output;
942 +
943 + if (!enable_reconversion)
944 + return;
945 +
946 + if (!output->has_callback())
947 + return;
948 +
949 + if (!output->callback().has_session_command())
950 + return;
951 +
952 + const commands::SessionCommand &command = output->callback().session_command();
953 + if (!command.has_type())
954 + return;
955 +
956 + const commands::SessionCommand::CommandType type = command.type();
957 + commands::SessionCommand session_command;
958 + session_command.set_type(type);
959 + int use_primary_text = 0;
960 +
961 + switch (type) {
962 + case commands::SessionCommand::UNDO:
963 + // do nothing.
964 + break;
965 + case commands::SessionCommand::CONVERT_REVERSE:
966 + {
967 + // try selected text first
968 + uim_lisp ustr = uim_scm_callf("im-acquire-text", "oyyiy", mc_, "selection", "beginning", 0, "full");
969 + uim_lisp latter;
970 +
971 + if (TRUEP(ustr) &&
972 + !NULLP(latter = uim_scm_callf("ustr-latter-seq", "o", ustr))) {
973 + uim_lisp str = CAR(latter);
974 +
975 + string text = REFER_C_STR(str);
976 + session_command.set_text(text);
977 + } else {
978 +#if 0
979 + // then primary text
980 + uim_lisp former;
981 + ustr = uim_scm_callf("im-acquire-text", "oyyyi", mc_, "primary", "cursor", "line", 0);
982 + if (TRUEP(ustr) && !NULLP(former = uim_scm_callf("ustr-former-seq", "o", ustr))) {
983 + uim_lisp str = CAR(former);
984 + string text = REFER_C_STR(str);
985 + session_command.set_text(text);
986 + use_primary_text = 1;
987 + } else
988 + return;
989 +#else
990 + // UNDO if no selection
991 + session_command.set_type(commands::SessionCommand::UNDO);
992 +#endif
993 + }
994 + }
995 + break;
996 + default:
997 + return;
998 + }
999 +
1000 + if (!context_slot[id].session->SendCommand(session_command, context_slot[id].output)) {
1001 + // callback command failed
1002 + return;
1003 + }
1004 +
1005 + if (type == commands::SessionCommand::CONVERT_REVERSE) {
1006 + if (use_primary_text)
1007 + uim_scm_callf("im-delete-text", "oyyyi", mc_, "primary", "cursor", "line", 0);
1008 + else
1009 + uim_scm_callf("im-delete-text", "oyyiy", mc_, "selection", "beginning", 0, "full");
1010 + }
1011 + update_all(mc_, id);
1012 +}
1013 +
1014 +static void
9161015 +update_all(uim_lisp mc_, int id)
9171016 +{
1017 + update_deletion_range(mc_, id);
9181018 + update_result(mc_, id);
9191019 + update_preedit(mc_, id);
9201020 + update_candidates(mc_, id);
9211021 + update_composition_mode(mc_, id);
1022 + execute_callback(mc_, id);
9221023 +}
9231024 +
9241025 +static uim_lisp
9491050 +#if !USE_CASCADING_CANDIDATES
9501051 + session->EnableCascadingWindow(false);
9511052 +#endif
1053 +
1054 + if (!enable_reconversion) {
1055 + if (!FALSEP(uim_scm_callf("symbol-bound?", "y", "mozc-check-uim-version")))
1056 + enable_reconversion = (bool)C_BOOL(uim_scm_callf("mozc-check-uim-version", "iii", 1, 7, 2));
1057 + }
1058 +
1059 + if (enable_reconversion) {
1060 + commands::Capability capability;
1061 + capability.set_text_deletion(commands::Capability::DELETE_PRECEDING_TEXT);
1062 + session->set_client_capability(capability);
1063 + }
1064 +
9521065 +
9531066 + return MAKE_INT(id);
9541067 +}
15051618 + const int32 cand_id = context_slot[id].output->candidates().candidate(idx).id();
15061619 +#endif
15071620 +
1508 + commands::Output output;
15091621 + commands::SessionCommand command;
15101622 + command.set_type(commands::SessionCommand::SELECT_CANDIDATE);
15111623 + command.set_id(cand_id);
15261638 + case config::Config::ROMAN:
15271639 + rule = 0;
15281640 + break;
1529 + case config::Config::KANA:
1641 + case config::Config::KANA:
15301642 + rule = 1;
15311643 + break;
15321644 + default:
15681680 +
15691681 + return uim_scm_t();
15701682 +}
1571 +
1683 +
1684 +static uim_lisp
1685 +reconvert(uim_lisp mc_, uim_lisp id_)
1686 +{
1687 + if (!enable_reconversion)
1688 + return uim_scm_f();
1689 +
1690 + int id = C_INT(id_);
1691 + commands::SessionCommand session_command;
1692 + session_command.set_type(commands::SessionCommand::CONVERT_REVERSE);
1693 +
1694 + // try selected text first, then primary text
1695 + uim_lisp ustr = uim_scm_callf("im-acquire-text", "oyyiy", mc_, "selection" , "beginning", 0, "full");
1696 + uim_lisp former, latter;
1697 + int use_primary_text = 0;
1698 +
1699 + if (TRUEP(ustr) &&
1700 + !NULLP(latter = uim_scm_callf("ustr-latter-seq", "o", ustr))) {
1701 + uim_lisp str = CAR(latter);
1702 +
1703 + string text = REFER_C_STR(str);
1704 + session_command.set_text(text);
1705 + } else {
1706 + ustr = uim_scm_callf("im-acquire-text", "oyyyi", mc_, "primary", "cursor", "line", 0);
1707 + if (TRUEP(ustr) &&
1708 + !NULLP(former = uim_scm_callf("ustr-former-seq", "o", ustr))) {
1709 + uim_lisp str = CAR(former);
1710 + string text = REFER_C_STR(str);
1711 + session_command.set_text(text);
1712 + use_primary_text = 1;
1713 + } else
1714 + return uim_scm_f();
1715 + }
1716 +
1717 + if (!context_slot[id].session->SendCommand(session_command, context_slot[id].output))
1718 + return uim_scm_f();
1719 +
1720 + if (use_primary_text)
1721 + uim_scm_callf("im-delete-text", "oyyyi", mc_, "primary", "cursor", "line", 0);
1722 + else
1723 + uim_scm_callf("im-delete-text", "oyyiy", mc_, "selection", "beginning", 0, "full");
1724 + update_all(mc_, id);
1725 +
1726 + return uim_scm_t();
1727 +}
1728 +
15721729 +} // namespace
15731730 +} // namespace
15741731 +
15941751 + uim_scm_init_proc3("mozc-lib-set-candidate-index", mozc::uim::select_candidate);
15951752 + uim_scm_init_proc1("mozc-lib-input-rule", mozc::uim::get_input_rule);
15961753 + uim_scm_init_proc3("mozc-lib-set-input-rule", mozc::uim::set_input_rule);
1754 + uim_scm_init_proc2("mozc-lib-reconvert", mozc::uim::reconvert);
15971755 +
15981756 + int argc = 1;
15991757 + static const char name[] = "uim-mozc";
16231781 +}
16241782 diff --git a/unix/uim/scm/mozc-custom.scm b/unix/uim/scm/mozc-custom.scm
16251783 new file mode 100644
1626 index 0000000..22df0c6
1784 index 0000000..f779728
16271785 --- /dev/null
16281786 +++ b/unix/uim/scm/mozc-custom.scm
1629 @@ -0,0 +1,385 @@
1787 @@ -0,0 +1,390 @@
16301788 +;;;
1631 +;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
1789 +;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
16321790 +;;;
16331791 +;;; All rights reserved.
16341792 +;;;
17751933 + 'mozc_tool_hand_writing
17761934 + "H"
17771935 + (N_ "Hand writing")
1778 + (N_ "Hand writing"))))
1936 + (N_ "Hand writing"))
1937 + (list 'action_mozc_reconvert
1938 + 'mozc_reconvert
1939 + "R"
1940 + (N_ "Reconvert")
1941 + (N_ "Reconvert"))))
17791942 +
17801943 +
17811944 +;;; Buttons
20142177 + (N_ "long description will be here."))
20152178 diff --git a/unix/uim/scm/mozc-key-custom.scm b/unix/uim/scm/mozc-key-custom.scm
20162179 new file mode 100644
2017 index 0000000..fbc94ae
2180 index 0000000..bcf8528
20182181 --- /dev/null
20192182 +++ b/unix/uim/scm/mozc-key-custom.scm
20202183 @@ -0,0 +1,74 @@
20212184 +;;;
2022 +;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
2185 +;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
20232186 +;;;
20242187 +;;; All rights reserved.
20252188 +;;;
20942257 + (_ "long description will be here"))
20952258 diff --git a/unix/uim/scm/mozc.scm b/unix/uim/scm/mozc.scm
20962259 new file mode 100644
2097 index 0000000..c66c799
2260 index 0000000..fc12561
20982261 --- /dev/null
20992262 +++ b/unix/uim/scm/mozc.scm
2100 @@ -0,0 +1,513 @@
2263 @@ -0,0 +1,555 @@
21012264 +;;;
2102 +;;; Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
2265 +;;; Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
21032266 +;;;
21042267 +;;; All rights reserved.
21052268 +;;;
21312294 +(require "util.scm")
21322295 +(require "process.scm")
21332296 +(require "japanese.scm")
2297 +(require "ustr.scm")
21342298 +(require-custom "generic-key-custom.scm")
21352299 +(require-custom "mozc-custom.scm")
21362300 +(require-custom "mozc-key-custom.scm")
21762340 + #f))
21772341 + ((= 0 pid2)
21782342 + (setenv "MALLOC_CHECK_" "0" 0)
2343 + (setenv "GTK_IM_MODULE" "gtk-im-context-simple" 0)
21792344 + (if (= (process-execute file argv) -1)
21802345 + (uim-notify-fatal (format (N_ "cannot execute ~a") file)))
21812346 + (_exit 0))
22032368 + (else
22042369 + #f))))
22052370 +
2371 +(define mozc-reconvert
2372 + (lambda (mc)
2373 + (let ((mid (mozc-context-mc-id mc)))
2374 + (if mid
2375 + (begin
2376 + (if (not (mozc-context-on mc))
2377 + (begin
2378 + (mozc-lib-set-on mid)
2379 + (mozc-context-set-on! mc #t)))
2380 + (mozc-lib-reconvert mc mid))
2381 + #f))))
2382 +
22062383 +(register-action 'action_mozc_hiragana
22072384 + (lambda (mc) ;; indication handler
22082385 + '(ja_hiragana
24072584 + (lambda (mc)
24082585 + (mozc-tool-activate mc 'mozc-tool-hand-writing)))
24092586 +
2587 +(register-action 'action_mozc_reconvert
2588 +;; (indication-alist-indicator 'action_mozc_reconvert
2589 +;; mozc-tool-indication-alist)
2590 + (lambda (mc)
2591 + '(mozc_reconvert
2592 + "R"
2593 + "Reconvert"
2594 + "Reconvert"))
2595 + (lambda (mc)
2596 + #f)
2597 + (lambda (mc)
2598 + (mozc-reconvert mc)))
24102599 +
24112600 +;; Update widget definitions based on action configurations. The
24122601 +;; procedure is needed for on-the-fly reconfiguration involving the
24372626 +(define mozc-context-new
24382627 + (lambda (id im name)
24392628 + (let* ((mc (mozc-context-new-internal id im))
2440 + (mc-id (if (symbol-bound? 'mozc-lib-alloc-context)
2629 + (mid (if (symbol-bound? 'mozc-lib-alloc-context)
24412630 + (mozc-lib-alloc-context mc)
24422631 + #f)))
24432632 + (mozc-context-set-widgets! mc mozc-widgets)
2444 + (mozc-context-set-mc-id! mc mc-id)
2633 + (mozc-context-set-mc-id! mc mid)
24452634 + mc)))
24462635 +
24472636 +(define mozc-separator
24572646 + (if (mozc-on-key? key key-state)
24582647 + (let ((mid (mozc-context-mc-id mc)))
24592648 + (if mid
2460 + (mozc-lib-set-on (mozc-context-mc-id mc)))
2649 + (mozc-lib-set-on mid))
24612650 + (mozc-context-set-on! mc #t))
24622651 + (im-commit-raw mc))))
24632652 +
24672656 +
24682657 +(define mozc-release-handler
24692658 + (lambda (mc)
2470 + (let ((mc-id (mozc-context-mc-id mc)))
2471 + (if mc-id
2472 + (mozc-lib-free-context mc-id)
2659 + (let ((mid (mozc-context-mc-id mc)))
2660 + (if mid
2661 + (mozc-lib-free-context mid)
24732662 + #f)
24742663 + #f)))
24752664 +
25872776 + (let ((mid (mozc-context-mc-id mc)))
25882777 + (mozc-lib-set-candidate-index mc mid idx))))
25892778 +
2779 +(define mozc-check-uim-version
2780 + (lambda (request-major request-minor request-patch)
2781 + (let* ((version (string-split (uim-version) "."))
2782 + (len (length version))
2783 + (major (if (>= len 1) (string->number (list-ref version 0)) 0))
2784 + (minor (if (>= len 2) (string->number (list-ref version 1)) 0))
2785 + (patch (if (>= len 3) (string->number (list-ref version 2)) 0)))
2786 + (or (> major request-major)
2787 + (and
2788 + (= major request-major)
2789 + (> minor request-minor))
2790 + (and
2791 + (= major request-major)
2792 + (= minor request-minor)
2793 + (>= patch request-patch))))))
2794 +
25902795 +(mozc-configure-widgets)
25912796 +
25922797 +(register-im
26132818 +)
26142819 diff --git a/unix/uim/uim.gyp b/unix/uim/uim.gyp
26152820 new file mode 100644
2616 index 0000000..9fe04ca
2821 index 0000000..3bbc62f
26172822 --- /dev/null
26182823 +++ b/unix/uim/uim.gyp
26192824 @@ -0,0 +1,87 @@
26202825 +#
2621 +# Copyright (c) 2010-2011 uim Project http://code.google.com/p/uim/
2826 +# Copyright (c) 2010-2012 uim Project http://code.google.com/p/uim/
26222827 +#
26232828 +# All rights reserved.
26242829 +#
27052910 + ],
27062911 +}
27072912 --
2708 1.7.7.3
2913 1.7.8.3
27092914