[uim-commit] r1951 - in branches/r5rs: . doc gtk scm uim xim
ekato at freedesktop.org
ekato at freedesktop.org
Wed Nov 2 21:10:46 PST 2005
Author: ekato
Date: 2005-11-02 21:10:43 -0800 (Wed, 02 Nov 2005)
New Revision: 1951
Modified:
branches/r5rs/
branches/r5rs/configure.ac
branches/r5rs/doc/COMPATIBILITY
branches/r5rs/gtk/gtk-im-uim.c
branches/r5rs/scm/action.scm
branches/r5rs/scm/anthy.scm
branches/r5rs/scm/canna.scm
branches/r5rs/scm/custom-rt.scm
branches/r5rs/scm/custom.scm
branches/r5rs/scm/im-custom.scm
branches/r5rs/scm/im.scm
branches/r5rs/scm/prime-custom.scm
branches/r5rs/uim/skk.c
branches/r5rs/uim/uim-custom.c
branches/r5rs/uim/uim-func.c
branches/r5rs/uim/uim-helper.c
branches/r5rs/uim/uim-helper.h
branches/r5rs/uim/uim-internal.h
branches/r5rs/uim/uim.c
branches/r5rs/uim/uim.h
branches/r5rs/xim/canddisp.cpp
branches/r5rs/xim/helper.cpp
branches/r5rs/xim/locale.cpp
branches/r5rs/xim/main.cpp
branches/r5rs/xim/util.h
branches/r5rs/xim/ximserver.cpp
branches/r5rs/xim/ximserver.h
Log:
r1958 at ibg4 (orig r6): kato | 2005-11-03 13:44:05 +0900
Sync with r1906 trunk.
r1578 at ibg4 (orig r1577): yamamoto | 2005-09-25 14:48:28 +0900
* scm/anthy.scm:
-(anthy-context-change-kana-mode!): New function.
-(action_anthy_hiragana, action_anthy_katakana, action_anthy_hankana,
action_anthy_kana, anthy-context-kana-toggle,
anthy-proc-input-state-no-preedit): Replace
anthy-context-set-kana-mode! with anthy-context-change-kana-mode!
-(anthy-proc-transposing-state): Don't transpose to latin and wide
latin if input rule is kana.
* scm/canna.scm:
-(canna-prepare-activation): Reset conversion if needed.
-(canna-context-change-kana-mode!): New function.
-(action_canna_hiragana, action_canna_katakana, action_canna_hankana,
action_canna_kana, canna-context-kana-toggle,
canna-proc-input-state-no-preedit): Replace
canna-context-set-kana-mode! with canna-context-change-kana-mode!
-(canna-proc-input-state-with-preedit, canna-input-state-preedit):
Fix invalid arguments of multi-segment-make-*-string.
-(canna-proc-input-state-with-preedit): Include pending string in
commit string.
r1593 at ibg4 (orig r1592): yamaken | 2005-09-26 03:23:00 +0900
* uim/slib.c
- (NEWCELL): Initialize dbg_info with NIL which originally intended
r1594 at ibg4 (orig r1593): yamaken | 2005-09-26 03:48:51 +0900
* This commit reverts the experimental patch post in [Anthy-dev 2149]
committed in r1027, since the problem is resolved at other place
* uim/uim.c
- (uim_quiting): Removed
- (uim_quit): Remove uim_quiting handlings
r1608 at ibg4 (orig r1607): yamaken | 2005-09-27 12:21:50 +0900
* uim/uim-scm-gc.c
- Removed since the recent implementation change enables that the
functions can be contained uim-scm.c and single object file
* uim/uim-scm.c
- (uim_scm_gc_protect_stack_ptr,
uim_scm_gc_ensure_uninlined_func_ptr,
uim_scm_gc_protect_stack_internal,
uim_scm_gc_ensure_uninlined_func_internal): Moved from uim-scm-gc.c
* uim/Makefile.am
- (libuim_la_SOURCES): Remove uim-scm-gc.c
r1635 at ibg4 (orig r1634): ekato | 2005-09-28 16:14:02 +0900
* scm/rk.scm : Port r1633 from r5rs.
r1658 at ibg4 (orig r1657): tkng | 2005-09-28 22:20:28 +0900
* scm/custom-rt.scm:
-(require-custom): Don't load user configration file if worked under
setuid/setgid application.
-(custom-reload-user-configs): Ditto.
r1659 at ibg4 (orig r1658): tkng | 2005-09-28 22:26:47 +0900
* uim/uim-helper.c, uim/uim-helper.h:
-(uim_helper_is_setugid): New function.
* uim/uim-custom.c:
-(uim_custom_load): Check added for setuid/setgid applications.
-(uim_custom_save): Ditto.
r1734 at ibg4 (orig r1733): ekato | 2005-10-02 15:19:21 +0900
* gtk/gtk-im-uim.c (im_uim_finalize) : Check tag > 0 for
"timeout-tag" of caret state indicator.
r1778 at ibg4 (orig r1777): yamaken | 2005-10-04 05:03:34 +0900
* uim/uim-scm.h
- (uim_scm_gc_protect_stack_ptr): Add volatile qualifier
- (uim_scm_uninlined_func_ptr): New variable
- (uim_scm_gc_ensure_uninlined_func_ptr,
uim_scm_gc_ensure_uninlined_func_internal): Removed
- Revise the description about the uninlining ensuring
* uim/uim-scm.c
- (uim_scm_gc_protect_stack_ptr): Add volatile qualifier
- (uim_scm_uninlined_func_ptr): New variable
- (uim_scm_gc_ensure_uninlined_func,
uim_scm_gc_ensure_uninlined_func_ptr,
uim_scm_gc_ensure_uninlined_func_internal): Removed
- (UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL): Follow the change of
uninlining ensuring method
r1826 at ibg4 (orig r1825): yamaken | 2005-10-07 03:48:56 +0900
* This commit revises the stack protection API again. Thank you Jun
Inoue for basic concepts and many ideas
* uim/uim-scm.h
- (uim_scm_uninlined_func_ptr): Removed
- (UIM_SCM_GC_PROTECTED_FUNC_T, UIM_SCM_GC_PROTECTED_FUNC_DECL,
UIM_SCM_GC_CALL_PROTECTED_FUNC,
UIM_SCM_GC_CALL_PROTECTED_VOID_FUNC,
UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL): Removed
- (UIM_SCM_GC_PROTECTED_CALL, UIM_SCM_GC_PROTECTED_CALL_VOID,
UIM_SCM_GC_PROTECTED_CALL_INTERNAL): New macro
* uim/uim-scm.c
- (uim_scm_uninlined_func_ptr): Removed
- (uim_scm_c_int_internal, uim_scm_refer_c_str_internal,
uim_scm_eval_internal, siod_init_subr_internal,
uim_scm_eval_c_string_internal): Defined as normal function to
follow the new API
- (uim_scm_c_int, uim_scm_refer_c_str, uim_scm_eval,
uim_scm_eval_c_string, siod_init_subr): Follow the new API
* uim/uim-compat-scm.c
- (uim_scm_symbol_value_int_internal,
uim_scm_symbol_value_str_internal): Defined as normal function to
follow the new API
- (uim_scm_symbol_value_int, uim_scm_symbol_value_str): Follow the
new API
* uim/plugin.c
- (plugin_unload_internal, uim_quit_plugin_internal): Defined as
normal function to follow the new API
- (plugin_unload, uim_quit_plugin): Follow the new API
* uim/uim-custom.c
- (literalize_string_internal, custom_cb_add_internal): Defined as
normal function to follow the new API
- (literalize_string, custom_cb_add): Follow the new API
* uim/editline.c
- (uim_editline_readline_internal): Defined as normal function to
follow the new API
- (uim_editline_readline): Follow the new API
r1831 at ibg4 (orig r1830): yamaken | 2005-10-08 02:17:55 +0900
* AUTHORS
* gnuify-changelog.pl
- Add Jun Inoue as committer
r1838 at ibg4 (orig r1837): ekato | 2005-10-14 14:01:46 +0900
* xim/util.h : Fix typo reported on [Anthy-dev 2533] by NOKUBI
Takatsugu.
r1854 at ibg4 (orig r1853): ekato | 2005-10-17 21:55:39 +0900
* xim/locale.cpp : Define _GNU_SOURCE at the top.
* xim/helper.cpp : Ditto.
* xim/ximserver.cpp : Ditto.
* xim/main.cpp : Ditto.
* xim/canddisop.cpp : Ditto.
r1862 at ibg4 (orig r1861): yamaken | 2005-10-21 10:20:12 +0900
* scm/prime-custom.scm
- (custom prime-custom-default-language, custom
prime-auto-register-mode): Remove misuse of primary-group 'global'
as subgroup. Thanks the anonymous reporter
r1863 at ibg4 (orig r1862): yamaken | 2005-10-21 10:48:45 +0900
* scm/prime-custom.scm
- (custom-group-label, custom-group-desc): Revert R5RS-incompatible
and inappropriate responsibility error handling added in r1126
- (define-custom): Add existence check for groups
* scm/custom-rt.scm
- (require-custom): Add a TODO comment
r1865 at ibg4 (orig r1864): yamaken | 2005-10-21 17:25:57 +0900
* scm/action.scm
- (context-current-widget-states, context-update-widget-states!):
New procedure
r1867 at ibg4 (orig r1866): ekato | 2005-10-22 23:17:10 +0900
* uim/uim.h (uim_set_configuration_changed_cb) : New API. Set
a callback function which is called when configuration of the
input context is changed.
* uim/uim-internal.h (uim_context_) : Add void
(*configuration_changed_cb)
* uim/uim-func.c (switch_im) : Call configuration_changed_cb if
exists.
* uim/uim.c (uim_create_context) : Initialize
uc->configuration_changed_cb.
(uim_set_configuration_changed_cb) : New.
r1868 at ibg4 (orig r1867): ekato | 2005-10-22 23:30:44 +0900
* xim/ximserver.h (class InputContext) : Add
configuration_changed() public member. Add
configuration_changed_cb() static member. Add review_im()
private member.
* xim/ximserver.cpp : Include uim-im-switcher.h.
(InputContext::createUimContext) : Set configuration_changed_cb.
(InputContext::configuration_changed) : New function. Call
review_im() to check input method.
(InputContext::review_im) : New function. Review newly switched
input method if it is matched with a encoding of the client.
(InputContext::configuration_changed_cb) : New.
* xim/main.cpp (reload_uim) : Don't print information.
r1869 at ibg4 (orig r1868): ekato | 2005-10-22 23:40:14 +0900
* scm/im.scm : Add input method toggle functionality.
(toggle-im-preserved-im) : New variable.
(toggle-im-preserved-widget-states) : Ditto.
(toggle-im-alt-preserved-widget-states) : Ditto.
(toggle-im) : New function. Toggle two input methods with
preserving their widget states.
(key-press-handler) : Check toggle-im-key?.
* scm/im-custom.scm : Add new custom settings for im-toggle.
(enable-im-toggle?) : New setting. It is enabled by default.
(toggle-im-key) : New key setting for im-toggle, dependent on
enable-im-toggle? activity.
(toggle-im-alt-im) : Alternative IM for im-toggle, dependent on
enable-im-toggle? activity.
r1877 at ibg4 (orig r1876): ekato | 2005-10-23 23:59:45 +0900
* doc/COMPATIBILITY : Add description about
uim_set_configuration_changed_cb.
r1883 at ibg4 (orig r1882): yamaken | 2005-10-27 03:45:13 +0900
* configure.ac
- Revert incomplete pthread-related codes as notified in [Anthy-dev
2571]
* uim/uim-internal.h
- (UIM_DEFINE_MUTEX, UIM_DEFINE_MUTEX_STATIC, UIM_LOCK_MUTEX,
UIM_UNLOCK_MUTEX, UIM_EVAL_FSTRING1_WITH_MUTEX,
UIM_EVAL_FSTRING2_WITH_MUTEX, UIM_EVAL_FSTRING3_WITH_MUTEX): Ditto
* uim/uim.c
- (mtx_initing_or_quiting, mtx_context_array, get_context_id,
put_context_id, uim_find_context, uim_init, uim_quit): Ditto
r1887 at ibg4 (orig r1886): yamaken | 2005-10-27 05:06:09 +0900
* scm/util.scm
- (try-load, try-require): Add a comment about the file existence check
r1907 at ibg4 (orig r1906): ekato | 2005-10-31 22:56:34 +0900
* uim/skk.c (make_comp_array_from_cache) : Don't use pre-commited
entry for completion.
Property changes on: branches/r5rs
___________________________________________________________________
Name: svk:merge
- 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1575
+ 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
74100eb5-a104-0410-9326-fdab01523867:/branches/r5rs:6
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1906
Modified: branches/r5rs/configure.ac
===================================================================
--- branches/r5rs/configure.ac 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/configure.ac 2005-11-03 05:10:43 UTC (rev 1951)
@@ -174,7 +174,6 @@
AC_CHECK_HEADERS([pty.h utmp.h util.h libutil.h])
AC_CHECK_HEADERS([curses.h stropts.h])
AC_CHECK_HEADERS([sys/param.h strings.h])
-AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
# Check for type
AC_CHECK_TYPES(sig_atomic_t, , ,
@@ -544,7 +543,6 @@
AM_CONDITIONAL(COMPAT_TABLE, test x$enable_compat_table = xyes)
AM_CONDITIONAL(NEED_SETENV_C, test $ac_cv_func_setenv = no -o $ac_cv_func_unsetenv = no)
AM_CONDITIONAL(NEED_STRSEP_C, test $ac_cv_func_strsep = no)
-AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
if test "x$use_applet" = "xyes"; then
AC_PROG_INTLTOOL
@@ -812,7 +810,6 @@
DICT : ${use_dict}
EB : ${use_eb}
libedit : ${use_libedit}
- pthread : ${have_pthread}
Default toolkit : ${default_toolkit}
])
Modified: branches/r5rs/doc/COMPATIBILITY
===================================================================
--- branches/r5rs/doc/COMPATIBILITY 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/doc/COMPATIBILITY 2005-11-03 05:10:43 UTC (rev 1951)
@@ -56,8 +56,24 @@
The changes are described below in most recently updated order.
-
------------------------------------------------------------------------------
+Summary: Notification of changes in input context configuration
+Affects: Bridge developers
+Updates: C API
+Version: 0.5.1
+Revision: ac1866
+Date: 2005-10-23
+Modifier: Etsushi Kato
+Related: IM switch by hot keys
+URL:
+ http://lists.sourceforge.jp/mailman/archives/anthy-dev/2005-October/002577.html (Japanese)
+Changes:
+ (new) uim_set_configuration_changed_cb
+Description:
+ API for setting a callback function for notifying some configuration
+ changes in input context. The callback is typically called when IM
+ of a context is changed.
+------------------------------------------------------------------------------
Summary: Obsolete some misc Scheme APIs
Affects: IM developers
Updates: Scheme API
Modified: branches/r5rs/gtk/gtk-im-uim.c
===================================================================
--- branches/r5rs/gtk/gtk-im-uim.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/gtk/gtk-im-uim.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -667,7 +667,8 @@
}
if (uic->caret_state_indicator) {
guint tag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(uic->caret_state_indicator), "timeout-tag"));
- g_source_remove(tag);
+ if (tag > 0)
+ g_source_remove(tag);
gtk_widget_destroy(uic->caret_state_indicator);
uic->caret_state_indicator = NULL;
}
Modified: branches/r5rs/scm/action.scm
===================================================================
--- branches/r5rs/scm/action.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/action.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -327,6 +327,22 @@
context-list)))
;; API for uim developers
+;; returns action-id list that can be passed to context-update-widget-states!
+;; TODO: write test
+(define context-current-widget-states
+ (let ((widget-act-id (compose action-id widget-activity)))
+ (lambda (context)
+ (map widget-act-id (context-widgets context)))))
+
+;; API for uim developers
+;; TODO: write test
+(define context-update-widget-states!
+ (lambda (context act-ids)
+ (for-each widget-activate!
+ (context-widgets context)
+ act-ids)))
+
+;; API for uim developers
(define context-update-widgets
(lambda (context)
(let ((widgets (context-widgets context)))
Modified: branches/r5rs/scm/anthy.scm
===================================================================
--- branches/r5rs/scm/anthy.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/anthy.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -76,7 +76,7 @@
(lambda (ac) ;; action handler
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
- (anthy-context-set-kana-mode! ac anthy-type-hiragana)))
+ (anthy-context-change-kana-mode! ac anthy-type-hiragana)))
(register-action 'action_anthy_katakana
;; (indication-alist-indicator 'action_anthy_katakana
@@ -93,13 +93,8 @@
(lambda (ac)
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
+ (anthy-context-change-kana-mode! ac anthy-type-katakana)))
- (if (= anthy-input-rule-kana
- (anthy-context-input-rule ac))
- (rk-context-set-rule! (anthy-context-rkc ac)
- ja-kana-katakana-rule))
- (anthy-context-set-kana-mode! ac anthy-type-katakana)))
-
(register-action 'action_anthy_hankana
;; (indication-alist-indicator 'action_anthy_hankana
;; anthy-input-mode-indication-alist)
@@ -115,7 +110,7 @@
(lambda (ac)
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
- (anthy-context-set-kana-mode! ac anthy-type-hankana)))
+ (anthy-context-change-kana-mode! ac anthy-type-hankana)))
(register-action 'action_anthy_direct
;; (indication-alist-indicator 'action_anthy_direct
@@ -179,13 +174,8 @@
anthy-input-rule-kana))
(lambda (ac)
(anthy-prepare-activation ac)
- (rk-context-set-rule! (anthy-context-rkc ac)
- (if (= (anthy-context-kana-mode ac)
- anthy-type-katakana)
- ja-kana-katakana-rule
- ja-kana-hiragana-rule))
-
(anthy-context-set-input-rule! ac anthy-input-rule-kana)
+ (anthy-context-change-kana-mode! ac (anthy-context-kana-mode ac))
;;(define-key anthy-kana-toggle-key? "")
;;(define-key anthy-latin-key? generic-on-key?)
;;(define-key anthy-wide-latin-key? "")
@@ -277,8 +267,20 @@
(lambda (ac)
(let* ((kana (anthy-context-kana-mode ac))
(opposite-kana (multi-segment-opposite-kana kana)))
- (anthy-context-set-kana-mode! ac opposite-kana))))
+ (anthy-context-change-kana-mode! ac opposite-kana))))
+(define anthy-context-change-kana-mode!
+ (lambda (ac kana-mode)
+ (if (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana)
+ (rk-context-set-rule!
+ (anthy-context-rkc ac)
+ (cond
+ ((= kana-mode anthy-type-hiragana) ja-kana-hiragana-rule)
+ ((= kana-mode anthy-type-katakana) ja-kana-katakana-rule)
+ ((= kana-mode anthy-type-hankana) ja-kana-hankana-rule))))
+ (anthy-context-set-kana-mode! ac kana-mode)))
+
;; TODO: generarize as multi-segment procedure
;; side effect: none. rkc will not be altered
(define anthy-make-whole-string
@@ -444,7 +446,7 @@
(anthy-commit-raw ac))
((anthy-hankaku-kana-key? key key-state)
- (anthy-context-set-kana-mode! ac anthy-type-hankana))
+ (anthy-context-change-kana-mode! ac anthy-type-hankana))
((anthy-kana-toggle-key? key key-state)
(anthy-context-kana-toggle ac))
@@ -494,10 +496,14 @@
(anthy-context-set-transposing-type! ac anthy-type-hankana))
((anthy-transpose-as-latin-key? key key-state)
- (anthy-context-set-transposing-type! ac anthy-type-latin))
+ (if (not (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana))
+ (anthy-context-set-transposing-type! ac anthy-type-latin)))
((anthy-transpose-as-wide-latin-key? key key-state)
- (anthy-context-set-transposing-type! ac anthy-type-wide-latin))
+ (if (not (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana))
+ (anthy-context-set-transposing-type! ac anthy-type-wide-latin)))
(else
(begin
Modified: branches/r5rs/scm/canna.scm
===================================================================
--- branches/r5rs/scm/canna.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/canna.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -47,6 +47,9 @@
(define canna-prepare-activation
(lambda (cc)
+ (if (canna-context-state cc)
+ (let ((cc-id (canna-context-cc-id cc)))
+ (canna-lib-reset-conversion cc-id)))
(canna-flush cc)
(canna-update-preedit cc)))
@@ -65,7 +68,7 @@
(lambda (cc) ;; action handler
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-hiragana)))
(register-action 'action_canna_katakana
@@ -81,7 +84,7 @@
(lambda (cc)
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-katakana)))
(register-action 'action_canna_hankana
@@ -97,7 +100,7 @@
(lambda (cc)
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-hankana)))
(register-action 'action_canna_direct
@@ -154,9 +157,9 @@
canna-input-rule-kana))
(lambda (cc)
(canna-prepare-activation cc)
- (rk-context-set-rule! (canna-context-rkc cc)
- ja-kana-hiragana-rule)
- (canna-context-set-input-rule! cc canna-input-rule-kana)))
+ (canna-context-set-input-rule! cc canna-input-rule-kana)
+ (canna-context-change-kana-mode!
+ cc (canna-context-kana-mode cc))))
(register-action 'action_canna_azik
(lambda (cc)
@@ -240,8 +243,20 @@
(define (canna-context-kana-toggle cc)
(let* ((kana (canna-context-kana-mode cc))
(opposite-kana (canna-opposite-kana kana)))
- (canna-context-set-kana-mode! cc opposite-kana)))
+ (canna-context-change-kana-mode! cc opposite-kana)))
+(define canna-context-change-kana-mode!
+ (lambda (cc kana-mode)
+ (if (= (canna-context-input-rule cc)
+ canna-input-rule-kana)
+ (rk-context-set-rule!
+ (canna-context-rkc cc)
+ (cond
+ ((= kana-mode multi-segment-type-hiragana) ja-kana-hiragana-rule)
+ ((= kana-mode multi-segment-type-katakana) ja-kana-katakana-rule)
+ ((= kana-mode multi-segment-type-hankana) ja-kana-hankana-rule))))
+ (canna-context-set-kana-mode! cc kana-mode)))
+
(define (canna-flush cc)
(rk-flush (canna-context-rkc cc))
(canna-context-set-left-string! cc '())
@@ -340,7 +355,7 @@
(canna-commit-raw cc))
((canna-hankaku-kana-key? key key-state)
- (canna-context-set-kana-mode! cc multi-segment-type-hankana))
+ (canna-context-change-kana-mode! cc multi-segment-type-hankana))
((canna-kana-toggle-key? key key-state)
(canna-context-kana-toggle cc))
@@ -395,9 +410,11 @@
(canna-proc-input-state cc key key-state)))))))
(define (canna-proc-input-state-with-preedit cc key key-state)
- (let ((rkc (canna-context-rkc cc))
- (kana (canna-context-kana-mode cc))
- (rule (canna-context-input-rule cc)))
+ (let* ((rkc (canna-context-rkc cc))
+ (rule (canna-context-input-rule cc))
+ (kana (if (= rule canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-context-kana-mode cc))))
(cond
;; begin conversion
@@ -433,14 +450,17 @@
;; ¤Ò¤é¤¬¤Ê¥â¡¼¥É¤Ç¥«¥¿¥«¥Ê¤ò³ÎÄꤹ¤ë
((canna-commit-as-opposite-kana-key? key key-state)
- (begin
+ (let ((opposite-kana (if (= rule canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-opposite-kana kana))))
(im-commit
cc
(string-append
(multi-segment-make-left-string (canna-context-left-string cc)
- (canna-opposite-kana kana))
+ opposite-kana)
+ (rk-pending rkc)
(multi-segment-make-right-string (canna-context-right-string cc)
- (canna-opposite-kana kana))))
+ opposite-kana)))
(canna-flush cc)))
;; Transposing¾õÂ֤ذܹÔ
@@ -460,6 +480,7 @@
(string-append
(multi-segment-make-left-string (canna-context-left-string cc)
kana)
+ (rk-pending rkc)
(multi-segment-make-right-string (canna-context-right-string cc)
kana)))
(canna-flush cc)
@@ -622,7 +643,10 @@
(define (canna-input-state-preedit cc)
(let ((rkc (canna-context-rkc cc))
- (kana (canna-context-kana-mode cc)))
+ (kana (if (= (canna-context-input-rule cc)
+ canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-context-kana-mode cc))))
(im-clear-preedit cc)
(im-pushback-preedit
cc preedit-underline
Modified: branches/r5rs/scm/custom-rt.scm
===================================================================
--- branches/r5rs/scm/custom-rt.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/custom-rt.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -101,6 +101,7 @@
(lambda (gsym)
(try-load (custom-file-path gsym))))
+;; TODO: disable all newly defined customs when an error occurred in loading
;; full implementation
(define require-custom
(lambda (filename)
@@ -111,7 +112,8 @@
(cons filename custom-required-custom-files)))
(let* ((post-groups (custom-list-primary-groups))
(new-groups (list-tail post-groups (length pre-groups))))
- (if (not (getenv "LIBUIM_VANILLA"))
+ (if (and (not (getenv "LIBUIM_VANILLA"))
+ (not (is-set-ugid?)))
(for-each (lambda (gsym)
(custom-load-group-conf gsym)
(custom-update-group-conf-freshness gsym))
@@ -265,6 +267,7 @@
(define custom-reload-user-configs
(lambda ()
(and (not (getenv "LIBUIM_VANILLA"))
+ (not (is-set-ugid?))
(let ((load-conf (if custom-enable-mtime-aware-user-conf-reloading?
custom-load-updated-group-conf
custom-load-group-conf))) ;; original behavior
Modified: branches/r5rs/scm/custom.scm
===================================================================
--- branches/r5rs/scm/custom.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/custom.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -391,16 +391,12 @@
;; API
(define custom-group-label
(lambda (gsym)
- (if (custom-group-rec gsym)
- (custom-group-rec-label (custom-group-rec gsym))
- (string-append "Error: " gsym " not found."))))
+ (custom-group-rec-label (custom-group-rec gsym))))
;; API
(define custom-group-desc
(lambda (gsym)
- (if (custom-group-rec gsym)
- (custom-group-rec-desc (custom-group-rec gsym))
- (string-append "Error: " gsym " not found."))))
+ (custom-group-rec-desc (custom-group-rec gsym))))
;; API
(define custom-group-subgroups
@@ -503,6 +499,14 @@
(cdr groups)))
(modified-groups (cons primary-grp subgrps))
(crec (custom-rec-new sym default modified-groups type label desc)))
+ ;; See also require-custom for error handling TODO
+ (for-each (lambda (gsym)
+ (or (custom-group-rec gsym)
+ (error (string-append "undefined group '"
+ (symbol->string gsym)
+ "' is referred by "
+ (symbol->string sym)))))
+ modified-groups)
(set! custom-rec-alist (alist-replace crec custom-rec-alist))
(custom-call-hook-procs primary-grp custom-group-update-hooks)
(if (not (symbol-bound? sym))
Modified: branches/r5rs/scm/im-custom.scm
===================================================================
--- branches/r5rs/scm/im-custom.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/im-custom.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -280,6 +280,43 @@
(define-key switch-im-key? '())
+;; im-toggle
+(define-custom-group 'im-toggle
+ (_ "Input method toggle")
+ (_ "long description will be here."))
+
+(define-custom 'enable-im-toggle? #t
+ '(global im-toggle)
+ '(boolean)
+ (_ "Enable Input method toggle by hot keys")
+ (_ "long description will be here."))
+
+(define-custom 'toggle-im-key '("<Alt> " "<Meta> ")
+ '(global im-toggle)
+ '(key)
+ (_ "Input method toggle key")
+ (_ "long description will be here."))
+
+(define-custom 'toggle-im-alt-im 'direct
+ '(global im-toggle)
+ (cons
+ 'choice
+ (custom-im-list-as-choice-rec (reverse im-list)))
+ (_ "Alternative input method")
+ (_ "long description will be here."))
+
+;; activity dependency
+(custom-add-hook 'toggle-im-key
+ 'custom-activity-hooks
+ (lambda ()
+ enable-im-toggle?))
+
+(custom-add-hook 'toggle-im-alt-im
+ 'custom-activity-hooks
+ (lambda ()
+ enable-im-toggle?))
+
+
(define-custom 'uim-color 'uim-color-uim
'(global visual-preference)
(list 'choice
Modified: branches/r5rs/scm/im.scm
===================================================================
--- branches/r5rs/scm/im.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/im.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -197,6 +197,27 @@
(lambda (id name)
(uim-switch-im id (next-im name))))
+;; im-toggle
+(define toggle-im-preserved-im #f)
+(define toggle-im-preserved-widget-states '())
+(define toggle-im-alt-preserved-widget-states '())
+
+(define toggle-im
+ (lambda (id name)
+ (let ((widget-states (context-current-widget-states (find-context id))))
+ (if (eq? name toggle-im-alt-im)
+ (begin
+ (set! toggle-im-alt-preserved-widget-states widget-states)
+ (uim-switch-im id toggle-im-preserved-im)
+ (context-update-widget-states! (find-context id)
+ toggle-im-preserved-widget-states))
+ (begin
+ (set! toggle-im-preserved-im name)
+ (set! toggle-im-preserved-widget-states widget-states)
+ (uim-switch-im id toggle-im-alt-im)
+ (context-update-widget-states! (find-context id)
+ toggle-im-alt-preserved-widget-states))))))
+
;;
;; context-management
;;
@@ -269,6 +290,9 @@
(let* ((c (find-context id))
(im (and c (context-im c))))
(cond
+ ((and enable-im-toggle?
+ (toggle-im-key? key state))
+ (toggle-im id (im-name im)))
((and enable-im-switch
(switch-im-key? key state))
(switch-im id (im-name im)))
Modified: branches/r5rs/scm/prime-custom.scm
===================================================================
--- branches/r5rs/scm/prime-custom.scm 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/scm/prime-custom.scm 2005-11-03 05:10:43 UTC (rev 1951)
@@ -47,7 +47,7 @@
(_ "Japanese specific settings"))
(define-custom 'prime-custom-default-language 'Japanese
- '(prime global)
+ '(prime)
(list 'choice
(list 'Japanese (_ "Japanese") (_ "Japanese"))
(list 'English (_ "English") (_ "English")))
@@ -55,7 +55,7 @@
(_ "long description will be here."))
(define-custom 'prime-auto-register-mode? #t
- '(prime global)
+ '(prime)
'(boolean)
(_ "Enable auto register mode")
(_ "long description will be here."))
Modified: branches/r5rs/uim/skk.c
===================================================================
--- branches/r5rs/uim/skk.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/skk.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -1664,7 +1664,9 @@
if (/* string 's' is part of sl->head */
!strncmp(sl->head, s, strlen(s)) && strcmp(sl->head, s) &&
/* and sl is okuri-nasi line */
- (sl->okuri_head == '\0')) {
+ sl->okuri_head == '\0' &&
+ /* use commited entry only */
+ sl->need_save == 1) {
ca->nr_comps++;
ca->comps = realloc(ca->comps, sizeof(char *) * ca->nr_comps);
ca->comps[ca->nr_comps - 1] = strdup(sl->head);
Modified: branches/r5rs/uim/uim-custom.c
===================================================================
--- branches/r5rs/uim/uim-custom.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim-custom.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -872,7 +872,11 @@
uim_bool
uim_custom_load(void)
{
- return for_each_primary_groups(uim_custom_load_group);
+ if(uim_helper_is_setugid() ==UIM_FALSE) {
+ return for_each_primary_groups(uim_custom_load_group);
+ } else {
+ return UIM_FALSE;
+ }
}
#ifdef UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING
@@ -1000,7 +1004,11 @@
uim_bool
uim_custom_save(void)
{
- return for_each_primary_groups(uim_custom_save_group);
+ if(uim_helper_is_setugid() ==UIM_FALSE) {
+ return for_each_primary_groups(uim_custom_save_group);
+ } else {
+ return UIM_FALSE;
+ }
}
/**
Modified: branches/r5rs/uim/uim-func.c
===================================================================
--- branches/r5rs/uim/uim-func.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim-func.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -729,6 +729,9 @@
const char *name= uim_scm_refer_c_str(name_);
uim_context uc = uim_find_context(uim_scm_c_int(id_));
uim_switch_im(uc, name);
+ if (uc->configuration_changed_cb)
+ uc->configuration_changed_cb(uc->ptr);
+
return uim_scm_t();
}
Modified: branches/r5rs/uim/uim-helper.c
===================================================================
--- branches/r5rs/uim/uim-helper.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim-helper.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -210,6 +210,17 @@
return NULL;
}
+/* Interface function for is_setugid. */
+uim_bool
+uim_helper_is_setugid(void)
+{
+ if(is_setugid() != 0) {
+ return UIM_TRUE;
+ } else {
+ return UIM_FALSE;
+ }
+}
+
int
is_setugid(void)
{
Modified: branches/r5rs/uim/uim-helper.h
===================================================================
--- branches/r5rs/uim/uim-helper.h 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim-helper.h 2005-11-03 05:10:43 UTC (rev 1951)
@@ -59,6 +59,9 @@
void uim_helper_buffer_shift(char *buf, int count);
char *uim_helper_buffer_get_message(char *buf);
+uim_bool
+uim_helper_is_setugid(void);
+
#ifdef __cplusplus
}
#endif
Modified: branches/r5rs/uim/uim-internal.h
===================================================================
--- branches/r5rs/uim/uim-internal.h 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim-internal.h 2005-11-03 05:10:43 UTC (rev 1951)
@@ -114,6 +114,8 @@
/* surrounding text */
void (*request_surrounding_text_cb)(void *ptr);
int (*delete_surrounding_text_cb)(void *ptr, int offset, int len);
+ /* configuration changed */
+ void (*configuration_changed_cb)(void *ptr);
/* preedit segments array */
struct preedit_segment *psegs;
int nr_psegs;
@@ -137,21 +139,6 @@
#define UIM_EVAL_SEXP_AS_STRING
#endif
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
- #define UIM_DEFINE_MUTEX(mtx) \
- pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
- #define UIM_DEFINE_MUTEX_STATIC(mtx) \
- static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
- #define UIM_LOCK_MUTEX(mtx) pthread_mutex_lock(&mtx)
- #define UIM_UNLOCK_MUTEX(mtx) pthread_mutex_unlock(&mtx)
-#else
- #define UIM_DEFINE_MUTEX(mtx)
- #define UIM_DEFINE_MUTEX_STATIC(mtx)
- #define UIM_LOCK_MUTEX(mtx)
- #define UIM_UNLOCK_MUTEX(mtx)
-#endif /* HAVE_PTHREAD_H */
-
#ifdef ENABLE_NLS
#define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET() \
char *enc, *orig_encoding = NULL; \
@@ -187,38 +174,6 @@
UIM_RESTORE_TEXTDOMAIN_CODESET(); \
}
-#ifdef HAVE_PTHREAD_H
-
- extern pthread_mutex_t mtx_uim_evaling;
-
- #define UIM_EVAL_FSTRING1_WITH_MUTEX(uc, sexp_tmpl, arg1) \
- UIM_LOCK_MUTEX(mtx_uim_evaling); \
- UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1); \
- UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
- #define UIM_EVAL_FSTRING2_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2) \
- UIM_LOCK_MUTEX(mtx_uim_evaling); \
- UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2); \
- UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
- #define UIM_EVAL_FSTRING3_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2, arg3) \
- UIM_LOCK_MUTEX(mtx_uim_evaling); \
- UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3); \
- UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
-#else
-
- #define UIM_EVAL_FSTRING1_WITH_MUTEX(uc, sexp_tmpl, arg1) \
- UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1);
-
- #define UIM_EVAL_FSTRING2_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2) \
- UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2);
-
- #define UIM_EVAL_FSTRING3_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2, arg3) \
- UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3);
-
-#endif /* HAVE_PTHREAD_H */
-
#define UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1) \
{ \
int form_size; \
Modified: branches/r5rs/uim/uim.c
===================================================================
--- branches/r5rs/uim/uim.c 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim.c 2005-11-03 05:10:43 UTC (rev 1951)
@@ -60,12 +60,7 @@
struct uim_im *uim_im_array;
int uim_nr_im;
static int uim_initialized;
-static int uim_quiting;
-/* Definition of mutex */
-UIM_DEFINE_MUTEX_STATIC(mtx_initing_or_quiting);
-UIM_DEFINE_MUTEX_STATIC(mtx_context_array);
-
void
uim_set_preedit_cb(uim_context uc,
void (*clear_cb)(void *ptr),
@@ -83,25 +78,20 @@
get_context_id(uim_context uc)
{
int i;
- UIM_LOCK_MUTEX(mtx_context_array);
for (i = 0; i < CONTEXT_ARRAY_SIZE; i++) {
if (!context_array[i]) {
context_array[i] = uc;
uc->id = i;
- UIM_UNLOCK_MUTEX(mtx_context_array);
return;
}
}
uc->id = -1;
- UIM_UNLOCK_MUTEX(mtx_context_array);
}
static void
put_context_id(uim_context uc)
{
- UIM_LOCK_MUTEX(mtx_context_array);
context_array[uc->id] = NULL;
- UIM_UNLOCK_MUTEX(mtx_context_array);
}
uim_context
@@ -172,6 +162,8 @@
uc->request_surrounding_text_cb = NULL;
uc->delete_surrounding_text_cb = NULL;
/**/
+ uc->configuration_changed_cb = NULL;
+ /**/
uc->nr_candidates = 0;
uc->candidate_index = 0;
/**/
@@ -226,6 +218,13 @@
}
void
+uim_set_configuration_changed_cb(uim_context uc,
+ void (*changed_cb)(void *ptr))
+{
+ uc->configuration_changed_cb = changed_cb;
+}
+
+void
uim_switch_im(uim_context uc, const char *engine)
{
/* related to the commit log of r1400:
@@ -293,9 +292,7 @@
uim_find_context(int id)
{
uim_context uc;
- UIM_LOCK_MUTEX(mtx_context_array);
uc = context_array[id];
- UIM_UNLOCK_MUTEX(mtx_context_array);
return uc;
}
@@ -699,19 +696,15 @@
int
uim_init(void)
{
- UIM_LOCK_MUTEX(mtx_initing_or_quiting);
-
- if (uim_initialized) {
- UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
+ if (uim_initialized)
return 0;
- }
+
uim_last_client_encoding = NULL;
uim_im_array = NULL;
uim_nr_im = 0;
uim_init_scm();
uim_initialized = 1;
- UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
return 0;
}
@@ -720,14 +713,8 @@
{
int i;
- UIM_LOCK_MUTEX(mtx_initing_or_quiting);
-
- if (!uim_initialized || uim_quiting) {
- UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
+ if (!uim_initialized)
return;
- }
- /* Some multithreaded applications calls uim_quit bursty. */
- uim_quiting = 1;
/* release still active contexts */
for (i = 0; i < CONTEXT_ARRAY_SIZE; i++) {
@@ -741,6 +728,4 @@
free(uim_last_client_encoding);
uim_last_client_encoding = NULL;
uim_initialized = 0;
- uim_quiting = 0;
- UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
}
Modified: branches/r5rs/uim/uim.h
===================================================================
--- branches/r5rs/uim/uim.h 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/uim/uim.h 2005-11-03 05:10:43 UTC (rev 1951)
@@ -567,6 +567,17 @@
uim_set_surrounding_text(uim_context uc, const char *text,
int cursor_pos, int len);
+/*
+ * Set callback function to be called when configuration of input
+ * context is changed.
+ *
+ * @param uc input context
+ * @param changed_cb called when configuration of the input context is changed.
+ * 1st argument "ptr" corresponds to the 1st argument of uim_create_context.
+ */
+void
+uim_set_configuration_changed_cb(uim_context uc,
+ void (*changed_cb)(void *ptr));
/* Utility functions */
int
Modified: branches/r5rs/xim/canddisp.cpp
===================================================================
--- branches/r5rs/xim/canddisp.cpp 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/canddisp.cpp 2005-11-03 05:10:43 UTC (rev 1951)
@@ -30,13 +30,12 @@
SUCH DAMAGE.
*/
+#define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
Modified: branches/r5rs/xim/helper.cpp
===================================================================
--- branches/r5rs/xim/helper.cpp 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/helper.cpp 2005-11-03 05:10:43 UTC (rev 1951)
@@ -32,13 +32,12 @@
// uim-helper connection
+#define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Modified: branches/r5rs/xim/locale.cpp
===================================================================
--- branches/r5rs/xim/locale.cpp 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/locale.cpp 2005-11-03 05:10:43 UTC (rev 1951)
@@ -32,13 +32,12 @@
// Locale dependent routines
+#define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <locale.h>
#include <iconv.h>
Modified: branches/r5rs/xim/main.cpp
===================================================================
--- branches/r5rs/xim/main.cpp 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/main.cpp 2005-11-03 05:10:43 UTC (rev 1951)
@@ -32,14 +32,13 @@
// XIM Server supporting CJK languages
// initialize many modules
-//
+
+#define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <string.h>
#include <locale.h>
@@ -534,7 +533,7 @@
uim_quit();
clear_uim_info();
get_uim_info();
- print_uim_info();
+ //print_uim_info();
for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
XimServer *xs = it->second;
Modified: branches/r5rs/xim/util.h
===================================================================
--- branches/r5rs/xim/util.h 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/util.h 2005-11-03 05:10:43 UTC (rev 1951)
@@ -46,7 +46,7 @@
void hex_dump(unsigned char *buf, int len);
// misc replacement functions
-#ifndef HAV_ASPRINTF
+#ifndef HAVE_ASPRINTF
int asprintf(char **ptr, const char *format, ...);
#endif
Modified: branches/r5rs/xim/ximserver.cpp
===================================================================
--- branches/r5rs/xim/ximserver.cpp 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/ximserver.cpp 2005-11-03 05:10:43 UTC (rev 1951)
@@ -30,13 +30,12 @@
SUCH DAMAGE.
*/
+#define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
@@ -54,6 +53,7 @@
#include "helper.h"
#include "uim/uim-helper.h"
+#include "uim/uim-im-switcher.h"
#include "uim/uim-compat-scm.h"
#ifndef __GNUC__
@@ -408,6 +408,7 @@
InputContext::update_prop_list_cb);
uim_set_prop_label_update_cb(uc,
InputContext::update_prop_label_cb);
+ uim_set_configuration_changed_cb(uc, InputContext::configuration_changed_cb);
if (mFocusedContext == this)
uim_prop_list_update(uc);
@@ -439,6 +440,45 @@
}
}
+void InputContext::configuration_changed()
+{
+ const char *engine = uim_get_current_im_name(mUc);
+
+ review_im(engine);
+}
+
+void InputContext::review_im(const char *engine)
+{
+ char *locale;
+ const char *client_locale, *engine_locales;
+ const char *encoding;
+
+ encoding = mXic->get_encoding();
+ client_locale = mXic->get_lang_region();
+ engine_locales = compose_localenames_from_im_lang(get_im_lang_from_engine(engine));
+
+ if (!strcmp(encoding, "UTF-8")) {
+ if (is_locale_included(engine_locales, client_locale))
+ locale = strdup(client_locale);
+ else
+ locale = get_prefered_locale(engine_locales);
+ locale = (char *)realloc(locale, strlen(locale) + strlen(".UTF-8") + 1);
+ strcat(locale, ".UTF-8");
+ setlocale(LC_CTYPE, locale);
+ free(mLocaleName);
+ mLocaleName = locale;
+ free(mEngineName);
+ mEngineName = strdup(engine);
+ } else {
+ if (!is_locale_included(engine_locales, client_locale))
+ changeContext(mEngineName);
+ else {
+ free(mEngineName);
+ mEngineName = strdup(engine);
+ }
+ }
+}
+
void
InputContext::customContext(const char *custom, const char *val)
{
@@ -570,6 +610,13 @@
ic->update_prop_label(str);
}
+void InputContext::configuration_changed_cb(void *ptr)
+{
+ InputContext *ic = (InputContext *)ptr;
+
+ ic->configuration_changed();
+}
+
void InputContext::clear_pe_stat()
{
m_pe->clear();
Modified: branches/r5rs/xim/ximserver.h
===================================================================
--- branches/r5rs/xim/ximserver.h 2005-11-03 03:43:55 UTC (rev 1950)
+++ branches/r5rs/xim/ximserver.h 2005-11-03 05:10:43 UTC (rev 1951)
@@ -181,22 +181,25 @@
void changeContext(const char *engine);
void customContext(const char *custom, const char *val);
void createUimContext(const char *engine);
+ void configuration_changed();
public:
- static void commit_cb(void *, const char *);
- static void clear_cb(void *);
- static void pushback_cb(void *, int attr, const char *str);
- static void update_cb(void *);
+ static void commit_cb(void *ptr, const char *str);
+ static void clear_cb(void *ptr);
+ static void pushback_cb(void *ptr, int attr, const char *str);
+ static void update_cb(void *ptr);
static void candidate_activate_cb(void *ptr, int nr, int index);
static void candidate_select_cb(void *ptr, int index);
static void candidate_shift_page_cb(void *ptr, int direction);
static void candidate_deactivate_cb(void *ptr);
static void update_prop_list_cb(void *ptr, const char *str);
static void update_prop_label_cb(void *ptr, const char *str);
+ static void configuration_changed_cb(void *ptr);
static InputContext *focusedContext();
static void deletefocusedContext();
private:
void commit_string(char *);
void clear_pe_stat();
+ void review_im(const char *engine);
XimIC *mXic;
XimServer *mServer;
More information about the uim-commit
mailing list