[uim-commit] r2987 - in branches/r5rs: . doc gtk helper po qt scm test uim xim

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 23 09:38:48 PST 2006


Author: yamaken
Date: 2006-01-23 09:38:44 -0800 (Mon, 23 Jan 2006)
New Revision: 2987

Added:
   branches/r5rs/gtk/key-util-gtk.c
   branches/r5rs/gtk/key-util-gtk.h
   branches/r5rs/helper/candwin-gtk.c
Removed:
   branches/r5rs/helper/helper-candwin-gtk.c
Modified:
   branches/r5rs/
   branches/r5rs/doc/COMPATIBILITY
   branches/r5rs/gtk/Makefile.am
   branches/r5rs/gtk/gtk-im-uim.c
   branches/r5rs/helper/Makefile.am
   branches/r5rs/helper/im-switcher-gtk.c
   branches/r5rs/helper/pref-gtk-custom-widgets.c
   branches/r5rs/helper/pref-gtk-custom-widgets.h
   branches/r5rs/helper/pref-gtk.c
   branches/r5rs/po/fr.po
   branches/r5rs/po/ja.po
   branches/r5rs/po/ko.po
   branches/r5rs/po/uim.pot
   branches/r5rs/qt/pref-customwidgets.cpp
   branches/r5rs/qt/qtgettext.h
   branches/r5rs/scm/byeoru.scm
   branches/r5rs/scm/custom-rt.scm
   branches/r5rs/scm/custom.scm
   branches/r5rs/scm/im-custom.scm
   branches/r5rs/scm/init.scm
   branches/r5rs/scm/plugin.scm
   branches/r5rs/scm/skk-custom.scm
   branches/r5rs/scm/skk.scm
   branches/r5rs/test/test-custom.scm
   branches/r5rs/uim/libtool-version.mk
   branches/r5rs/uim/prime.c
   branches/r5rs/uim/uim-custom.c
   branches/r5rs/uim/uim-custom.h
   branches/r5rs/uim/uim-helper.c
   branches/r5rs/uim/uim-internal.h
   branches/r5rs/uim/uim-ipc.c
   branches/r5rs/uim/uim-util.c
   branches/r5rs/uim/uim-util.h
   branches/r5rs/uim/uim.c
   branches/r5rs/uim/uim.h
   branches/r5rs/xim/canddisp.cpp
   branches/r5rs/xim/connection.cpp
   branches/r5rs/xim/convdisp.cpp
   branches/r5rs/xim/helper.cpp
   branches/r5rs/xim/locale.cpp
   branches/r5rs/xim/main.cpp
   branches/r5rs/xim/util.cpp
   branches/r5rs/xim/ximic.cpp
   branches/r5rs/xim/ximim.cpp
   branches/r5rs/xim/ximpacket.cpp
   branches/r5rs/xim/ximserver.cpp
   branches/r5rs/xim/ximserver.h
   branches/r5rs/xim/ximtrans.cpp
Log:
 r1439 at deepblue (orig r2937):  ekato | 2006-01-18 11:27:17 +0900
 * po/ja.po : Update translation by Daichi Kawahata (bug #5638).
 
 r1440 at deepblue (orig r2938):  ekato | 2006-01-19 00:38:52 +0900
 * gtk/gtk-im-uim.c : Include "key-util-gtk.h" for converting gdk's
   key to uim's key.
 (convert_keyval) : Removed.
 (convert_modifier) : Ditto.
 (filter_keypress) : Use im_uim_convert_keyevent() instead of
   convert_keyval() and convert_modifier().
 (uim_key_snoop) : Ditto.
 (im_module_init) : Initialize modifier mappings with
   im_uim_init_modifier_keys().
 * gtk/key-util-gtk.c : New file.
 (im_uim_convert_keyevent) : New.  Reorganized from
   convert_keyval() and convert_modifier() in gtk-im-uim.c.  If
   compiled with gdk-x11, it treats MOD[1-5] modifier keys
   according to X11's keysym.
 (check_modifier) : Utility for converting X keysym to uim's
   modifier key.
 (im_uim_init_modifier_keys) : New.  Initialize modifier mappings
   if compiled with gdk-x11.
 * gtk/key-util-gtk.h : New file.
 * gtk/Makefile.am : Add key-util-gtk.c and key-util-gtk.h into
   IM_UIM_SOURCES.
 
 * helper/pref-gtk.c : Include "key-util-gtk.h" for using
   im_uim_init_modifier_keys().
 (main) : Initialize modifier key mappings.
 * helper/pref-gtk-custom-widgets.c : Include "key-util-gtk.h" for
   converting gdk's key to uim's key.
 (KeyPrefWin) : Change types of grabbed_key_val and
   grabbed_key_state from guint to gint.
 (key_pref_set_value) : Change argument as uim's key value and
   modifier value instead of gdk's values, and handle "Meta",
   "Super", and "Hyper" modifiers.
 (grab_win_key_press_cb) : Convert gdk's key into uim's key and
   put these values into key_pref_win.grabbed_key_{val,state}.
 (grab_win_key_release_cb) : Call im_uim_convert_keyevent() on
   key release event.
 (key_choose_entry_key_press_cb) : Convert gdk's key to uim's
   before key_pref_set_value().
 (key_choose_entry_key_release_cb) : New.  Call
   im_uim_convert_keyevent() on key release.
 (choose_key_clicked_cb) : Connect key release event of key_entry.
 * helper/Makefile.am : Add gtk/key-util-gtk.{c,h} into
   uim_pref_gtk_SOURCES.
 
 r1441 at deepblue (orig r2939):  ekato | 2006-01-19 00:42:08 +0900
 * helper/pref-gtk.c (create_pref_window) : Suppress warning.
 
 r1442 at deepblue (orig r2940):  ekato | 2006-01-19 01:16:15 +0900
 * xim/ximserver.cpp : Simplify mod key handling.
 (gShiftMask) : Removed.
 (gLockMask) : Ditto.
 (gControlMask) : Ditto.
 (keyState::keyState) : Follow the changes in member variables.
 (keyState::check_key) : Simplify.
 (keyState::revise_mod) : Removed.
 (keyState::reset) : Follow the change in member variables.
 (check_modifier) : Don't handle shift and control keys.
 (init_modifier_keys) : Ditto.
 * xim/ximserver.h (class keyState) : Remove revise_mod(), mAltOn,
   mMetaOn, mHyperOn, mSuperOn members.  Add mModState and
   mPreModState members.
 
 r1443 at deepblue (orig r2941):  ekato | 2006-01-19 20:00:58 +0900
 * gtk/key-util-gtk.c (im_uim_init_modifier_keys) : Plug leak.
 
 r1444 at deepblue (orig r2942):  ekato | 2006-01-20 03:51:01 +0900
 * helper/im-switcher-gtk.c (create_switcher) : Set default focus
   to tree view.
 (reload_im_list) : Change return type of the function, and return
   FALSE to enable IM selection by cursor key.
 
 r1445 at deepblue (orig r2943):  ekato | 2006-01-20 16:49:07 +0900
 * helper/helper-candwin-gtk.c : Rename to candwin-gtk.c.
 * helper/candwin-gtk.c : Renamed from helper-candwin-gtk.c.
 * helper/Makefile.am : Follow the rename.  Remove obsolete
   install hooks.
 
 r1446 at deepblue (orig r2944):  ekato | 2006-01-20 16:59:29 +0900
 * helper/candwin-gtk.c : Fix comment.
 (tree_selection_changed) : Check cwin pointer as intended.
 
 r1447 at deepblue (orig r2945):  ekato | 2006-01-21 00:09:07 +0900
 * xim/canddisp.cpp      
 * xim/connection.cpp
 * xim/convdisp.cpp      
 * xim/helper.cpp        
 * xim/locale.cpp
 * xim/main.cpp  
 * xim/util.cpp  
 * xim/ximtrans.cpp
 * xim/ximic.cpp
 * xim/ximim.cpp
 * xim/ximpacket.cpp     
 * xim/ximserver.cpp
   - Cosmetic changes, suppress compilation time warnings of unused
     parameters, and some optimizations about STL containers.
 
 r1448 at deepblue (orig r2946):  yamaken | 2006-01-21 02:58:51 +0900
 * This commit change the custom API as said in bug
   #5666. Corresponding Scheme part is not changed yet.
 
 * uim/uim-custom.h
   - (enum UCustomPathnameType, struct uim_custom_pathname): New type
   - (union uim_custom_value): Change type of as_pathname to struct
     uim_custom_pathname *
 * uim/uim-custom.c
   - (uim_custom_pathname_get, uim_custom_pathname_new,
     uim_custom_pathname_free): New static function
   - (uim_custom_value_internal, uim_custom_value_free,
     uim_custom_set): Follow the changes
 
 r1449 at deepblue (orig r2947):  yamaken | 2006-01-21 03:24:54 +0900
 * This commit complement the rest part for bug #5666. Test
   modification and doc/COMPATIBILITY update follows
 
 * scm/custom.scm
   - (custom-pathname?): Add check for pathname-type attr
   - (custom-pathname-type): New procedure
 * scm/im-custom.scm
   - (custom eb-dic-path): Follow the change of pathname type
 * scm/skk-custom.scm
   - (custom skk-dic-file-name, custom skk-personal-dic-filename,
     custom skk-uim-personal-dic-filename): Ditto
 * uim/uim-custom.c
   - (uim_custom_pathname_get): Support the pathname type
 
 r1450 at deepblue (orig r2948):  yamaken | 2006-01-21 04:14:20 +0900
 * uim/libtool-version.mk
   - (libuim_version, libuim_custom_version): Update for uim 1.1.0
 
 r1451 at deepblue (orig r2949):  yamaken | 2006-01-21 04:14:51 +0900
 * doc/COMPATIBILITY
   - Add section "File type information of pathname custom type"
 
 r1452 at deepblue (orig r2950):  yamaken | 2006-01-21 05:29:21 +0900
 * scm/custom.scm
   - (custom-pathname?, custom-range): Fix broken pathname handling
 * test/test-custom.scm
   - All tests are passed
   - Update pathname tests
   - (testcase custom custom-pathname): New testcase
   - (test custom-pathname-type): New test
 
 r1453 at deepblue (orig r2951):  yamaken | 2006-01-21 06:15:54 +0900
 * uim/uim.h
   - Revise the description about uim_bool to prevent misuses
 * gtk/gtk-im-uim.c
   - (im_uim_commit_string, update_prop_label_cb): Fix invalid boolean
     test expression for uim_bool. Although it is invalid, no problem
     will be occurred since the value is exactly UIM_TRUE or UIM_FALSE
     in this case
 * uim/prime.c
   - (use_unix_domain_socket): Change type to uim_bool
   - (prime_lib_init): Fix the invalid expression likewise
 * uim/uim-helper.c
   - (uim_helper_is_setugid): Simplify
 
 r1454 at deepblue (orig r2952):  yamaken | 2006-01-21 08:55:58 +0900
 * uim/uim-util.h
   - (is_setugid): Removed
 * uim/uim-internal.h
   - (uim_issetugid): New function decl
 * uim/uim-helper.c
   - (is_setugid): Rename to uim_issetugid
   - (uim_issetugid):
     * Renamed from is_setugid()
     * Change return type to uim_bool
     * Simplify
   - (uim_helper_get_pathname): Follow the renaming
 * uim/uim-ipc.c
   - (uim_ipc_open_command_with_option): Ditto
 * uim/uim-util.c
   - (is_setugidp): Ditto
 * uim/uim.c
   - (uim_init_scm): Ditto
 * doc/COMPATIBILITY
   - Add section "Hide unintentionally exposed is_setugid()"
 
 r1455 at deepblue (orig r2953):  yamaken | 2006-01-21 09:26:02 +0900
 * uim/uim-util.c
   - (is_setugidp, setugidp): Rename is_setugidp to setugidp
   - (uim_init_util_subrs):
     * Follow the function renaming
     * Rename Scheme procedure name is-set-ugid? to setugid?
 * scm/init.scm
   - (load-user-conf): Follow the renaming
 * scm/plugin.scm
   - (uim-plugin-lib-load-path, uim-plugin-scm-load-path,
     load-module-conf, load-enabled-modules): Ditto
 * scm/skk.scm
   - (skk-read-personal-dictionary, skk-save-personal-dictionary):
     Ditto
 * scm/custom-rt.scm
   - (require-custom, custom-reload-user-configs): Ditto
 * doc/COMPATIBILITY
   - Add new section "Rename is-set-ugid? to follow the Scheme naming
     convention"
 
 r1458 at deepblue (orig r2956):  ekato | 2006-01-21 11:57:49 +0900
 * helper/pref-gtk-custom-widgets.h : Create UimPrefFileEntry
   custom widget, which has GtkEntry and filetype attribute.
 * helper/pref-gtk-custom-widgets.c : Follow the changes in
   uim-custom's pathname structure.
 (uimpref_file_entry_get_type) : New for UimPrefFileEntry widget.
 (uimpref_file_entry_class_init) : Ditto.
 (uimpref_file_entry_init) : Ditto.
 (uimpref_file_entry_new) : Ditto.
 (custom_entry_changed_cb) : Follow the change in custom pathname
   structure.
 (sync_value_string) : Ditto.
 (custom_pathname_button_clicked_cb) : Ditto.  Now distinguish
   regular file and directory when opening a dialog.
 (add_custom_type_pathname) : Create UimPrefFileEntry instead of
   GtkEntry.
 (uim_pref_gtk_set_default_value) : Follow the change in custom
   pathname structure.
 
 r1459 at deepblue (orig r2957):  ekato | 2006-01-21 12:12:37 +0900
 * qt/pref-customwidgets.cpp (CustomPathnameEdit::update) : Follow
   the change in uim-custom's pathname structure.
 (CustomPathnameEdit::setDefault) : Ditto.
 (CustomPathnameEdit::slotCustomTextChanged) : Ditto.
 
 r1460 at deepblue (orig r2958):  ekato | 2006-01-21 12:43:10 +0900
 * qt/pref-customwidgets.cpp
 (CustomPathnameEdit::CustomPathnameEdit) : Set button label as
   intended.
 (CustomPathnameEdit::slotPathnameButtonClicked) : Use appropriate
   dialog corresponding to the type of pathname.
 
 r1462 at deepblue (orig r2960):  ekato | 2006-01-21 13:21:05 +0900
 * helper/pref-gtk-custom-widgets.c (add_custom_type_pathname) :
   Set button label appropriately.
 
 r1464 at deepblue (orig r2962):  yamaken | 2006-01-21 16:15:50 +0900
 * qt/qtgettext.h
   - (mygettext): New macro copied from _()
   - (_): Simplify with mygettext()
   - (N_): Stop converting to QString to be similar to original N_()
 * qt/pref-customwidgets.cpp
   - (CustomPathnameEdit::CustomPathnameEdit):
     * Fix runtime translation and xgettext handling
     * Change button labels
     * Describe the reason for labels
 * helper/pref-gtk-custom-widgets.c
   - (add_custom_type_pathname): Ditto
 
 r1465 at deepblue (orig r2963):  jhpark | 2006-01-22 17:56:26 +0900
 * scm/byeoru.scm
   - Moved shift key check routine from (byeoru-feed-hangul-key)
     to (byeoru-key-to-candidates).  This enables input of key
     combinations such as Ctrl-Shift-T and Alt-Shift-< in Hangul mode.
 
 r1466 at deepblue (orig r2964):  ekato | 2006-01-22 19:13:07 +0900
 * xim/locale.cpp
 * xim/helper.cpp
 * xim/main.cpp
 * xim/canddisp.cpp
   - Enclose #define _GNU_SOURCE.
 
 r1487 at deepblue (orig r2985):  yamaken | 2006-01-24 02:19:50 +0900
 * scm/byeoru.scm
   - (byeoru-graphic-key?): New procedure
   - (byeoru-key-to-candidates, byeoru-feed-romaja-key): Simplify with
     byeoru-graphic-key?
   - Please reform this with your intention, Jae-hyeon
 
 r1488 at deepblue (orig r2986):  yamaken | 2006-01-24 02:29:07 +0900
 * po/uim.pot
 * po/ja.po
 * po/ko.po
 * po/fr.po
   - Update
 



Property changes on: branches/r5rs
___________________________________________________________________
Name: svk:merge
   - 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:2176
74100eb5-a104-0410-9326-fdab01523867:/branches/r5rs:267
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:2853
   + 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:2176
74100eb5-a104-0410-9326-fdab01523867:/branches/r5rs:267
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:2986

Modified: branches/r5rs/doc/COMPATIBILITY
===================================================================
--- branches/r5rs/doc/COMPATIBILITY	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/doc/COMPATIBILITY	2006-01-23 17:38:44 UTC (rev 2987)
@@ -57,6 +57,79 @@
 
 The changes are described below in most recently updated order.
 ------------------------------------------------------------------------------
+Summary: Rename is-set-ugid? to follow the Scheme naming convention
+Affects: IM developers, uim developers
+Updates: Scheme API
+Version: 1.1.0
+Revision: ac2953
+Date: 2006-01-21
+Modifier: YamaKen
+Related:
+URL:
+Changes:
+ (removed) is-set-ugid?
+     (new) setugid?
+Description:
+  Ordinary Scheme predicate does not have 'is' prefix. And to indicate
+  its function similarity to the issetugid(3), the '_' separator
+  should be removed.
+------------------------------------------------------------------------------
+Summary: Hide unintentionally exposed is_setugid()
+Affects: uim developers
+Updates: C API
+Version: 1.1.0
+Revision: ac2952
+Date: 2006-01-21
+Modifier: YamaKen
+Related:
+URL:
+  http://lists.sourceforge.jp/mailman/archives/anthy-dev/2006-January/002799.html (Japanese)
+Changes:
+ (removed) is_setugid
+Description:
+  is_setugid() was supposed to be an internal function, but was
+  exposed as global symbol in libuim unintentionally. The libtool
+  option -export-symbols-regex was expected to hide the symbol, but
+  did not.
+
+  And it was inappropriately listed in the public header file
+  uim-util.h. So the function has been hidden as internal function,
+  and prefixed with 'uim_' to avoid symbol conflict.
+
+  Although this is an API/ABI change, the libtool version is not
+  changed since it was virtually an internal function. The change does
+  not affect the compatibility.
+------------------------------------------------------------------------------
+Summary: File type information of pathname custom type
+Affects: IM developers, Helper program developers
+Updates: Scheme API, C API (uim-custom)
+Version: 1.1.0
+Revision: ac2946, ac2947, ac2948
+Date: 2006-01-21
+Modifier: YamaKen
+Related: bug #5666
+URL:
+  http://lists.freedesktop.org/archives/uim-commit/2005-December/002457.html
+Changes:
+ (affected) define-custom
+   (update) custom-pathname?
+      (new) custom-pathname-type
+   (update) struct uim_custom_value
+      (new) struct uim_custom_pathname
+      (new) enum UCustomPathnameType
+Description:
+  To enable appropriate GUI widget handling, 'pathname' custom
+  variable should provide the information whether the path is regular
+  file or directory.
+
+  Valid form for the pathname type on define-custom has been
+  changed. 4th argument for it must contain the type information. See
+  the real example of skk-custom.scm and im-custom.scm.
+
+  And since the changes break the uim-custom API, all programs using
+  libuim-custom must follow it. Although it broke uim-custom API, the
+  uim API and ABI (libuim) is not changed.
+------------------------------------------------------------------------------
 Summary: Update helper protocol about commit_string.
 Affects: Bridge developers, Helper program developers
 Updates: Helper protocol

Modified: branches/r5rs/gtk/Makefile.am
===================================================================
--- branches/r5rs/gtk/Makefile.am	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/gtk/Makefile.am	2006-01-23 17:38:44 UTC (rev 2987)
@@ -16,7 +16,7 @@
 
 
 IM_UIM_SOURCES = \
-	gtk-im-uim.c \
+	gtk-im-uim.c key-util-gtk.c key-util-gtk.h \
 	uim-cand-win-gtk.c uim-cand-win-gtk.h \
 	caret-state-indicator.c caret-state-indicator.h
 

Modified: branches/r5rs/gtk/gtk-im-uim.c
===================================================================
--- branches/r5rs/gtk/gtk-im-uim.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/gtk/gtk-im-uim.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -52,8 +52,10 @@
 #include "uim/uim-im-switcher.h"
 #include "uim/gettext.h"
 #include "uim/uim-compat-scm.h"
+
 #include "uim-cand-win-gtk.h"
 #include "caret-state-indicator.h"
+#include "key-util-gtk.h"
 
 /* exported symbols */
 GtkIMContext *im_module_create(const gchar *context_id);
@@ -163,7 +165,7 @@
   g_signal_emit_by_name(uic, "commit", str);
 
   show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
-  if (show_state == UIM_TRUE) {
+  if (show_state) {
     gdk_window_get_origin(uic->win, &x, &y);
     caret_state_indicator_update(uic->caret_state_indicator, x, y, NULL);
   }
@@ -232,78 +234,6 @@
   uic->prev_preedit_len = preedit_len;
 }
 
-static int
-convert_keyval(int key)
-{
-  switch (key) {
-  case GDK_BackSpace: return UKey_Backspace;
-  case GDK_Delete: return UKey_Delete;
-  case GDK_Escape: return UKey_Escape;
-  case GDK_Tab: return UKey_Tab;
-  case GDK_Return: return UKey_Return;
-  case GDK_Left: return UKey_Left;
-  case GDK_Up: return UKey_Up;
-  case GDK_Right: return UKey_Right;
-  case GDK_Down: return UKey_Down;
-  case GDK_Prior: return UKey_Prior;
-  case GDK_Next: return UKey_Next;
-  case GDK_Home: return UKey_Home;
-  case GDK_End: return UKey_End;
-  case GDK_Kanji:
-  case GDK_Zenkaku_Hankaku: return UKey_Zenkaku_Hankaku;
-  case GDK_Multi_key: return UKey_Multi_key;
-  case GDK_Mode_switch: return UKey_Mode_switch;
-  case GDK_Henkan_Mode: return UKey_Henkan_Mode;
-  case GDK_Muhenkan: return UKey_Muhenkan;
-  case GDK_Shift_L: return UKey_Shift_key;
-  case GDK_Shift_R: return UKey_Shift_key;
-  case GDK_Control_L: return UKey_Control_key;
-  case GDK_Control_R: return UKey_Control_key;
-  case GDK_Alt_L: return UKey_Alt_key;
-  case GDK_Alt_R: return UKey_Alt_key;
-  case GDK_Meta_L: return UKey_Meta_key;
-  case GDK_Meta_R: return UKey_Meta_key;
-  case GDK_Super_L: return UKey_Super_key;
-  case GDK_Super_R: return UKey_Super_key;
-  case GDK_Hyper_L: return UKey_Hyper_key;
-  case GDK_Hyper_R: return UKey_Hyper_key;
-  }
-
-  if (key >= GDK_F1 && key <= GDK_F35)
-    return key - GDK_F1 + UKey_F1;
-
-  if (key >= GDK_KP_0 && key <= GDK_KP_9)
-    return key - GDK_KP_0 + UKey_0;
-
-  if (key < 256)
-    return key;
-
-  return UKey_Other;
-}
-
-static int
-convert_modifier(int mod)
-{
-  int rv = 0;
-
-  if (mod & GDK_SHIFT_MASK)
-    rv |= UMod_Shift;
-
-  if (mod & GDK_CONTROL_MASK)
-    rv |= UMod_Control;
-
-  if (mod & GDK_MOD1_MASK)
-    rv |= UMod_Alt;
-
-  if (mod & GDK_MOD3_MASK)  /* assuming mod3 */
-    rv |= UMod_Super;
-
-  if (mod & GDK_MOD4_MASK)  /* assuming mod4 */
-    rv |= UMod_Hyper;
-
-  return rv;
-}
-
 /*
  * KEY EVENT HANDLER
  */
@@ -314,10 +244,10 @@
 
   /* Hack for combination of xchat + GTK+ 2.6 */
   if (snooper_installed == FALSE) {
-    int rv;
-    int kv = convert_keyval(key->keyval);
-    int mod = convert_modifier(key->state);
+    int rv, kv, mod;
 
+    im_uim_convert_keyevent(key, &kv, &mod);
+
     if (key->type == GDK_KEY_RELEASE)
       rv = uim_release_key(uic->uc, kv, mod);
     else
@@ -781,7 +711,7 @@
   g_string_free(prop_label, TRUE);
 
   show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
-  if (show_state == UIM_TRUE && uic->win) {
+  if (show_state && uic->win) {
     gint timeout;
 
     gdk_window_get_origin(uic->win, &x, &y);
@@ -1145,10 +1075,10 @@
 uim_key_snoop(GtkWidget *grab_widget, GdkEventKey *key, gpointer data)
 {
   if (focused_context) {
-    int rv;
-    int kv = convert_keyval(key->keyval);
-    int mod = convert_modifier(key->state);
+    int rv, kv, mod;
 
+    im_uim_convert_keyevent(key, &kv, &mod);
+
     if (key->type == GDK_KEY_RELEASE)
       rv = uim_release_key(focused_context->uc, kv, mod);
     else
@@ -1177,6 +1107,8 @@
   /* XXX:This is not recommended way!! */
   snooper_id = gtk_key_snooper_install((GtkKeySnoopFunc)uim_key_snoop, NULL );
   snooper_installed = TRUE;
+
+  im_uim_init_modifier_keys();
 }
 
 void

Added: branches/r5rs/gtk/key-util-gtk.c
===================================================================
--- branches/r5rs/gtk/key-util-gtk.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/gtk/key-util-gtk.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -0,0 +1,355 @@
+/*
+
+  Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of authors nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+*/
+
+/*
+ * key conversion utility for uim-gtk
+ */
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
+
+#ifdef GDK_WINDOWING_X11
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+#endif
+
+#include "config.h"
+#include "uim/uim.h"
+
+#include "key-util-gtk.h"
+
+#ifdef GDK_WINDOWING_X11
+static guint g_mod1_mask, g_mod2_mask, g_mod3_mask, g_mod4_mask, g_mod5_mask;
+static gint g_numlock_mask;
+static guint g_modifier_state, g_pre_modifier_state;
+#endif
+
+void
+im_uim_convert_keyevent(GdkEventKey *event, int *ukey, int *umod)
+{
+  int keyval = event->keyval;
+  int mod = event->state;
+
+  *umod = 0;
+#ifdef GDK_WINDOWING_X11
+  if (event->type == GDK_KEY_PRESS) {
+    if (!mod || mod == GDK_LOCK_MASK ||
+	mod == g_numlock_mask)
+      g_modifier_state = 0;
+  }
+  g_pre_modifier_state = g_modifier_state; 
+#endif
+
+  /* 1. check key */
+  if (keyval >= GDK_F1 && keyval <= GDK_F35)
+    *ukey = keyval - GDK_F1 + UKey_F1;
+  else if (keyval >= GDK_KP_0 && keyval <= GDK_KP_9)
+    *ukey = keyval - GDK_KP_0 + UKey_0;
+  else if (keyval < 256)
+    *ukey = keyval;
+  else {
+    switch (keyval) {
+    case GDK_BackSpace:
+      *ukey = UKey_Backspace;
+      break;
+    case GDK_Delete:
+      *ukey = UKey_Delete;
+      break;
+    case GDK_Insert:
+      *ukey = UKey_Insert;
+      break;
+    case GDK_Escape:
+      *ukey = UKey_Escape;
+      break;
+    case GDK_Tab:
+    case GDK_ISO_Left_Tab:
+      *ukey = UKey_Tab;
+      break;
+    case GDK_Return:
+      *ukey = UKey_Return;
+      break;
+    case GDK_Left:
+      *ukey = UKey_Left;
+      break;
+    case GDK_Up:
+      *ukey = UKey_Up;
+      break;
+    case GDK_Right:
+      *ukey = UKey_Right;
+      break;
+    case GDK_Down:
+      *ukey = UKey_Down;
+      break;
+    case GDK_Prior:
+      *ukey = UKey_Prior;
+      break;
+    case GDK_Next:
+      *ukey = UKey_Next;
+      break;
+    case GDK_Home:
+      *ukey = UKey_Home;
+      break;
+    case GDK_End:
+      *ukey = UKey_End;
+      break;
+    case GDK_Kanji:
+    case GDK_Zenkaku_Hankaku:
+      *ukey = UKey_Zenkaku_Hankaku;
+      break;
+    case GDK_Multi_key:
+      *ukey = UKey_Multi_key;
+      break;
+    case GDK_Mode_switch:
+      *ukey = UKey_Mode_switch;
+      break;
+    case GDK_Henkan_Mode:
+      *ukey = UKey_Henkan_Mode;
+      break;
+    case GDK_Muhenkan:
+      *ukey = UKey_Muhenkan;
+      break;
+    case GDK_Shift_L:
+    case GDK_Shift_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Shift;
+      else
+	g_modifier_state &= ~UMod_Shift;
+#endif
+      *ukey = UKey_Shift_key;
+      break;
+    case GDK_Control_L:
+    case GDK_Control_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Control;
+      else
+	g_modifier_state &= ~UMod_Control;
+#endif
+      *ukey = UKey_Control_key;
+      break;
+    case GDK_Alt_L:
+    case GDK_Alt_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Alt;
+      else
+	g_modifier_state &= ~UMod_Alt;
+#endif
+      *ukey = UKey_Alt_key;
+      break;
+    case GDK_Meta_L:
+    case GDK_Meta_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Meta;
+      else
+	g_modifier_state &= ~UMod_Meta;
+#endif
+      *ukey = UKey_Meta_key;
+      break;
+    case GDK_Super_L:
+    case GDK_Super_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Super;
+      else
+	g_modifier_state &= ~UMod_Super;
+#endif
+      *ukey = UKey_Super_key;
+      break;
+    case GDK_Hyper_L:
+    case GDK_Hyper_R:
+#ifdef GDK_WINDOWING_X11
+      if (event->type == GDK_KEY_PRESS)
+	g_modifier_state |= UMod_Hyper;
+      else
+	g_modifier_state &= ~UMod_Hyper;
+#endif
+      *ukey = UKey_Hyper_key;
+      break;
+    default:
+      *ukey = UKey_Other;
+     break;
+    }
+  }
+
+  /* 2. check modifier */
+  if (mod & GDK_SHIFT_MASK)
+    *umod |= UMod_Shift;
+  if (mod & GDK_CONTROL_MASK)
+    *umod |= UMod_Control;
+#ifdef GDK_WINDOWING_X11
+  if (mod & GDK_MOD1_MASK)
+    *umod |= (g_mod1_mask & g_pre_modifier_state);
+  if (mod & GDK_MOD2_MASK)
+    *umod |= (g_mod2_mask & g_pre_modifier_state);
+  if (mod & GDK_MOD3_MASK)
+    *umod |= (g_mod3_mask & g_pre_modifier_state);
+  if (mod & GDK_MOD4_MASK)
+    *umod |= (g_mod4_mask & g_pre_modifier_state);
+  if (mod & GDK_MOD5_MASK)
+    *umod |= (g_mod5_mask & g_pre_modifier_state);
+#else
+  if (mod & GDK_MOD1_MASK)
+    *umod |= UMod_Alt;
+  if (mod & GDK_MOD3_MASK)  /* assuming mod3 */
+    *umod |= UMod_Super;
+  if (mod & GDK_MOD4_MASK)  /* assuming mod4 */
+    *umod |= UMod_Hyper;
+#endif
+}
+
+#ifdef GDK_WINDOWING_X11
+static int
+check_modifier(GSList *slist)
+{
+  int ret;
+  GSList *tmp_list;
+
+  ret = 0;
+  for (tmp_list = slist; tmp_list; tmp_list = tmp_list->next) {
+    switch (GPOINTER_TO_UINT(tmp_list->data)) {
+    case XK_Shift_L:
+    case XK_Shift_R:
+      ret |= UMod_Shift;
+      break;
+    case XK_Control_L:
+    case XK_Control_R:
+      ret |= UMod_Control;
+      break;
+    case XK_Meta_L:
+    case XK_Meta_R:
+      ret |= UMod_Meta;
+      break;
+    case XK_Alt_L:
+    case XK_Alt_R:
+      ret |= UMod_Alt;
+      break;
+    case XK_Super_L:
+    case XK_Super_R:
+      ret |= UMod_Super;
+      break;
+    case XK_Hyper_L:
+    case XK_Hyper_R:
+      ret |= UMod_Hyper;
+      break;
+    default:
+      break;
+    }
+  }
+  return ret;
+}
+#endif
+
+void
+im_uim_init_modifier_keys()
+{
+#ifdef GDK_WINDOWING_X11
+  int i, k = 0;
+  int min_keycode, max_keycode, keysyms_per_keycode = 0;
+  Display *display;
+  GSList *mod1_list, *mod2_list, *mod3_list, *mod4_list, *mod5_list; 
+  XModifierKeymap *map;
+  KeySym *sym;
+
+  g_modifier_state = 0;
+  g_numlock_mask = 0;
+
+  mod1_list = mod2_list = mod3_list = mod4_list = mod5_list = NULL;
+
+  display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+  map = XGetModifierMapping(display);
+  XDisplayKeycodes(display, &min_keycode, &max_keycode);
+  sym = XGetKeyboardMapping(display, min_keycode,
+		  	    (max_keycode - min_keycode + 1),
+			    &keysyms_per_keycode);
+  for (i = 0; i < 8; i++) {
+    int j;
+    for (j = 0; j < map->max_keypermod; j++) {
+      if (map->modifiermap[k]) {
+	KeySym ks;
+	int index = 0;
+	char *nm;
+	do {
+	  ks = XKeycodeToKeysym(display, map->modifiermap[k], index);
+	  index++;
+	} while (!ks && index < keysyms_per_keycode);
+
+	nm = XKeysymToString(ks);
+	switch (i) {
+	case ShiftMapIndex:
+	  break;
+	case LockMapIndex:
+	  break;
+	case ControlMapIndex:
+	  break;
+	case Mod1MapIndex:
+	  mod1_list = g_slist_prepend(mod1_list, GUINT_TO_POINTER(ks));
+	  g_mod1_mask = check_modifier(mod1_list);
+	  break;
+	case Mod2MapIndex:
+	  mod2_list = g_slist_prepend(mod2_list, GUINT_TO_POINTER(ks));
+	  g_mod2_mask = check_modifier(mod2_list);
+	  break;
+	case Mod3MapIndex:
+	  mod3_list = g_slist_prepend(mod3_list, GUINT_TO_POINTER(ks));
+	  g_mod3_mask = check_modifier(mod3_list);
+	  break;
+	case Mod4MapIndex:
+	  mod4_list = g_slist_prepend(mod4_list, GUINT_TO_POINTER(ks));
+	  g_mod4_mask = check_modifier(mod4_list);
+	  break;
+	case Mod5MapIndex:
+	  mod5_list = g_slist_prepend(mod5_list, GUINT_TO_POINTER(ks));
+	  g_mod5_mask = check_modifier(mod5_list);
+	  break;
+	default:
+	  break;
+	}
+	if (ks == XK_Num_Lock)
+	  g_numlock_mask |= (1 << i);
+      }
+      k++;
+    }
+  }
+  g_slist_free(mod1_list);
+  g_slist_free(mod2_list);
+  g_slist_free(mod3_list);
+  g_slist_free(mod4_list);
+  g_slist_free(mod5_list);
+  XFreeModifiermap(map);
+  XFree(sym);
+#endif
+}

Added: branches/r5rs/gtk/key-util-gtk.h
===================================================================
--- branches/r5rs/gtk/key-util-gtk.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/gtk/key-util-gtk.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -0,0 +1,54 @@
+/*
+
+  Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of authors nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+*/
+
+/*
+ * key utility for uim-gtk
+ */
+
+#ifndef _key_util_gtk_h_included_
+#define _key_util_gtk_h_included_
+
+#include <glib.h>
+
+/*
+ * Initialize modifier key mappings.
+ */
+void im_uim_init_modifier_keys(void);
+
+/*
+ * Get ukey and umod from gdk's GdkEventKey->keyval and GdkEventKey->state.
+ * This function should be called at both key press and release events.
+ */
+void im_uim_convert_keyevent(GdkEventKey *key, int *ukey, int *umod);
+
+#endif

Modified: branches/r5rs/helper/Makefile.am
===================================================================
--- branches/r5rs/helper/Makefile.am	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/Makefile.am	2006-01-23 17:38:44 UTC (rev 2987)
@@ -3,10 +3,10 @@
 helper_defs = -DUIM_DATADIR=\""$(datadir)/@PACKAGE@"\"
 
 if APPLET
-
 libexec_PROGRAMS =  uim-toolbar-applet
 
-uim_toolbar_applet_LDADD = @GNOME2_LIBS@ @GTK2_LIBS@ @APPLET_LIBS@  $(top_builddir)/uim/libuim.la
+uim_toolbar_applet_LDADD = @GNOME2_LIBS@ @GTK2_LIBS@ @APPLET_LIBS@ \
+			   $(top_builddir)/uim/libuim.la
 uim_toolbar_applet_CPPFLAGS = $(helper_defs) -I$(top_srcdir) -I$(top_builddir)
 uim_toolbar_applet_CFLAGS = @GTK2_CFLAGS@ @APPLET_CFLAGS@ @GNOME2_CFLAGS@ -Wall
 
@@ -19,26 +19,18 @@
 
 @INTLTOOL_SERVER_RULE@
 
-install-exec-hook-applet:
-	cd $(DESTDIR)$(libexecdir) && \
-	  rm -f uim-helper-applet && \
-	  $(LN_S) uim-toolbar-applet uim-helper-applet
-
 $(server_in_files): $(server_in_in_files) Makefile
 	sed s, at LIBEXECDIR@,$(libexecdir),g <$< >$@.tmp
 	sed s, at UIM_PIXMAPSDIR@,$(uim_pixmapsdir),g <$@.tmp >$@
 
-DISTCLEANFILES = GNOME_UimApplet.server.in GNOME_UimApplet.server GNOME_UimApplet.server.in.tmp
-
-else
-install-exec-hook-applet:
-	true #dummy
+DISTCLEANFILES = GNOME_UimApplet.server.in GNOME_UimApplet.server \
+		 GNOME_UimApplet.server.in.tmp
 endif
 
 
 if GTK2
-
-bin_PROGRAMS = uim-toolbar-gtk uim-toolbar-gtk-systray uim-im-switcher-gtk uim-input-pad-ja
+bin_PROGRAMS = uim-toolbar-gtk uim-toolbar-gtk-systray uim-im-switcher-gtk \
+	       uim-input-pad-ja
 if APPLET
 libexec_PROGRAMS += uim-candwin-gtk
 else
@@ -53,7 +45,7 @@
 bin_PROGRAMS += uim-pref-gtk
 endif
 
-uim_candwin_gtk_SOURCES  = helper-candwin-gtk.c \
+uim_candwin_gtk_SOURCES  = candwin-gtk.c \
 			   ../gtk/caret-state-indicator.c \
 			   ../gtk/caret-state-indicator.h
 uim_candwin_gtk_LDADD    = @GTK2_LIBS@ $(top_builddir)/uim/libuim.la
@@ -65,7 +57,8 @@
 uim_toolbar_gtk_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
 uim_toolbar_gtk_CFLAGS   = @GTK2_CFLAGS@ -Wall
 
-uim_toolbar_gtk_systray_SOURCES  = toolbar-systray-gtk.c toolbar-common-gtk.c eggtrayicon.c eggtrayicon.h
+uim_toolbar_gtk_systray_SOURCES  = toolbar-systray-gtk.c toolbar-common-gtk.c \
+				   eggtrayicon.c eggtrayicon.h
 uim_toolbar_gtk_systray_LDADD    = @GTK2_LIBS@ $(top_builddir)/uim/libuim.la
 uim_toolbar_gtk_systray_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
 uim_toolbar_gtk_systray_CFLAGS   = @GTK2_CFLAGS@  -Wall
@@ -81,7 +74,9 @@
 uim_input_pad_ja_CFLAGS   = @GTK2_CFLAGS@ -Wall
 
 if GTK2_4
-uim_pref_gtk_SOURCES  = pref-gtk.c pref-gtk-custom-widgets.c pref-gtk-custom-widgets.h
+uim_pref_gtk_SOURCES  = pref-gtk.c \
+			pref-gtk-custom-widgets.c pref-gtk-custom-widgets.h \
+			../gtk/key-util-gtk.c ../gtk/key-util-gtk.h
 uim_pref_gtk_LDADD    = @GTK2_LIBS@ $(top_builddir)/uim/libuim-custom.la \
 			$(top_builddir)/uim/libuim.la
 uim_pref_gtk_CPPFLAGS = $(helper_defs) -I$(top_srcdir) -I$(top_builddir)
@@ -95,14 +90,4 @@
 uim_dict_gtk_CFLAGS   = @GTK2_CFLAGS@
 endif
 
-install-exec-hook-gtk2:
-	cd $(DESTDIR)$(bindir) && \
-	  rm -f uim-helper-toolbar-gtk uim-helper-toolbar-gtk-systray && \
-	  $(LN_S) uim-toolbar-gtk uim-helper-toolbar-gtk && \
-	  $(LN_S) uim-toolbar-gtk-systray uim-helper-toolbar-gtk-systray
-else
-install-exec-hook-gtk2:
-	true # dummy
 endif
-
-install-exec-hook: install-exec-hook-gtk2 install-exec-hook-applet

Added: branches/r5rs/helper/candwin-gtk.c
===================================================================
--- branches/r5rs/helper/candwin-gtk.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/candwin-gtk.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -0,0 +1,759 @@
+/*
+
+  Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of authors nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+#include <uim/uim.h>
+#include <uim/uim-helper.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <glib/gprintf.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "../gtk/caret-state-indicator.h"
+
+#define UIM_TYPE_CANDIDATE_WINDOW	(candidate_window_get_type())
+#define UIM_CANDIDATE_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_CAST ((obj), candidate_window_get_type(), UIMCandidateWindow))
+#define UIM_IS_CANDIDATE_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), UIM_TYPE_CANDIDATE_WINDOW))
+#define UIM_IS_CANDIDATE_WINDOW_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), UIM_TYPE_CANDIDATE_WINDOW))
+#define UIM_CANDIDATE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UIM_TYPE_CANDIDATE_WINDOW, UIMCandidateWindowClass))
+
+typedef struct _UIMCandidateWindow	UIMCandidateWindow;
+typedef struct _UIMCandidateWindowClass	UIMCandidateWindowClass;
+
+struct _UIMCandidateWindow {
+  GtkWindow parent;
+
+  GtkWidget *view;
+  GtkWidget *num_label;
+
+  GPtrArray *stores;
+
+  guint nr_candidates;
+  guint display_limit;
+  gint candidate_index;
+  gint page_index;
+
+  gint pos_x;
+  gint pos_y;
+  gint width;
+  gint height;
+
+  GtkWidget *caret_state_indicator;
+
+  gboolean is_active;
+};
+
+struct _UIMCandidateWindowClass {
+  GtkWindowClass parent_class;
+
+  /* signals */
+  void (*index_changed) (UIMCandidateWindowClass *candwin);
+};
+
+static UIMCandidateWindow *cwin; /* use single candwin */
+
+GType candidate_window_get_type(void);
+UIMCandidateWindow *candidate_window_new(void);
+
+/* copied from uim-cand-win-gtk.c */
+static gint uim_cand_win_gtk_get_index(UIMCandidateWindow *cwin);
+static void uim_cand_win_gtk_set_index(UIMCandidateWindow *cwin, gint index);
+static void uim_cand_win_gtk_set_page(UIMCandidateWindow *cwin, gint page);
+
+static void uim_cand_win_gtk_layout(void);
+
+#define NR_CANDIDATES 10 /* FIXME! not used */
+#define CANDWIN_DEFAULT_WIDTH	80
+
+enum {
+  INDEX_CHANGED_SIGNAL,
+  NR_SIGNALS
+};
+
+enum {
+  TERMINATOR = -1,
+  COLUMN_HEADING,
+  COLUMN_CANDIDATE
+};
+
+static void candidate_window_init(UIMCandidateWindow *cwin);
+static void candidate_window_class_init(UIMCandidateWindowClass *klass);
+
+static gboolean tree_selection_changed(GtkTreeSelection *selection,
+				       GtkTreeModel *model,
+				       GtkTreePath *path,
+				       gboolean path_currently_selected,
+				       gpointer data);
+
+#if 0
+static gboolean tree_view_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data);
+#endif
+static gboolean configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
+
+static GType candidate_window_type = 0;
+static GTypeInfo const object_info = {
+  sizeof (UIMCandidateWindowClass),
+  NULL,
+  NULL,
+  (GClassInitFunc) candidate_window_class_init,
+  NULL,
+  NULL,
+  sizeof(UIMCandidateWindow),
+  0,
+  (GInstanceInitFunc) candidate_window_init,
+};
+
+static gint cand_win_gtk_signals[NR_SIGNALS] = {0};
+
+static unsigned int read_tag;
+
+static void init_candidate_win(void);
+static void candwin_activate(gchar **str);
+static void candwin_update(gchar **str);
+static void candwin_move(char **str);
+static void candwin_show(void);
+static void candwin_deactivate(void);
+static void str_parse(char *str);
+
+static void index_changed_cb(UIMCandidateWindow *cwin)
+{
+  fprintf(stdout, "index\n");
+  fprintf(stdout, "%d\n\n", uim_cand_win_gtk_get_index(cwin));
+  fflush(stdout);
+}
+
+GType
+candidate_window_get_type(void)
+{
+  if (!candidate_window_type)
+    candidate_window_type = g_type_register_static(GTK_TYPE_WINDOW,
+		    "UIMCandidateWindow", &object_info, (GTypeFlags)0);
+  return candidate_window_type;
+}
+
+static void candidate_window_class_init(UIMCandidateWindowClass *klass)
+{
+  cand_win_gtk_signals[INDEX_CHANGED_SIGNAL]
+    = g_signal_new("index-changed",
+		   G_TYPE_FROM_CLASS(klass),
+		   G_SIGNAL_RUN_FIRST,
+		   G_STRUCT_OFFSET(UIMCandidateWindowClass, index_changed),
+		   NULL, NULL,
+		   g_cclosure_marshal_VOID__VOID,
+		   G_TYPE_NONE, 0);
+}
+
+UIMCandidateWindow *
+candidate_window_new(void)
+{
+  GObject *obj = g_object_new(UIM_TYPE_CANDIDATE_WINDOW, "type",
+		  GTK_WINDOW_POPUP, NULL);
+  return UIM_CANDIDATE_WINDOW(obj);
+}
+
+/* copied from uim-cand-win-gtk.c */
+static void
+update_label(UIMCandidateWindow *cwin)
+{
+  char label_str[20];
+
+  if (cwin->candidate_index >= 0)
+    g_snprintf(label_str, sizeof(label_str), "%d / %d",
+	       cwin->candidate_index + 1 , cwin->nr_candidates);
+  else
+    g_snprintf(label_str, sizeof(label_str), "- / %d",
+	       cwin->nr_candidates);
+
+  gtk_label_set_text(GTK_LABEL(cwin->num_label), label_str);
+}
+
+/* copied from uim-cand-win-gtk.c */
+static gboolean
+tree_selection_changed(GtkTreeSelection *selection,
+		       GtkTreeModel *model,
+		       GtkTreePath *path,
+		       gboolean path_currently_selected,
+		       gpointer data)
+{
+  /* candidate_window *cwin = data; */
+  gint *indicies;
+  gint idx;
+
+  if (!cwin)
+    return TRUE;
+
+  indicies = gtk_tree_path_get_indices(path);
+  g_return_val_if_fail(indicies, TRUE);
+  idx = *indicies + cwin->display_limit * cwin->page_index;
+
+  if (!path_currently_selected && cwin->candidate_index != idx) {
+    if (cwin->candidate_index >= 0) {
+      cwin->candidate_index = idx;
+      g_signal_emit(G_OBJECT(cwin),
+		    cand_win_gtk_signals[INDEX_CHANGED_SIGNAL], 0);
+    }
+
+    update_label(cwin);
+
+    if (cwin->candidate_index < 0)
+      return FALSE;
+    else
+      return TRUE;
+  } else {
+    update_label(cwin);
+
+    return TRUE;
+  }
+}
+
+#if 0
+/* copied from uim-cand-win-gtk.c */
+static gboolean
+tree_view_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
+{
+  GtkTreePath *path;
+  gboolean exist, retval = FALSE;
+  gint *indicies;
+
+  fprintf(stderr, "tree_view_button_press\n");
+  g_return_val_if_fail(GTK_IS_TREE_VIEW(widget), FALSE);
+  g_return_val_if_fail(UIM_CANDIDATE_WINDOW(data), FALSE);
+
+  /* cwin = UIM_CANDIDATE_WINDOW(data); */
+
+  exist = gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
+					event->x, event->y,
+					&path, NULL, NULL, NULL);
+  if (!exist)
+    return FALSE;
+
+  indicies = gtk_tree_path_get_indices(path);
+
+  /* don't relay button press event to empty row */
+  if (cwin->display_limit * cwin->page_index + *indicies >= cwin->nr_candidates)
+
+    retval = TRUE;
+
+  gtk_tree_path_free(path);
+
+  return retval;
+}
+#endif
+
+static void
+cb_tree_view_destroy(GtkWidget *widget, GPtrArray *stores)
+{
+  gint i;
+
+  g_return_if_fail(GTK_IS_TREE_VIEW(widget));
+
+  for (i = cwin->stores->len - 1; i >= 0; i--) {
+    GtkListStore *store = g_ptr_array_remove_index(cwin->stores, i);
+    gtk_list_store_clear(store);
+    g_object_unref(G_OBJECT(store));
+  }
+  g_ptr_array_free(cwin->stores, TRUE);
+}
+
+static void
+init_candidate_win(void) {
+  cwin = candidate_window_new();
+  g_signal_connect(G_OBJECT(cwin), "index-changed",
+		   G_CALLBACK(index_changed_cb), NULL);
+  g_signal_connect(G_OBJECT(cwin), "configure_event",
+		   G_CALLBACK(configure_event_cb), NULL);
+}
+
+static void
+candidate_window_init(UIMCandidateWindow *cwin)
+{
+  GtkCellRenderer *renderer;
+  GtkTreeViewColumn *column; 
+  GtkWidget *scrolled_window;
+  GtkWidget *vbox;
+  GtkWidget *frame;
+  GtkTreeSelection *selection;
+  GdkRectangle cursor_location;
+  
+  vbox = gtk_vbox_new(FALSE, 0);
+  frame = gtk_frame_new(NULL);
+
+  cwin->stores = g_ptr_array_new();
+  
+  gtk_window_set_default_size(GTK_WINDOW(cwin),
+		  CANDWIN_DEFAULT_WIDTH, -1);
+  
+
+  scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+				 GTK_POLICY_NEVER,
+				 GTK_POLICY_NEVER);
+  gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
+  
+  cwin->view = gtk_tree_view_new();
+  g_signal_connect(G_OBJECT(cwin->view), "destroy", 
+  		   G_CALLBACK(cb_tree_view_destroy), cwin->stores);
+  gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cwin->view), TRUE);
+  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(cwin->view), FALSE);
+  gtk_container_add(GTK_CONTAINER(scrolled_window), cwin->view);
+
+  gtk_container_add(GTK_CONTAINER(frame), vbox);
+  gtk_container_add(GTK_CONTAINER(cwin), frame);
+  gtk_container_set_border_width(GTK_CONTAINER(frame), 0);
+    
+  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cwin->view));
+
+  gtk_tree_selection_set_select_function(selection,
+		  			 tree_selection_changed,
+					 cwin,
+					 NULL);
+
+  renderer = gtk_cell_renderer_text_new();
+  g_object_set(renderer, "scale", 1.2, NULL);
+
+  column = gtk_tree_view_column_new_with_attributes("No",
+						    renderer,
+						    "text",
+						    COLUMN_HEADING,
+						    NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+  gtk_tree_view_append_column(GTK_TREE_VIEW(cwin->view), column);
+  
+  renderer = gtk_cell_renderer_text_new();
+  g_object_set(renderer, "scale", 1.2, NULL);
+  /* g_object_set(renderer, "size-points", 20.0, NULL); */
+  column = gtk_tree_view_column_new_with_attributes("Text",
+						    renderer,
+						    "text",
+						    COLUMN_CANDIDATE,
+						    NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+  gtk_tree_view_append_column(GTK_TREE_VIEW(cwin->view), column);
+  
+  cwin->num_label = gtk_label_new("");
+
+  gtk_box_pack_start(GTK_BOX(vbox), cwin->num_label, FALSE, FALSE, 0);
+
+#if 0
+  g_signal_connect(G_OBJECT(cwin->view), "button-press-event", 
+  		   G_CALLBACK(tree_view_button_press), cwin);
+#endif
+
+  cwin->pos_x = 0;
+  cwin->pos_y = 0;
+  cwin->is_active = FALSE;
+  cwin->caret_state_indicator = caret_state_indicator_new();
+
+  cursor_location.x = 0;
+  cursor_location.y = 0;
+  cursor_location.height = 0;
+  caret_state_indicator_set_cursor_location(cwin->caret_state_indicator, &cursor_location);
+}
+
+static void
+candwin_activate(gchar **str)
+{
+  gsize rbytes, wbytes;
+  gint i, nr_stores = 1;
+  guint j = 1;
+  gchar *utf8_str;
+  const gchar *charset;
+  guint display_limit;
+  GSList *candidates = NULL;
+
+  if (cwin->stores == NULL)
+    cwin->stores = g_ptr_array_new();
+
+  /* remove old data */
+  for (i = cwin->stores->len - 1; i >= 0; i--) {
+    GtkListStore *store = g_ptr_array_remove_index(cwin->stores, i);
+    gtk_list_store_clear(store);
+    g_object_unref(G_OBJECT(store));
+  }
+
+  if (!strncmp(str[1], "charset=", 8))
+    charset = str[1] + 8;
+  else
+    charset = "UTF-8";
+
+  if (!strncmp(str[2], "display_limit=", 14)) {
+    display_limit = atoi(str[2] + 14);
+    i = 3;
+  } else {
+    display_limit = 0;
+    i = 2;
+  }
+
+  for ( ; str[i]; i++) {
+    if (strcmp(str[i], "") == 0) {
+      break;
+    }
+    utf8_str = g_convert(str[i],
+			 -1, 
+			 "UTF-8",
+			 charset,
+			 &rbytes, &wbytes, NULL);
+    
+    candidates = g_slist_append(candidates, utf8_str);
+    j++;
+  }
+
+  cwin->candidate_index = -1;
+  cwin->nr_candidates = j - 1;
+  cwin->display_limit = display_limit;
+
+  if (candidates == NULL)
+    return;
+
+  /* calculate number of GtkListStores to create */
+  if (display_limit) {
+    nr_stores = cwin->nr_candidates / display_limit;
+    if (cwin->nr_candidates > display_limit * nr_stores)
+      nr_stores++;
+  }
+
+  /* create GtkListStores, and set candidates */
+  for (i = 0; i < nr_stores; i++) {
+    GtkListStore *store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
+    GSList *node;
+
+    g_ptr_array_add(cwin->stores, store);
+
+    /* set candidates */
+    for (j = i * display_limit, node = g_slist_nth(candidates, j);
+	 display_limit ? j < display_limit * (i + 1) : j < cwin->nr_candidates;
+	 j++, node = g_slist_next(node))
+    {
+      GtkTreeIter ti;
+      if (node) {
+	gchar *str = node->data;
+	gchar **column = g_strsplit(str, "\t", 2);
+	gtk_list_store_append(store, &ti);
+	gtk_list_store_set(store, &ti,
+			   COLUMN_HEADING, column[0],
+			   COLUMN_CANDIDATE, column[1],
+			   TERMINATOR);
+	g_strfreev(column);
+	g_free(str);
+      } else {
+	/* No need to set any data for empty row. */
+      }
+    }
+  }
+
+  uim_cand_win_gtk_set_page(cwin, 0);
+  update_label(cwin);
+
+  gtk_widget_show_all(GTK_WIDGET(cwin));
+  cwin->is_active = TRUE;
+}
+
+static void
+candwin_update(gchar **str)
+{
+  int index;
+  sscanf(str[1], "%d", &index);
+
+  uim_cand_win_gtk_set_index(cwin, index);
+}
+
+static void
+candwin_move(char **str)
+{
+  sscanf(str[1], "%d", &cwin->pos_x);
+  sscanf(str[2], "%d", &cwin->pos_y);
+
+  uim_cand_win_gtk_layout();
+}
+
+static void
+candwin_show(void)
+{
+  if (cwin->is_active)
+    gtk_widget_show_all(GTK_WIDGET(cwin));
+}
+
+static void
+candwin_deactivate(void)
+{
+  gtk_widget_hide(GTK_WIDGET(cwin));
+  cwin->is_active = FALSE;
+}
+
+static void
+caret_state_show(gchar **str)
+{
+  int timeout;
+
+  sscanf(str[1], "%d", &timeout);
+  caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, str[2]);
+  if (timeout != 0)
+    caret_state_indicator_set_timeout(cwin->caret_state_indicator, timeout * 1000);
+  gtk_widget_show_all(GTK_WIDGET(cwin->caret_state_indicator));
+}
+
+static void
+caret_state_update()
+{
+  caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, NULL);
+}
+
+static void
+caret_state_hide()
+{
+  gtk_widget_hide(cwin->caret_state_indicator);
+}
+
+static void str_parse(gchar *str)
+{
+  gchar **tmp;
+  gchar *command;
+
+  tmp = g_strsplit(str, "\n", 0);
+  command = tmp[0];
+
+  if (command) {
+    if (strcmp("activate", command) == 0) {
+      candwin_activate(tmp);
+    } else if (strcmp("select", command) == 0) {
+      candwin_update(tmp);
+    } else if (strcmp("show", command) == 0) {
+      candwin_show();
+    } else if (strcmp("hide", command) == 0) {
+      gtk_widget_hide_all(GTK_WIDGET(cwin));
+    } else if (strcmp("move", command) == 0) {
+      candwin_move(tmp);
+    } else if (strcmp("deactivate", command) == 0) {
+      candwin_deactivate();
+    } else if (strcmp("show_caret_state", command) == 0) {
+      caret_state_show(tmp);
+    } else if (strcmp("update_caret_state", command) == 0) {
+      caret_state_update();
+    } else if (strcmp("hide_caret_state", command) == 0) {
+      caret_state_hide();
+    }
+  }
+  g_strfreev(tmp);
+}
+
+#define CANDIDATE_BUFFER_SIZE	4096
+static gboolean
+read_cb(GIOChannel *channel, GIOCondition c, gpointer p)
+{
+  char buf[CANDIDATE_BUFFER_SIZE];
+  char *read_buf = strdup("");
+  int i = 0;
+  int n;
+  gchar **tmp;
+  int fd = g_io_channel_unix_get_fd(channel);
+
+  while (uim_helper_fd_readable(fd) > 0) {
+    n = read(fd, buf, CANDIDATE_BUFFER_SIZE - 1);
+    if (n == 0) {
+      close(fd);
+      exit(EXIT_FAILURE);
+    }
+    if (n == -1)
+      return TRUE;
+    buf[n] = '\0';
+    read_buf = realloc(read_buf, strlen(read_buf) + n + 1);
+    strcat(read_buf, buf);
+  }
+
+  tmp = g_strsplit(read_buf, "\n\n", 0);
+
+  while (tmp[i]) {
+    str_parse(tmp[i]);
+    i++;
+  }
+  g_strfreev(tmp);
+  free(read_buf);
+  return TRUE;
+}
+
+int
+main(int argc, char *argv[])
+{
+  GIOChannel *channel;
+
+  gtk_set_locale();
+  gtk_init(&argc, &argv);
+
+  init_candidate_win();
+
+  channel = g_io_channel_unix_new(0);
+  read_tag = g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR,
+			    read_cb, 0);
+  g_io_channel_unref(channel);
+
+  gtk_main();
+  return 0;
+}
+
+/* copied from uim-cand-win-gtk.c */
+static gint
+uim_cand_win_gtk_get_index(UIMCandidateWindow *cwin)
+{
+  g_return_val_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin), -1);
+
+  return cwin->candidate_index;
+}
+
+/* copied from uim-cand-win-gtk.c */
+static void
+uim_cand_win_gtk_set_index(UIMCandidateWindow *cwin, gint index)
+{
+  gint new_page;
+
+  g_return_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin));
+
+  if (index >= (gint) cwin->nr_candidates)
+    cwin->candidate_index = 0;
+  else
+    cwin->candidate_index = index;
+
+  if (cwin->candidate_index >= 0 && cwin->display_limit)
+    new_page = cwin->candidate_index / cwin->display_limit;
+  else
+    new_page = cwin->page_index;
+
+  if (cwin->page_index != new_page)
+    uim_cand_win_gtk_set_page(cwin, new_page);
+
+  if (cwin->candidate_index >= 0) {
+    GtkTreePath *path;
+    gint pos = index;
+
+    if (cwin->display_limit)
+      pos = cwin->candidate_index % cwin->display_limit;
+
+    path = gtk_tree_path_new_from_indices(pos, -1);
+    gtk_tree_view_set_cursor(GTK_TREE_VIEW(cwin->view),
+			     path, NULL, FALSE);
+    gtk_tree_path_free(path);
+
+  } else {
+    GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cwin
+->view));
+
+    gtk_tree_selection_unselect_all(selection);
+  }
+}
+
+/* copied from uim-cand-win-gtk.c */
+static void
+uim_cand_win_gtk_set_page(UIMCandidateWindow *cwin, gint page)
+{
+  guint len, new_page;
+  gint new_index;
+
+  g_return_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin));
+  g_return_if_fail(cwin->stores);
+
+  len = cwin->stores->len;
+  g_return_if_fail(len);
+
+  if (page < 0) {
+    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
+			    GTK_TREE_MODEL(cwin->stores->pdata[len - 1]));
+    new_page = len - 1;
+  } else if (page >= (gint) len) {
+    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
+			    GTK_TREE_MODEL(cwin->stores->pdata[0]));
+    new_page = 0;
+  } else {
+    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
+
+			    GTK_TREE_MODEL(cwin->stores->pdata[page]));
+    new_page = page;
+  }
+
+  cwin->page_index = new_page;
+
+  if (cwin->display_limit) {
+    if (cwin->candidate_index >= 0)
+      new_index
+	= (new_page * cwin->display_limit) + (cwin->candidate_index % cwin->display_limit);
+    else
+      new_index = -1;
+  } else {
+    new_index = cwin->candidate_index;
+  }
+
+  if (new_index >= (gint) cwin->nr_candidates)
+    new_index = cwin->nr_candidates - 1;
+
+ /* shrink the window */
+  gtk_window_resize(GTK_WINDOW(cwin), CANDWIN_DEFAULT_WIDTH, 1);
+
+  uim_cand_win_gtk_set_index(cwin, new_index);
+}
+
+static void
+uim_cand_win_gtk_layout()
+{
+  int x, y;
+  int screen_width, screen_height;
+
+  screen_width = gdk_screen_get_width(gdk_screen_get_default());
+  screen_height = gdk_screen_get_height(gdk_screen_get_default());
+
+  if (screen_width < cwin->pos_x + cwin->width)
+    x = cwin->pos_x - cwin->width;
+  else
+    x = cwin->pos_x;
+
+  if (screen_height < cwin->pos_y + cwin->height)
+    y = cwin->pos_y - cwin->height - 20; /* FIXME: Preedit height is needed to
+					    be sent by uim-xim */
+  else
+    y = cwin->pos_y;
+
+  gtk_window_move(GTK_WINDOW(cwin), x, y);
+}
+
+static gboolean
+configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
+{
+  cwin->width = event->width;
+  cwin->height = event->height;
+
+  uim_cand_win_gtk_layout();
+
+  return FALSE;
+}

Deleted: branches/r5rs/helper/helper-candwin-gtk.c
===================================================================
--- branches/r5rs/helper/helper-candwin-gtk.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/helper-candwin-gtk.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -1,759 +0,0 @@
-/*
-
-  Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
-
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-
-  1. Redistributions of source code must retain the above copyright
-     notice, this list of conditions and the following disclaimer.
-  2. Redistributions in binary form must reproduce the above copyright
-     notice, this list of conditions and the following disclaimer in the
-     documentation and/or other materials provided with the distribution.
-  3. Neither the name of authors nor the names of its contributors
-     may be used to endorse or promote products derived from this software
-     without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
-  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-  SUCH DAMAGE.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-#include <uim/uim.h>
-#include <uim/uim-helper.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-#include <glib/gprintf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "../gtk/caret-state-indicator.h"
-
-#define UIM_TYPE_CANDIDATE_WINDOW	(candidate_window_get_type())
-#define UIM_CANDIDATE_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_CAST ((obj), candidate_window_get_type(), UIMCandidateWindow))
-#define UIM_IS_CANDIDATE_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), UIM_TYPE_CANDIDATE_WINDOW))
-#define UIM_IS_CANDIDATE_WINDOW_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), UIM_TYPE_CANDIDATE_WINDOW))
-#define UIM_CANDIDATE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UIM_TYPE_CANDIDATE_WINDOW, UIMCandidateWindowClass))
-
-typedef struct _UIMCandidateWindow	UIMCandidateWindow;
-typedef struct _UIMCandidateWindowClass	UIMCandidateWindowClass;
-
-struct _UIMCandidateWindow {
-  GtkWindow parent;
-
-  GtkWidget *view;
-  GtkWidget *num_label;
-
-  GPtrArray *stores;
-
-  guint nr_candidates;
-  guint display_limit;
-  gint candidate_index;
-  gint page_index;
-
-  gint pos_x;
-  gint pos_y;
-  gint width;
-  gint height;
-
-  GtkWidget *caret_state_indicator;
-
-  gboolean is_active;
-};
-
-struct _UIMCandidateWindowClass {
-  GtkWindowClass parent_class;
-
-  /* signals */
-  void (*index_changed) (UIMCandidateWindowClass *candwin);
-};
-
-static UIMCandidateWindow *cwin; /* use static one */
-
-GType candidate_window_get_type(void);
-UIMCandidateWindow *candidate_window_new(void);
-
-/* copied from uim-cand-win-gtk.c */
-static gint uim_cand_win_gtk_get_index(UIMCandidateWindow *cwin);
-static void uim_cand_win_gtk_set_index(UIMCandidateWindow *cwin, gint index);
-static void uim_cand_win_gtk_set_page(UIMCandidateWindow *cwin, gint page);
-
-static void uim_cand_win_gtk_layout(void);
-
-#define NR_CANDIDATES 10 /* FIXME! not used */
-#define CANDWIN_DEFAULT_WIDTH	80
-
-enum {
-  INDEX_CHANGED_SIGNAL,
-  NR_SIGNALS
-};
-
-enum {
-  TERMINATOR = -1,
-  COLUMN_HEADING,
-  COLUMN_CANDIDATE
-};
-
-static void candidate_window_init(UIMCandidateWindow *cwin);
-static void candidate_window_class_init(UIMCandidateWindowClass *klass);
-
-static gboolean tree_selection_changed(GtkTreeSelection *selection,
-				       GtkTreeModel *model,
-				       GtkTreePath *path,
-				       gboolean path_currently_selected,
-				       gpointer data);
-
-#if 0
-static gboolean tree_view_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data);
-#endif
-static gboolean configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
-
-static GType candidate_window_type = 0;
-static GTypeInfo const object_info = {
-  sizeof (UIMCandidateWindowClass),
-  NULL,
-  NULL,
-  (GClassInitFunc) candidate_window_class_init,
-  NULL,
-  NULL,
-  sizeof(UIMCandidateWindow),
-  0,
-  (GInstanceInitFunc) candidate_window_init,
-};
-
-static gint cand_win_gtk_signals[NR_SIGNALS] = {0};
-
-static unsigned int read_tag;
-
-static void init_candidate_win(void);
-static void candwin_activate(gchar **str);
-static void candwin_update(gchar **str);
-static void candwin_move(char **str);
-static void candwin_show(void);
-static void candwin_deactivate(void);
-static void str_parse(char *str);
-
-static void index_changed_cb(UIMCandidateWindow *cwin)
-{
-  fprintf(stdout, "index\n");
-  fprintf(stdout, "%d\n\n", uim_cand_win_gtk_get_index(cwin));
-  fflush(stdout);
-}
-
-GType
-candidate_window_get_type(void)
-{
-  if (!candidate_window_type)
-    candidate_window_type = g_type_register_static(GTK_TYPE_WINDOW,
-		    "UIMCandidateWindow", &object_info, (GTypeFlags)0);
-  return candidate_window_type;
-}
-
-static void candidate_window_class_init(UIMCandidateWindowClass *klass)
-{
-  cand_win_gtk_signals[INDEX_CHANGED_SIGNAL]
-    = g_signal_new("index-changed",
-		   G_TYPE_FROM_CLASS(klass),
-		   G_SIGNAL_RUN_FIRST,
-		   G_STRUCT_OFFSET(UIMCandidateWindowClass, index_changed),
-		   NULL, NULL,
-		   g_cclosure_marshal_VOID__VOID,
-		   G_TYPE_NONE, 0);
-}
-
-UIMCandidateWindow *
-candidate_window_new(void)
-{
-  GObject *obj = g_object_new(UIM_TYPE_CANDIDATE_WINDOW, "type",
-		  GTK_WINDOW_POPUP, NULL);
-  return UIM_CANDIDATE_WINDOW(obj);
-}
-
-/* copied from uim-cand-win-gtk.c */
-static void
-update_label(UIMCandidateWindow *cwin)
-{
-  char label_str[20];
-
-  if (cwin->candidate_index >= 0)
-    g_snprintf(label_str, sizeof(label_str), "%d / %d",
-	       cwin->candidate_index + 1 , cwin->nr_candidates);
-  else
-    g_snprintf(label_str, sizeof(label_str), "- / %d",
-	       cwin->nr_candidates);
-
-  gtk_label_set_text(GTK_LABEL(cwin->num_label), label_str);
-}
-
-/* copied from uim-cand-win-gtk.c */
-static gboolean
-tree_selection_changed(GtkTreeSelection *selection,
-		       GtkTreeModel *model,
-		       GtkTreePath *path,
-		       gboolean path_currently_selected,
-		       gpointer data)
-{
-  /* candidate_window *cwin = data; */
-  gint *indicies;
-  gint idx;
-
-  if (!&cwin)
-    return TRUE;
-
-  indicies = gtk_tree_path_get_indices(path);
-  g_return_val_if_fail(indicies, TRUE);
-  idx = *indicies + cwin->display_limit * cwin->page_index;
-
-  if (!path_currently_selected && cwin->candidate_index != idx) {
-    if (cwin->candidate_index >= 0) {
-      cwin->candidate_index = idx;
-      g_signal_emit(G_OBJECT(cwin),
-		    cand_win_gtk_signals[INDEX_CHANGED_SIGNAL], 0);
-    }
-
-    update_label(cwin);
-
-    if (cwin->candidate_index < 0)
-      return FALSE;
-    else
-      return TRUE;
-  } else {
-    update_label(cwin);
-
-    return TRUE;
-  }
-}
-
-#if 0
-/* copied from uim-cand-win-gtk.c */
-static gboolean
-tree_view_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
-  GtkTreePath *path;
-  gboolean exist, retval = FALSE;
-  gint *indicies;
-
-  fprintf(stderr, "tree_view_button_press\n");
-  g_return_val_if_fail(GTK_IS_TREE_VIEW(widget), FALSE);
-  g_return_val_if_fail(UIM_CANDIDATE_WINDOW(data), FALSE);
-
-  /* cwin = UIM_CANDIDATE_WINDOW(data); */
-
-  exist = gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
-					event->x, event->y,
-					&path, NULL, NULL, NULL);
-  if (!exist)
-    return FALSE;
-
-  indicies = gtk_tree_path_get_indices(path);
-
-  /* don't relay button press event to empty row */
-  if (cwin->display_limit * cwin->page_index + *indicies >= cwin->nr_candidates)
-
-    retval = TRUE;
-
-  gtk_tree_path_free(path);
-
-  return retval;
-}
-#endif
-
-static void
-cb_tree_view_destroy(GtkWidget *widget, GPtrArray *stores)
-{
-  gint i;
-
-  g_return_if_fail(GTK_IS_TREE_VIEW(widget));
-
-  for (i = cwin->stores->len - 1; i >= 0; i--) {
-    GtkListStore *store = g_ptr_array_remove_index(cwin->stores, i);
-    gtk_list_store_clear(store);
-    g_object_unref(G_OBJECT(store));
-  }
-  g_ptr_array_free(cwin->stores, TRUE);
-}
-
-static void
-init_candidate_win(void) {
-  cwin = candidate_window_new();
-  g_signal_connect(G_OBJECT(cwin), "index-changed",
-		   G_CALLBACK(index_changed_cb), NULL);
-  g_signal_connect(G_OBJECT(cwin), "configure_event",
-		   G_CALLBACK(configure_event_cb), NULL);
-}
-
-static void
-candidate_window_init(UIMCandidateWindow *cwin)
-{
-  GtkCellRenderer *renderer;
-  GtkTreeViewColumn *column; 
-  GtkWidget *scrolled_window;
-  GtkWidget *vbox;
-  GtkWidget *frame;
-  GtkTreeSelection *selection;
-  GdkRectangle cursor_location;
-  
-  vbox = gtk_vbox_new(FALSE, 0);
-  frame = gtk_frame_new(NULL);
-
-  cwin->stores = g_ptr_array_new();
-  
-  gtk_window_set_default_size(GTK_WINDOW(cwin),
-		  CANDWIN_DEFAULT_WIDTH, -1);
-  
-
-  scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-				 GTK_POLICY_NEVER,
-				 GTK_POLICY_NEVER);
-  gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
-  
-  cwin->view = gtk_tree_view_new();
-  g_signal_connect(G_OBJECT(cwin->view), "destroy", 
-  		   G_CALLBACK(cb_tree_view_destroy), cwin->stores);
-  gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cwin->view), TRUE);
-  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(cwin->view), FALSE);
-  gtk_container_add(GTK_CONTAINER(scrolled_window), cwin->view);
-
-  gtk_container_add(GTK_CONTAINER(frame), vbox);
-  gtk_container_add(GTK_CONTAINER(cwin), frame);
-  gtk_container_set_border_width(GTK_CONTAINER(frame), 0);
-    
-  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cwin->view));
-
-  gtk_tree_selection_set_select_function(selection,
-		  			 tree_selection_changed,
-					 cwin,
-					 NULL);
-
-  renderer = gtk_cell_renderer_text_new();
-  g_object_set(renderer, "scale", 1.2, NULL);
-
-  column = gtk_tree_view_column_new_with_attributes("No",
-						    renderer,
-						    "text",
-						    COLUMN_HEADING,
-						    NULL);
-  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_append_column(GTK_TREE_VIEW(cwin->view), column);
-  
-  renderer = gtk_cell_renderer_text_new();
-  g_object_set(renderer, "scale", 1.2, NULL);
-  /* g_object_set(renderer, "size-points", 20.0, NULL); */
-  column = gtk_tree_view_column_new_with_attributes("Text",
-						    renderer,
-						    "text",
-						    COLUMN_CANDIDATE,
-						    NULL);
-  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_append_column(GTK_TREE_VIEW(cwin->view), column);
-  
-  cwin->num_label = gtk_label_new("");
-
-  gtk_box_pack_start(GTK_BOX(vbox), cwin->num_label, FALSE, FALSE, 0);
-
-#if 0
-  g_signal_connect(G_OBJECT(cwin->view), "button-press-event", 
-  		   G_CALLBACK(tree_view_button_press), cwin);
-#endif
-
-  cwin->pos_x = 0;
-  cwin->pos_y = 0;
-  cwin->is_active = FALSE;
-  cwin->caret_state_indicator = caret_state_indicator_new();
-
-  cursor_location.x = 0;
-  cursor_location.y = 0;
-  cursor_location.height = 0;
-  caret_state_indicator_set_cursor_location(cwin->caret_state_indicator, &cursor_location);
-}
-
-static void
-candwin_activate(gchar **str)
-{
-  gsize rbytes, wbytes;
-  gint i, nr_stores = 1;
-  guint j = 1;
-  gchar *utf8_str;
-  const gchar *charset;
-  guint display_limit;
-  GSList *candidates = NULL;
-
-  if (cwin->stores == NULL)
-    cwin->stores = g_ptr_array_new();
-
-  /* remove old data */
-  for (i = cwin->stores->len - 1; i >= 0; i--) {
-    GtkListStore *store = g_ptr_array_remove_index(cwin->stores, i);
-    gtk_list_store_clear(store);
-    g_object_unref(G_OBJECT(store));
-  }
-
-  if (!strncmp(str[1], "charset=", 8))
-    charset = str[1] + 8;
-  else
-    charset = "UTF-8";
-
-  if (!strncmp(str[2], "display_limit=", 14)) {
-    display_limit = atoi(str[2] + 14);
-    i = 3;
-  } else {
-    display_limit = 0;
-    i = 2;
-  }
-
-  for ( ; str[i]; i++) {
-    if (strcmp(str[i], "") == 0) {
-      break;
-    }
-    utf8_str = g_convert(str[i],
-			 -1, 
-			 "UTF-8",
-			 charset,
-			 &rbytes, &wbytes, NULL);
-    
-    candidates = g_slist_append(candidates, utf8_str);
-    j++;
-  }
-
-  cwin->candidate_index = -1;
-  cwin->nr_candidates = j - 1;
-  cwin->display_limit = display_limit;
-
-  if (candidates == NULL)
-    return;
-
-  /* calculate number of GtkListStores to create */
-  if (display_limit) {
-    nr_stores = cwin->nr_candidates / display_limit;
-    if (cwin->nr_candidates > display_limit * nr_stores)
-      nr_stores++;
-  }
-
-  /* create GtkListStores, and set candidates */
-  for (i = 0; i < nr_stores; i++) {
-    GtkListStore *store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
-    GSList *node;
-
-    g_ptr_array_add(cwin->stores, store);
-
-    /* set candidates */
-    for (j = i * display_limit, node = g_slist_nth(candidates, j);
-	 display_limit ? j < display_limit * (i + 1) : j < cwin->nr_candidates;
-	 j++, node = g_slist_next(node))
-    {
-      GtkTreeIter ti;
-      if (node) {
-	gchar *str = node->data;
-	gchar **column = g_strsplit(str, "\t", 2);
-	gtk_list_store_append(store, &ti);
-	gtk_list_store_set(store, &ti,
-			   COLUMN_HEADING, column[0],
-			   COLUMN_CANDIDATE, column[1],
-			   TERMINATOR);
-	g_strfreev(column);
-	g_free(str);
-      } else {
-	/* No need to set any data for empty row. */
-      }
-    }
-  }
-
-  uim_cand_win_gtk_set_page(cwin, 0);
-  update_label(cwin);
-
-  gtk_widget_show_all(GTK_WIDGET(cwin));
-  cwin->is_active = TRUE;
-}
-
-static void
-candwin_update(gchar **str)
-{
-  int index;
-  sscanf(str[1], "%d", &index);
-
-  uim_cand_win_gtk_set_index(cwin, index);
-}
-
-static void
-candwin_move(char **str)
-{
-  sscanf(str[1], "%d", &cwin->pos_x);
-  sscanf(str[2], "%d", &cwin->pos_y);
-
-  uim_cand_win_gtk_layout();
-}
-
-static void
-candwin_show(void)
-{
-  if (cwin->is_active)
-    gtk_widget_show_all(GTK_WIDGET(cwin));
-}
-
-static void
-candwin_deactivate(void)
-{
-  gtk_widget_hide(GTK_WIDGET(cwin));
-  cwin->is_active = FALSE;
-}
-
-static void
-caret_state_show(gchar **str)
-{
-  int timeout;
-
-  sscanf(str[1], "%d", &timeout);
-  caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, str[2]);
-  if (timeout != 0)
-    caret_state_indicator_set_timeout(cwin->caret_state_indicator, timeout * 1000);
-  gtk_widget_show_all(GTK_WIDGET(cwin->caret_state_indicator));
-}
-
-static void
-caret_state_update()
-{
-  caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, NULL);
-}
-
-static void
-caret_state_hide()
-{
-  gtk_widget_hide(cwin->caret_state_indicator);
-}
-
-static void str_parse(gchar *str)
-{
-  gchar **tmp;
-  gchar *command;
-
-  tmp = g_strsplit(str, "\n", 0);
-  command = tmp[0];
-
-  if (command) {
-    if (strcmp("activate", command) == 0) {
-      candwin_activate(tmp);
-    } else if (strcmp("select", command) == 0) {
-      candwin_update(tmp);
-    } else if (strcmp("show", command) == 0) {
-      candwin_show();
-    } else if (strcmp("hide", command) == 0) {
-      gtk_widget_hide_all(GTK_WIDGET(cwin));
-    } else if (strcmp("move", command) == 0) {
-      candwin_move(tmp);
-    } else if (strcmp("deactivate", command) == 0) {
-      candwin_deactivate();
-    } else if (strcmp("show_caret_state", command) == 0) {
-      caret_state_show(tmp);
-    } else if (strcmp("update_caret_state", command) == 0) {
-      caret_state_update();
-    } else if (strcmp("hide_caret_state", command) == 0) {
-      caret_state_hide();
-    }
-  }
-  g_strfreev(tmp);
-}
-
-#define CANDIDATE_BUFFER_SIZE	4096
-static gboolean
-read_cb(GIOChannel *channel, GIOCondition c, gpointer p)
-{
-  char buf[CANDIDATE_BUFFER_SIZE];
-  char *read_buf = strdup("");
-  int i = 0;
-  int n;
-  gchar **tmp;
-  int fd = g_io_channel_unix_get_fd(channel);
-
-  while (uim_helper_fd_readable(fd) > 0) {
-    n = read(fd, buf, CANDIDATE_BUFFER_SIZE - 1);
-    if (n == 0) {
-      close(fd);
-      exit(EXIT_FAILURE);
-    }
-    if (n == -1)
-      return TRUE;
-    buf[n] = '\0';
-    read_buf = realloc(read_buf, strlen(read_buf) + n + 1);
-    strcat(read_buf, buf);
-  }
-
-  tmp = g_strsplit(read_buf, "\n\n", 0);
-
-  while (tmp[i]) {
-    str_parse(tmp[i]);
-    i++;
-  }
-  g_strfreev(tmp);
-  free(read_buf);
-  return TRUE;
-}
-
-int
-main(int argc, char *argv[])
-{
-  GIOChannel *channel;
-
-  gtk_set_locale();
-  gtk_init(&argc, &argv);
-
-  init_candidate_win();
-
-  channel = g_io_channel_unix_new(0);
-  read_tag = g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR,
-			    read_cb, 0);
-  g_io_channel_unref(channel);
-
-  gtk_main();
-  return 0;
-}
-
-/* copied from uim-cand-win-gtk.c */
-static gint
-uim_cand_win_gtk_get_index(UIMCandidateWindow *cwin)
-{
-  g_return_val_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin), -1);
-
-  return cwin->candidate_index;
-}
-
-/* copied from uim-cand-win-gtk.c */
-static void
-uim_cand_win_gtk_set_index(UIMCandidateWindow *cwin, gint index)
-{
-  gint new_page;
-
-  g_return_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin));
-
-  if (index >= (gint) cwin->nr_candidates)
-    cwin->candidate_index = 0;
-  else
-    cwin->candidate_index = index;
-
-  if (cwin->candidate_index >= 0 && cwin->display_limit)
-    new_page = cwin->candidate_index / cwin->display_limit;
-  else
-    new_page = cwin->page_index;
-
-  if (cwin->page_index != new_page)
-    uim_cand_win_gtk_set_page(cwin, new_page);
-
-  if (cwin->candidate_index >= 0) {
-    GtkTreePath *path;
-    gint pos = index;
-
-    if (cwin->display_limit)
-      pos = cwin->candidate_index % cwin->display_limit;
-
-    path = gtk_tree_path_new_from_indices(pos, -1);
-    gtk_tree_view_set_cursor(GTK_TREE_VIEW(cwin->view),
-			     path, NULL, FALSE);
-    gtk_tree_path_free(path);
-
-  } else {
-    GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cwin
-->view));
-
-    gtk_tree_selection_unselect_all(selection);
-  }
-}
-
-/* copied from uim-cand-win-gtk.c */
-static void
-uim_cand_win_gtk_set_page(UIMCandidateWindow *cwin, gint page)
-{
-  guint len, new_page;
-  gint new_index;
-
-  g_return_if_fail(UIM_IS_CANDIDATE_WINDOW(cwin));
-  g_return_if_fail(cwin->stores);
-
-  len = cwin->stores->len;
-  g_return_if_fail(len);
-
-  if (page < 0) {
-    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
-			    GTK_TREE_MODEL(cwin->stores->pdata[len - 1]));
-    new_page = len - 1;
-  } else if (page >= (gint) len) {
-    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
-			    GTK_TREE_MODEL(cwin->stores->pdata[0]));
-    new_page = 0;
-  } else {
-    gtk_tree_view_set_model(GTK_TREE_VIEW(cwin->view),
-
-			    GTK_TREE_MODEL(cwin->stores->pdata[page]));
-    new_page = page;
-  }
-
-  cwin->page_index = new_page;
-
-  if (cwin->display_limit) {
-    if (cwin->candidate_index >= 0)
-      new_index
-	= (new_page * cwin->display_limit) + (cwin->candidate_index % cwin->display_limit);
-    else
-      new_index = -1;
-  } else {
-    new_index = cwin->candidate_index;
-  }
-
-  if (new_index >= (gint) cwin->nr_candidates)
-    new_index = cwin->nr_candidates - 1;
-
- /* shrink the window */
-  gtk_window_resize(GTK_WINDOW(cwin), CANDWIN_DEFAULT_WIDTH, 1);
-
-  uim_cand_win_gtk_set_index(cwin, new_index);
-}
-
-static void
-uim_cand_win_gtk_layout()
-{
-  int x, y;
-  int screen_width, screen_height;
-
-  screen_width = gdk_screen_get_width(gdk_screen_get_default());
-  screen_height = gdk_screen_get_height(gdk_screen_get_default());
-
-  if (screen_width < cwin->pos_x + cwin->width)
-    x = cwin->pos_x - cwin->width;
-  else
-    x = cwin->pos_x;
-
-  if (screen_height < cwin->pos_y + cwin->height)
-    y = cwin->pos_y - cwin->height - 20; /* FIXME: Preedit height is needed to
-					    be sent by uim-xim */
-  else
-    y = cwin->pos_y;
-
-  gtk_window_move(GTK_WINDOW(cwin), x, y);
-}
-
-static gboolean
-configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
-{
-  cwin->width = event->width;
-  cwin->height = event->height;
-
-  uim_cand_win_gtk_layout();
-
-  return FALSE;
-}

Modified: branches/r5rs/helper/im-switcher-gtk.c
===================================================================
--- branches/r5rs/helper/im-switcher-gtk.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/im-switcher-gtk.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -49,7 +49,7 @@
 static gchar *im_list_str_old; /* To compare new im_list_str */
 static GtkWidget *switcher_tree_view;
 
-static void
+static gboolean
 reload_im_list(GtkWindow *window, gpointer user_data);
 static void
 parse_helper_str(const char *sent_str);
@@ -401,15 +401,19 @@
     gtk_window_set_position(GTK_WINDOW(switcher_win),
 			    GTK_WIN_POS_CENTER_ALWAYS);
   }
+  gtk_widget_grab_focus(switcher_tree_view);
   gtk_widget_show_all(switcher_win);
+
   return 0;
 }
 
-static void
+static gboolean
 reload_im_list(GtkWindow *window, gpointer user_data)
 {
   check_helper_connection();
   uim_helper_send_message(uim_fd, "im_list_get\n"); 
+
+  return FALSE;
 }
 
 static void

Modified: branches/r5rs/helper/pref-gtk-custom-widgets.c
===================================================================
--- branches/r5rs/helper/pref-gtk-custom-widgets.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/pref-gtk-custom-widgets.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -43,6 +43,8 @@
 #include "uim/uim-custom.h"
 #include "uim/gettext.h"
 
+#include "../gtk/key-util-gtk.h"
+
 #define OBJECT_DATA_UIM_CUSTOM_SYM    "uim-pref-gtk::uim-custom-sym"
 
 extern gboolean uim_pref_gtk_value_changed;
@@ -68,15 +70,61 @@
   GtkWidget *remove_button;
   GtkWidget *keycode_entry;
 
-  guint           grabbed_key_val;
-  GdkModifierType grabbed_key_state;
+  gint grabbed_key_val;
+  gint grabbed_key_state;
 } key_pref_win = {
   NULL, NULL, NULL, NULL, NULL, 0, 0,
 };
 
+static void uimpref_file_entry_class_init(UimPrefFileEntryClass *klass);
+static void uimpref_file_entry_init(UimPrefFileEntry *entry);
 
+GType
+uimpref_file_entry_get_type(void)
+{
+  static GType uimpref_file_entry_type = 0;
 
+  if (!uimpref_file_entry_type)
+  {
+    static const GTypeInfo uimpref_file_entry_info =
+    {
+      sizeof(UimPrefFileEntryClass),
+      NULL,
+      NULL,
+      (GClassInitFunc)uimpref_file_entry_class_init,
+      NULL,
+      NULL,
+      sizeof(UimPrefFileEntry),
+      0,
+      (GInstanceInitFunc)uimpref_file_entry_init,
+    };
+
+    uimpref_file_entry_type = g_type_register_static(GTK_TYPE_ENTRY,
+		    "UimPrefFileEntry", &uimpref_file_entry_info, 0);
+  }
+
+  return uimpref_file_entry_type;
+}
+
 static void
+uimpref_file_entry_class_init(UimPrefFileEntryClass *klass)
+{
+}
+
+static void
+uimpref_file_entry_init(UimPrefFileEntry *entry)
+{
+  entry->type = UCustomPathnameType_RegularFile;
+}
+
+GtkWidget *
+uimpref_file_entry_new()
+{
+  return GTK_WIDGET(g_object_new(uimpref_file_entry_get_type(), NULL));
+}
+
+
+static void
 custom_check_button_toggled_cb(GtkToggleButton *button, gpointer user_data)
 {
   const char *custom_sym;
@@ -293,8 +341,8 @@
     custom->value->as_str = strdup(str);
     rv = uim_custom_set(custom);
   } else if (custom->type == UCustom_Pathname) {
-    free(custom->value->as_pathname);
-    custom->value->as_pathname = strdup(str);
+    free(custom->value->as_pathname->str);
+    custom->value->as_pathname->str = strdup(str);
     rv = uim_custom_set(custom);
   } else {
     rv = UIM_FALSE;
@@ -332,7 +380,7 @@
   if (custom->type == UCustom_Str) {
     gtk_entry_set_text(GTK_ENTRY(entry), custom->value->as_str);
   } else if (custom->type == UCustom_Pathname) {
-    gtk_entry_set_text(GTK_ENTRY(entry), custom->value->as_pathname);
+    gtk_entry_set_text(GTK_ENTRY(entry), custom->value->as_pathname->str);
   }
 
   uim_custom_free(custom);
@@ -381,9 +429,20 @@
 custom_pathname_button_clicked_cb(GtkWidget *button, GtkWidget *entry)
 {
   GtkWidget *dialog;
+  GtkFileChooserAction action;
+
+  switch (UIMPREF_FILE_ENTRY(entry)->type) {
+    case UCustomPathnameType_Directory:
+      action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+      break;
+    case UCustomPathnameType_RegularFile:
+    default:
+      action = GTK_FILE_CHOOSER_ACTION_OPEN;
+      break;
+  }
   dialog = gtk_file_chooser_dialog_new (_("Specify file"),
 					NULL,
-					GTK_FILE_CHOOSER_ACTION_OPEN,
+					action,
 					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 					GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 					NULL);
@@ -407,6 +466,7 @@
   GtkWidget *label;
   GtkWidget *entry;
   GtkWidget *button;
+  const char *button_label;
 
   hbox = gtk_hbox_new(FALSE, 8);
  
@@ -415,10 +475,27 @@
   gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
 
-  entry = gtk_entry_new();
+  entry = uimpref_file_entry_new();
+  UIMPREF_FILE_ENTRY(entry)->type = custom->value->as_pathname->type;
   gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
 
-  button = gtk_button_new_with_label(_("File..."));
+  /* Since both pathname type opens the file dialog to select an item
+   * rather than open it, the label should always be "Select..." here.
+   * The type is obvious for uses even if the button label does not
+   * indicate it. Information about the action the button causes is
+   * more important. Even if a better label has been found, it should
+   * not contain the term 'directory' since GNOME uses 'folder' for
+   * it.  -- YamaKen 2006-01-21 */
+  switch (custom->value->as_pathname->type) {
+    case UCustomPathnameType_Directory:
+      button_label = N_("Select...");
+      break;
+    case UCustomPathnameType_RegularFile:
+    default:
+      button_label = N_("Select...");
+      break;
+  }
+  button = gtk_button_new_with_label(dgettext(GETTEXT_PACKAGE, button_label));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
 
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
@@ -1308,7 +1385,7 @@
 }
 
 static void
-key_pref_set_value(guint keyval, GdkModifierType mod)
+key_pref_set_value(gint ukey, gint umod)
 {
   GString *keystr;
 
@@ -1318,111 +1395,112 @@
    * easy-to-recognize key configuration.  uim-custom performs
    * implicit shift key encoding/decoding appropriately.
    */
-  if (((keyval >= 256) || !g_ascii_isgraph(keyval)) &&
-		  (mod & GDK_SHIFT_MASK))
+  if (((ukey >= 256) || !g_ascii_isgraph(ukey)) &&
+		  (umod & UMod_Shift))
     g_string_append(keystr, "<Shift>");
-  if (mod & GDK_CONTROL_MASK)
+  if (umod & UMod_Control)
     g_string_append(keystr, "<Control>");
-  if (mod & GDK_MOD1_MASK)
+  if (umod & UMod_Alt)
     g_string_append(keystr, "<Alt>");
+  if (umod & UMod_Meta)
+    g_string_append(keystr, "<Meta>");
+  if (umod & UMod_Super)
+    g_string_append(keystr, "<Super>");
+  if (umod & UMod_Hyper)
+    g_string_append(keystr, "<Hyper>");
 
-  switch (keyval) {
-  case GDK_space:
+  switch (ukey) {
+  case 0x20:
     /*
      * "space" is not proper uim keysym and only exists for user
      * convenience. It is converted to " " by uim-custom
      */
     g_string_append(keystr, "space");
     break;
-  case GDK_BackSpace:
+  case UKey_Backspace:
     g_string_append(keystr, "backspace");
     break;
-  case GDK_Delete:
+  case UKey_Delete:
     g_string_append(keystr, "delete");
     break;
-  case GDK_Insert:
+  case UKey_Insert:
     g_string_append(keystr, "insert");
     break;
-  case GDK_Escape:
+  case UKey_Escape:
     g_string_append(keystr, "escape");
     break;
-  case GDK_Tab:
+  case UKey_Tab:
     g_string_append(keystr, "tab");
     break;
-  case GDK_Return:
+  case UKey_Return:
     g_string_append(keystr, "return");
     break;
-  case GDK_Left:
+  case UKey_Left:
     g_string_append(keystr, "left");
     break;
-  case GDK_Up:
+  case UKey_Up:
     g_string_append(keystr, "up");
     break;
-  case GDK_Right:
+  case UKey_Right:
     g_string_append(keystr, "right");
     break;
-  case GDK_Down:
+  case UKey_Down:
     g_string_append(keystr, "down");
     break;
-  case GDK_Prior:
+  case UKey_Prior:
     g_string_append(keystr, "prior");
     break;
-  case GDK_Next:
+  case UKey_Next:
     g_string_append(keystr, "next");
     break;
-  case GDK_Home:
+  case UKey_Home:
     g_string_append(keystr, "home");
     break;
-  case GDK_End:
+  case UKey_End:
     g_string_append(keystr, "end");
     break;
-  case GDK_Kanji:
-  case GDK_Zenkaku_Hankaku:
+  case UKey_Zenkaku_Hankaku:
     g_string_append(keystr, "zenkaku-hankaku");
     break;
-  case GDK_Multi_key:
+  case UKey_Multi_key:
     g_string_append(keystr, "Multi_key");
     break;
-  case GDK_Mode_switch:
+  case UKey_Mode_switch:
     g_string_append(keystr, "Mode_switch");
     break;
-  case GDK_Henkan_Mode:
+  case UKey_Henkan_Mode:
     g_string_append(keystr, "Henkan_Mode");
     break;
-  case GDK_Muhenkan:
+  case UKey_Muhenkan:
     g_string_append(keystr, "Muhenkan");
     break;
-  case GDK_Shift_L:
-  case GDK_Shift_R:
+  case UKey_Shift_key:
     g_string_append(keystr, "Shift_key");
     break;
-  case GDK_Control_L:
-  case GDK_Control_R:
+  case UKey_Control_key:
     g_string_append(keystr, "Control_key");
     break;
-  case GDK_Alt_L:
-  case GDK_Alt_R:
+  case UKey_Alt_key:
     g_string_append(keystr, "Alt_key");
     break;
-  case GDK_Meta_L:
-  case GDK_Meta_R:
+  case UKey_Meta_key:
     g_string_append(keystr, "Meta_key");
     break;
-  case GDK_Super_L:
-  case GDK_Super_R:
+  case UKey_Super_key:
     g_string_append(keystr, "Super_key");
     break;
-  case GDK_Hyper_L:
-  case GDK_Hyper_R:
+  case UKey_Hyper_key:
     g_string_append(keystr, "Hyper_key");
     break;
   default:
-    if (keyval >= GDK_F1 && keyval <= GDK_F35) {
-      g_string_append_printf(keystr, "F%d", keyval - GDK_F1 + 1);
-    } else if (keyval >= GDK_F1 && keyval <= GDK_F35) {
+    if (ukey >= UKey_F1 && ukey <= UKey_F35) {
+      g_string_append_printf(keystr, "F%d", ukey - UKey_F1 + 1);
+#if 0
+    } else if (keyval >= GDK_KP_0 && keyval <= GDK_KP_9) {
       g_string_append_printf(keystr, "%d", keyval - GDK_KP_0 + UKey_0);
-    } else if (keyval < 256) {
-      g_string_append_printf(keystr, "%c", keyval);
+#endif
+    } else if (ukey < 256) {
+      g_string_append_printf(keystr, "%c", ukey);
     } else {
       /* UKey_Other */
     }
@@ -1441,8 +1519,8 @@
 grab_win_key_press_cb (GtkWidget *widget, GdkEventKey *event,
 		       GtkEntry *key_entry)
 {
-  key_pref_win.grabbed_key_val   = event->keyval;
-  key_pref_win.grabbed_key_state = event->state;
+  im_uim_convert_keyevent(event, &key_pref_win.grabbed_key_val,
+				 &key_pref_win.grabbed_key_state);
 
   return TRUE;
 }
@@ -1454,6 +1532,9 @@
   key_pref_set_value(key_pref_win.grabbed_key_val,
 		     key_pref_win.grabbed_key_state);
 
+  im_uim_convert_keyevent(event, &key_pref_win.grabbed_key_val,
+				 &key_pref_win.grabbed_key_state);
+
   g_signal_handlers_disconnect_by_func(G_OBJECT(widget),
 				       (gpointer) grab_win_key_press_cb,
 				       key_entry);
@@ -1470,10 +1551,25 @@
 key_choose_entry_key_press_cb (GtkWidget *widget, GdkEventKey *event,
 			       GtkEntry *key_entry)
 {
-  key_pref_set_value(event->keyval, event->state);
+  int ukey, umod;
+
+  im_uim_convert_keyevent(event, &ukey, &umod);
+  key_pref_set_value(ukey, umod);
+
   return TRUE;
 }
 
+static gboolean
+key_choose_entry_key_release_cb (GtkWidget *widget, GdkEventKey *event,
+			       GtkEntry *key_entry)
+{
+  int ukey, umod;
+
+  im_uim_convert_keyevent(event, &ukey, &umod);
+
+  return TRUE;
+}
+
 static void
 choose_key_button_clicked_cb(GtkWidget *widget, GtkEntry *key_entry)
 {
@@ -1808,6 +1904,8 @@
 		   G_CALLBACK(key_val_entry_changed_cb), key_entry);
   g_signal_connect(G_OBJECT(entry), "key-press-event",
 		   G_CALLBACK(key_choose_entry_key_press_cb), key_entry);
+  g_signal_connect(G_OBJECT(entry), "key-release-event",
+		   G_CALLBACK(key_choose_entry_key_release_cb), key_entry);
   gtk_widget_show(entry);
 
   button = gtk_button_new_with_label(_("Grab..."));
@@ -1949,8 +2047,9 @@
     value->as_str = strdup(defval->as_str);
     break;
   case UCustom_Pathname:
-    free(value->as_pathname);
-    value->as_pathname = strdup(defval->as_pathname);
+    free(value->as_pathname->str);
+    value->as_pathname->str = strdup(defval->as_pathname->str);
+    value->as_pathname->type = defval->as_pathname->type;
     break;
   case UCustom_Choice:
     free(value->as_choice->symbol);

Modified: branches/r5rs/helper/pref-gtk-custom-widgets.h
===================================================================
--- branches/r5rs/helper/pref-gtk-custom-widgets.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/pref-gtk-custom-widgets.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -34,5 +34,33 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+G_BEGIN_DECLS
+
+#define UIMPREF_FILE_ENTRY_TYPE	(uimpref_file_entry_get_type())
+#define UIMPREF_FILE_ENTRY(obj)	(G_TYPE_CHECK_INSTANCE_CAST((obj), UIMPREF_FILE_ENTRY_TYPE, UimPrefFileEntry))
+#define UIMPREF_FILE_ENTRY_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), UIMPREF_FILE_ENTRY_TYPE, UimPrefFileEntryClass))
+#define IS_UIMPREF_FILE_ENTRY(obj)	(G_TYPE_CHECK_INSTANCE_TYPE((obj), UIMPREF_FILE_ENTRY_TYPE))
+#define IS_UIMPREF_FILE_ENTRY_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), UIMPREF_FILE_ENTRY_TYPE))
+
+typedef struct _UimPrefFileEntry	UimPrefFileEntry;
+typedef struct _UimPrefFileEntryClass	UimPrefFileEntryClass;
+
+struct _UimPrefFileEntryClass
+{
+  GtkEntryClass parent_class;
+};
+
+struct _UimPrefFileEntry
+{
+  GtkEntry entry;
+  int type;
+};
+
+GType uimpref_file_entry_get_type(void);
+GtkWidget *uimpref_file_entry_new(void);
+
+G_END_DECLS
+
+
 void uim_pref_gtk_add_custom(GtkWidget *vbox, const char *custom_sym);
 void uim_pref_gtk_set_default_value(GtkWidget *widget);

Modified: branches/r5rs/helper/pref-gtk.c
===================================================================
--- branches/r5rs/helper/pref-gtk.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/helper/pref-gtk.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -44,6 +44,7 @@
 #include "uim/uim-custom.h"
 #include "uim/gettext.h"
 #include "pref-gtk-custom-widgets.h"
+#include "../gtk/key-util-gtk.h"
 
 #define DEFAULT_WINDOW_WIDTH_MAX 800
 #define DEFAULT_WINDOW_HEIGHT_MAX 600
@@ -502,7 +503,7 @@
   gtk_container_add(GTK_CONTAINER(scrolled_win), create_pref_treeview());
 
   vbox = gtk_vbox_new(FALSE, 8);
-  gtk_container_set_border_width(vbox, 8);
+  gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
   gtk_box_pack_start(GTK_BOX(vbox), pref_hbox, TRUE, TRUE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), create_setting_button_box("dummy-group-name"), FALSE, TRUE, 0);
   gtk_container_add(GTK_CONTAINER(window), vbox);
@@ -582,8 +583,10 @@
   if (uim_custom_enable()) {
     GtkWidget *pref;
 
+    im_uim_init_modifier_keys();
+  
     gtk_idle_add((GtkFunction) check_dot_uim_file, NULL);
-  
+
     pref = create_pref_window();
 
     gtk_widget_show_all(pref);

Modified: branches/r5rs/po/fr.po
===================================================================
--- branches/r5rs/po/fr.po	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/po/fr.po	2006-01-23 17:38:44 UTC (rev 2987)
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: uim\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-16 16:23+0900\n"
+"POT-Creation-Date: 2006-01-24 02:22+0900\n"
 "PO-Revision-Date: 2005-02-21 15:52+0100\n"
 "Last-Translator: Thierry Vignaud <tvignaud at mandrakesoft.com>\n"
 "Language-Team: fr <LL at li.org>\n"
@@ -388,97 +388,99 @@
 msgid "line"
 msgstr "droite"
 
-#: helper/pref-gtk-custom-widgets.c:384
+#: helper/pref-gtk-custom-widgets.c:443
 msgid "Specify file"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:421
-msgid "File..."
+#: helper/pref-gtk-custom-widgets.c:491 helper/pref-gtk-custom-widgets.c:495
+#: qt/pref-customwidgets.cpp:181 qt/pref-customwidgets.cpp:185
+#, fuzzy
+msgid "Select..."
 msgstr "Fichier..."
 
-#: helper/pref-gtk-custom-widgets.c:1111
+#: helper/pref-gtk-custom-widgets.c:1188
 msgid "Enabled"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1137
+#: helper/pref-gtk-custom-widgets.c:1214
 msgid "Enabled items"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1215
+#: helper/pref-gtk-custom-widgets.c:1292
 msgid "Disabled"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1241
+#: helper/pref-gtk-custom-widgets.c:1318
 msgid "Disabled items"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1279 helper/pref-gtk-custom-widgets.c:1868
+#: helper/pref-gtk-custom-widgets.c:1356 helper/pref-gtk-custom-widgets.c:1966
 msgid "Edit..."
 msgstr "_Édition ..."
 
-#: helper/pref-gtk-custom-widgets.c:1487 qt/pref-customwidgets.cpp:853
+#: helper/pref-gtk-custom-widgets.c:1583 qt/pref-customwidgets.cpp:875
 msgid "Press keys to grab (e.g. <Control>a)"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1488
+#: helper/pref-gtk-custom-widgets.c:1584
 msgid "Grabbing keys"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1709
+#: helper/pref-gtk-custom-widgets.c:1805
 #, c-format
 msgid "%s - key configuration"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1746
+#: helper/pref-gtk-custom-widgets.c:1842
 msgid "Key preference"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1792
+#: helper/pref-gtk-custom-widgets.c:1888
 msgid "Key:"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1813
+#: helper/pref-gtk-custom-widgets.c:1911
 msgid "Grab..."
 msgstr ""
 
-#: helper/pref-gtk.c:144
+#: helper/pref-gtk.c:145
 msgid ""
 "Some value(s) have been changed.\n"
 "Save?"
 msgstr ""
 
-#: helper/pref-gtk.c:216 qt/pref-qt.cpp:263
+#: helper/pref-gtk.c:217 qt/pref-qt.cpp:263
 msgid ""
 "Some value(s) have been changed.\n"
 "Do you really quit this program?"
 msgstr ""
 
-#: helper/pref-gtk.c:255 qt/pref-qt.cpp:138
+#: helper/pref-gtk.c:256 qt/pref-qt.cpp:138
 msgid "Group"
 msgstr "Groupe"
 
 #. Defaults button
-#: helper/pref-gtk.c:347
+#: helper/pref-gtk.c:348
 msgid "_Defaults"
 msgstr ""
 
-#: helper/pref-gtk.c:352
+#: helper/pref-gtk.c:353
 msgid "Revert all changes to default"
 msgstr ""
 
-#: helper/pref-gtk.c:362
+#: helper/pref-gtk.c:363
 msgid "Apply all changes"
 msgstr ""
 
-#: helper/pref-gtk.c:370
+#: helper/pref-gtk.c:371
 msgid "Quit this application without applying changes"
 msgstr ""
 
-#: helper/pref-gtk.c:381
+#: helper/pref-gtk.c:382
 msgid "Quit this application with applying changes"
 msgstr ""
 
-#: helper/pref-gtk.c:530 qt/pref-qt.cpp:106
+#: helper/pref-gtk.c:531 qt/pref-qt.cpp:106
 msgid ""
 "The user customize file \"~/.uim\" is found.\n"
 "This file will override all conflicted settings set by\n"
@@ -533,15 +535,11 @@
 msgid "Unable to parse the geometry string '%s'"
 msgstr ""
 
-#: qt/pref-customwidgets.cpp:172
-msgid "File"
-msgstr "Fichier"
-
-#: qt/pref-customwidgets.cpp:324 qt/pref-customwidgets.cpp:606
+#: qt/pref-customwidgets.cpp:346 qt/pref-customwidgets.cpp:628
 msgid "Edit"
 msgstr "Édition"
 
-#: qt/pref-customwidgets.cpp:856
+#: qt/pref-customwidgets.cpp:878
 msgid "Key Grab Dialog"
 msgstr ""
 
@@ -670,12 +668,12 @@
 #: scm/im-custom.lisp:106 scm/im-custom.lisp:117 scm/im-custom.lisp:127
 #: scm/im-custom.lisp:229 scm/im-custom.lisp:286 scm/im-custom.lisp:292
 #: scm/im-custom.lisp:298 scm/im-custom.lisp:306 scm/im-custom.lisp:326
-#: scm/im-custom.lisp:342 scm/im-custom.lisp:348 scm/im-custom.lisp:355
-#: scm/im-custom.lisp:361 scm/im-custom.lisp:367 scm/im-custom.lisp:373
-#: scm/im-custom.lisp:379 scm/im-custom.lisp:385 scm/im-custom.lisp:391
-#: scm/im-custom.lisp:409 scm/im-custom.lisp:415 scm/im-custom.lisp:422
-#: scm/im-custom.lisp:432 scm/im-custom.lisp:436 scm/im-custom.lisp:442
-#: scm/im-custom.lisp:448 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
+#: scm/im-custom.lisp:347 scm/im-custom.lisp:353 scm/im-custom.lisp:360
+#: scm/im-custom.lisp:366 scm/im-custom.lisp:372 scm/im-custom.lisp:378
+#: scm/im-custom.lisp:384 scm/im-custom.lisp:390 scm/im-custom.lisp:396
+#: scm/im-custom.lisp:414 scm/im-custom.lisp:420 scm/im-custom.lisp:427
+#: scm/im-custom.lisp:437 scm/im-custom.lisp:441 scm/im-custom.lisp:447
+#: scm/im-custom.lisp:453 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
 #: scm/mana-custom.lisp:72 scm/mana-custom.lisp:78 scm/mana-custom.lisp:84
 #: scm/mana-custom.lisp:90 scm/mana-custom.lisp:173 scm/mana-custom.lisp:192
 #: scm/mana-custom.lisp:201 scm/mana-custom.lisp:243 scm/mana-custom.lisp:252
@@ -1432,19 +1430,19 @@
 msgid "[Canna] ESC keys on vi-cooperative mode"
 msgstr ""
 
-#: scm/custom.lisp:749
+#: scm/custom.lisp:756
 msgid "-"
 msgstr ""
 
-#: scm/custom.lisp:750
+#: scm/custom.lisp:757
 msgid "Main settings of this group"
 msgstr ""
 
-#: scm/custom.lisp:753
+#: scm/custom.lisp:760
 msgid "Hidden settings"
 msgstr ""
 
-#: scm/custom.lisp:754
+#: scm/custom.lisp:761
 msgid ""
 "Hidden settings of this group. This group is invisible from uim_custom "
 "clients. Exists for internal variable management."
@@ -1678,87 +1676,87 @@
 msgid "Preedit color"
 msgstr ""
 
-#: scm/im-custom.lisp:333 scm/im-custom.lisp:334
+#: scm/im-custom.lisp:338 scm/im-custom.lisp:339
 msgid "Adjacent to cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:336 scm/im-custom.lisp:337
+#: scm/im-custom.lisp:341 scm/im-custom.lisp:342
 msgid "Left end of preedit area"
 msgstr ""
 
-#: scm/im-custom.lisp:339 scm/im-custom.lisp:340
+#: scm/im-custom.lisp:344 scm/im-custom.lisp:345
 msgid "Right end of preedit area"
 msgstr ""
 
-#: scm/im-custom.lisp:341
+#: scm/im-custom.lisp:346
 msgid "Candidate window position"
 msgstr ""
 
-#: scm/im-custom.lisp:347
+#: scm/im-custom.lisp:352
 msgid "Enable lazy input method loading for fast startup"
 msgstr ""
 
-#: scm/im-custom.lisp:354
+#: scm/im-custom.lisp:359
 msgid "input method switcher"
 msgstr ""
 
-#: scm/im-custom.lisp:360
+#: scm/im-custom.lisp:365
 msgid "preference tool"
 msgstr ""
 
-#: scm/im-custom.lisp:366
+#: scm/im-custom.lisp:371
 msgid "Japanese dictionary tool"
 msgstr ""
 
-#: scm/im-custom.lisp:372
+#: scm/im-custom.lisp:377
 msgid "input pad"
 msgstr ""
 
-#: scm/im-custom.lisp:378
+#: scm/im-custom.lisp:383
 msgid "handwriting-input pad"
 msgstr ""
 
-#: scm/im-custom.lisp:384
+#: scm/im-custom.lisp:389
 msgid "help"
 msgstr "aide"
 
-#: scm/im-custom.lisp:390
+#: scm/im-custom.lisp:395
 msgid "Show input mode nearby cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:396
+#: scm/im-custom.lisp:401
 msgid "Time length for showing input mode nearby the cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:397
+#: scm/im-custom.lisp:402
 msgid "Set 0 to show indicator always."
 msgstr ""
 
-#: scm/im-custom.lisp:408
+#: scm/im-custom.lisp:413
 msgid "EB library"
 msgstr ""
 
-#: scm/im-custom.lisp:414
+#: scm/im-custom.lisp:419
 msgid "Use EB library to search annotations"
 msgstr ""
 
-#: scm/im-custom.lisp:421
+#: scm/im-custom.lisp:426
 msgid "The directory which contains EB dictionary file"
 msgstr ""
 
-#: scm/im-custom.lisp:431
+#: scm/im-custom.lisp:436
 msgid "XIM"
 msgstr ""
 
-#: scm/im-custom.lisp:435
+#: scm/im-custom.lisp:440
 msgid "Preedit settings of XIM"
 msgstr ""
 
-#: scm/im-custom.lisp:441
+#: scm/im-custom.lisp:446
 msgid "Use anti-aliased fonts for Over-the-Spot/Root-Window preedit"
 msgstr ""
 
-#: scm/im-custom.lisp:447
+#: scm/im-custom.lisp:452
 msgid "Font name for preedit area (anti-aliased)"
 msgstr ""
 
@@ -3062,3 +3060,6 @@
 #: uim/iso-639-1.def:185
 msgid "Zulu"
 msgstr "Zoulou"
+
+#~ msgid "File"
+#~ msgstr "Fichier"

Modified: branches/r5rs/po/ja.po
===================================================================
--- branches/r5rs/po/ja.po	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/po/ja.po	2006-01-23 17:38:44 UTC (rev 2987)
@@ -1,8 +1,9 @@
 # Japanese translations for uim package.
-# Copyright (C) 2003-2005, uim Developers.
+# Copyright (C) 2003-2006, uim Project.
 # This file is distributed under the same license as the uim package.
 # TOKUNAGA Hiroyuki <tkng at xem.jp>, 2004.
-# Daichi Kawahata <daichik at users.sourceforge.net>, 2005.
+# YamaKen <yamaken at bp.iij4u.or.jp>, 2005.
+# Daichi Kawahata <daichik at users.sourceforge.net>, 2005-2006.
 #
 # 諸規則:
 # - 意訳優先。原意が多少損われても気にしない
@@ -97,9 +98,9 @@
 msgstr ""
 "Project-Id-Version: uim 1.0.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-16 16:23+0900\n"
-"PO-Revision-Date: 2005-12-09 16:17+0900\n"
-"Last-Translator: Daichi Kawahata <daichik at users.sourceforge.net>\n"
+"POT-Creation-Date: 2006-01-24 02:22+0900\n"
+"PO-Revision-Date: 2006-01-24 02:25+0900\n"
+"Last-Translator: YamaKen <yamaken at bp.iij4u.or.jp>\n"
 "Language-Team: Japanese <translation-team-ja at lists.sourceforge.net>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -243,7 +244,6 @@
 msgid "Show popup menu"
 msgstr "ポップアップ・メニューを表示します"
 
-# FIXME: should be revised
 #: helper/dict-word-list-win-gtk.c:100
 msgid "_About"
 msgstr "このプログラムについて(_A)"
@@ -252,13 +252,14 @@
 msgid "About uim-dict"
 msgstr "uim-dict について"
 
+# NOTE: libanthydic.so を指す
 #: helper/dict-word-list-win-gtk.c:205
 msgid "Couldn't open a library for manipulating the dictionary.\n"
-msgstr ""
+msgstr "辞書を操作するライブラリを開けませんでした。\n"
 
 #: helper/dict-word-list-win-gtk.c:226
 msgid "Edit the dictionary"
-msgstr "辞書を編集します"
+msgstr "辞書の編集"
 
 #: helper/dict-word-list-win-gtk.c:280
 #, c-format
@@ -372,7 +373,6 @@
 msgid "_Frequency:"
 msgstr "頻度(_F):"
 
-# FIXME: should be revised
 #: helper/dict-word-win-gtk.c:349
 msgid "Part of Speech(_narrow):"
 msgstr "品詞(狭義)(_N):"
@@ -486,60 +486,61 @@
 msgid "line"
 msgstr "罫線"
 
-#: helper/pref-gtk-custom-widgets.c:384
+#: helper/pref-gtk-custom-widgets.c:443
 msgid "Specify file"
 msgstr "ファイルを指定して下さい"
 
-#: helper/pref-gtk-custom-widgets.c:421
-msgid "File..."
-msgstr "参照..."
+#: helper/pref-gtk-custom-widgets.c:491 helper/pref-gtk-custom-widgets.c:495
+#: qt/pref-customwidgets.cpp:181 qt/pref-customwidgets.cpp:185
+msgid "Select..."
+msgstr "選択..."
 
-#: helper/pref-gtk-custom-widgets.c:1111
+#: helper/pref-gtk-custom-widgets.c:1188
 msgid "Enabled"
 msgstr "有効"
 
-#: helper/pref-gtk-custom-widgets.c:1137
+#: helper/pref-gtk-custom-widgets.c:1214
 msgid "Enabled items"
 msgstr "有効なアイテム"
 
-#: helper/pref-gtk-custom-widgets.c:1215
+#: helper/pref-gtk-custom-widgets.c:1292
 msgid "Disabled"
 msgstr "無効"
 
-#: helper/pref-gtk-custom-widgets.c:1241
+#: helper/pref-gtk-custom-widgets.c:1318
 msgid "Disabled items"
 msgstr "無効なアイテム"
 
-#: helper/pref-gtk-custom-widgets.c:1279 helper/pref-gtk-custom-widgets.c:1868
+#: helper/pref-gtk-custom-widgets.c:1356 helper/pref-gtk-custom-widgets.c:1966
 msgid "Edit..."
 msgstr "編集..."
 
-#: helper/pref-gtk-custom-widgets.c:1487 qt/pref-customwidgets.cpp:853
+#: helper/pref-gtk-custom-widgets.c:1583 qt/pref-customwidgets.cpp:875
 msgid "Press keys to grab (e.g. <Control>a)"
 msgstr "割り当てるキーを押して下さい (例 <Control>a)"
 
-#: helper/pref-gtk-custom-widgets.c:1488
+#: helper/pref-gtk-custom-widgets.c:1584
 msgid "Grabbing keys"
 msgstr "キーを取得中"
 
-#: helper/pref-gtk-custom-widgets.c:1709
+#: helper/pref-gtk-custom-widgets.c:1805
 #, c-format
 msgid "%s - key configuration"
 msgstr "%s - キー設定"
 
-#: helper/pref-gtk-custom-widgets.c:1746
+#: helper/pref-gtk-custom-widgets.c:1842
 msgid "Key preference"
 msgstr "キー設定"
 
-#: helper/pref-gtk-custom-widgets.c:1792
+#: helper/pref-gtk-custom-widgets.c:1888
 msgid "Key:"
 msgstr "キー:"
 
-#: helper/pref-gtk-custom-widgets.c:1813
+#: helper/pref-gtk-custom-widgets.c:1911
 msgid "Grab..."
 msgstr "取得..."
 
-#: helper/pref-gtk.c:144
+#: helper/pref-gtk.c:145
 msgid ""
 "Some value(s) have been changed.\n"
 "Save?"
@@ -547,7 +548,7 @@
 "いくつかの値が変更されています。\n"
 "保存しますか?"
 
-#: helper/pref-gtk.c:216 qt/pref-qt.cpp:263
+#: helper/pref-gtk.c:217 qt/pref-qt.cpp:263
 msgid ""
 "Some value(s) have been changed.\n"
 "Do you really quit this program?"
@@ -555,32 +556,32 @@
 "いくつかの値が変更されています。\n"
 "本当に終了しますか?"
 
-#: helper/pref-gtk.c:255 qt/pref-qt.cpp:138
+#: helper/pref-gtk.c:256 qt/pref-qt.cpp:138
 msgid "Group"
 msgstr "グループ"
 
 #. Defaults button
-#: helper/pref-gtk.c:347
+#: helper/pref-gtk.c:348
 msgid "_Defaults"
 msgstr "標準(_D)"
 
-#: helper/pref-gtk.c:352
+#: helper/pref-gtk.c:353
 msgid "Revert all changes to default"
 msgstr "全ての変更を標準に戻す"
 
-#: helper/pref-gtk.c:362
+#: helper/pref-gtk.c:363
 msgid "Apply all changes"
 msgstr "全ての設定変更を適用"
 
-#: helper/pref-gtk.c:370
+#: helper/pref-gtk.c:371
 msgid "Quit this application without applying changes"
 msgstr "設定変更を適用せず終了"
 
-#: helper/pref-gtk.c:381
+#: helper/pref-gtk.c:382
 msgid "Quit this application with applying changes"
 msgstr "設定を保存して終了"
 
-#: helper/pref-gtk.c:530 qt/pref-qt.cpp:106
+#: helper/pref-gtk.c:531 qt/pref-qt.cpp:106
 msgid ""
 "The user customize file \"~/.uim\" is found.\n"
 "This file will override all conflicted settings set by\n"
@@ -641,15 +642,11 @@
 msgid "Unable to parse the geometry string '%s'"
 msgstr "ジオメトリ文字列 '%s' を解析できません"
 
-#: qt/pref-customwidgets.cpp:172
-msgid "File"
-msgstr "ファイル"
-
-#: qt/pref-customwidgets.cpp:324 qt/pref-customwidgets.cpp:606
+#: qt/pref-customwidgets.cpp:346 qt/pref-customwidgets.cpp:628
 msgid "Edit"
 msgstr "編集"
 
-#: qt/pref-customwidgets.cpp:856
+#: qt/pref-customwidgets.cpp:878
 msgid "Key Grab Dialog"
 msgstr "キー取得ダイアログ"
 
@@ -781,12 +778,12 @@
 #: scm/im-custom.lisp:106 scm/im-custom.lisp:117 scm/im-custom.lisp:127
 #: scm/im-custom.lisp:229 scm/im-custom.lisp:286 scm/im-custom.lisp:292
 #: scm/im-custom.lisp:298 scm/im-custom.lisp:306 scm/im-custom.lisp:326
-#: scm/im-custom.lisp:342 scm/im-custom.lisp:348 scm/im-custom.lisp:355
-#: scm/im-custom.lisp:361 scm/im-custom.lisp:367 scm/im-custom.lisp:373
-#: scm/im-custom.lisp:379 scm/im-custom.lisp:385 scm/im-custom.lisp:391
-#: scm/im-custom.lisp:409 scm/im-custom.lisp:415 scm/im-custom.lisp:422
-#: scm/im-custom.lisp:432 scm/im-custom.lisp:436 scm/im-custom.lisp:442
-#: scm/im-custom.lisp:448 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
+#: scm/im-custom.lisp:347 scm/im-custom.lisp:353 scm/im-custom.lisp:360
+#: scm/im-custom.lisp:366 scm/im-custom.lisp:372 scm/im-custom.lisp:378
+#: scm/im-custom.lisp:384 scm/im-custom.lisp:390 scm/im-custom.lisp:396
+#: scm/im-custom.lisp:414 scm/im-custom.lisp:420 scm/im-custom.lisp:427
+#: scm/im-custom.lisp:437 scm/im-custom.lisp:441 scm/im-custom.lisp:447
+#: scm/im-custom.lisp:453 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
 #: scm/mana-custom.lisp:72 scm/mana-custom.lisp:78 scm/mana-custom.lisp:84
 #: scm/mana-custom.lisp:90 scm/mana-custom.lisp:173 scm/mana-custom.lisp:192
 #: scm/mana-custom.lisp:201 scm/mana-custom.lisp:243 scm/mana-custom.lisp:252
@@ -1548,19 +1545,19 @@
 msgid "[Canna] ESC keys on vi-cooperative mode"
 msgstr "[Canna] vi協調モードでESCとして扱うキー"
 
-#: scm/custom.lisp:749
+#: scm/custom.lisp:756
 msgid "-"
 msgstr "-"
 
-#: scm/custom.lisp:750
+#: scm/custom.lisp:757
 msgid "Main settings of this group"
 msgstr "このグループのメイン設定"
 
-#: scm/custom.lisp:753
+#: scm/custom.lisp:760
 msgid "Hidden settings"
 msgstr "隠し設定"
 
-#: scm/custom.lisp:754
+#: scm/custom.lisp:761
 msgid ""
 "Hidden settings of this group. This group is invisible from uim_custom "
 "clients. Exists for internal variable management."
@@ -1796,89 +1793,89 @@
 msgid "Preedit color"
 msgstr "編集領域の配色"
 
-#: scm/im-custom.lisp:333 scm/im-custom.lisp:334
+#: scm/im-custom.lisp:338 scm/im-custom.lisp:339
 msgid "Adjacent to cursor"
 msgstr "カーソルに隣接"
 
-#: scm/im-custom.lisp:336 scm/im-custom.lisp:337
+#: scm/im-custom.lisp:341 scm/im-custom.lisp:342
 msgid "Left end of preedit area"
 msgstr "編集領域の左端"
 
-#: scm/im-custom.lisp:339 scm/im-custom.lisp:340
+#: scm/im-custom.lisp:344 scm/im-custom.lisp:345
 msgid "Right end of preedit area"
 msgstr "編集領域の右端"
 
 # 「候補ウィンドウの位置」では何を規定する位置なのか不明瞭な印象を受ける。具体例
 # が出たら追記する事 -- YamaKen 2005-12-07 
-#: scm/im-custom.lisp:341
+#: scm/im-custom.lisp:346
 msgid "Candidate window position"
 msgstr "候補ウィンドウの表示位置"
 
-#: scm/im-custom.lisp:347
+#: scm/im-custom.lisp:352
 msgid "Enable lazy input method loading for fast startup"
 msgstr "高速起動のための遅延ローディングを有効にする"
 
-#: scm/im-custom.lisp:354
+#: scm/im-custom.lisp:359
 msgid "input method switcher"
 msgstr "入力方式の切り換え"
 
-#: scm/im-custom.lisp:360
+#: scm/im-custom.lisp:365
 msgid "preference tool"
 msgstr "設定"
 
-#: scm/im-custom.lisp:366
+#: scm/im-custom.lisp:371
 msgid "Japanese dictionary tool"
 msgstr "日本語辞書ツール"
 
-#: scm/im-custom.lisp:372
+#: scm/im-custom.lisp:377
 msgid "input pad"
 msgstr "入力パッド"
 
-#: scm/im-custom.lisp:378
+#: scm/im-custom.lisp:383
 msgid "handwriting-input pad"
 msgstr "手書き入力パッド"
 
-#: scm/im-custom.lisp:384
+#: scm/im-custom.lisp:389
 msgid "help"
 msgstr "ヘルプ"
 
-#: scm/im-custom.lisp:390
+#: scm/im-custom.lisp:395
 msgid "Show input mode nearby cursor"
 msgstr "カーソルの側に入力モードを表示"
 
-#: scm/im-custom.lisp:396
+#: scm/im-custom.lisp:401
 msgid "Time length for showing input mode nearby the cursor"
 msgstr "カーソルの側に入力モードを表示する時間"
 
-#: scm/im-custom.lisp:397
+#: scm/im-custom.lisp:402
 msgid "Set 0 to show indicator always."
 msgstr "常にインジケーターを表示するなら 0 にして下さい。"
 
-#: scm/im-custom.lisp:408
+#: scm/im-custom.lisp:413
 msgid "EB library"
 msgstr "EBライブラリ"
 
-#: scm/im-custom.lisp:414
+#: scm/im-custom.lisp:419
 msgid "Use EB library to search annotations"
 msgstr "註釈の検索にEBライブラリを使用する"
 
-#: scm/im-custom.lisp:421
+#: scm/im-custom.lisp:426
 msgid "The directory which contains EB dictionary file"
 msgstr "EB辞書ファイルを格納しているディレクトリ"
 
-#: scm/im-custom.lisp:431
+#: scm/im-custom.lisp:436
 msgid "XIM"
 msgstr "XIM"
 
-#: scm/im-custom.lisp:435
+#: scm/im-custom.lisp:440
 msgid "Preedit settings of XIM"
 msgstr "XIMの編集領域"
 
-#: scm/im-custom.lisp:441
+#: scm/im-custom.lisp:446
 msgid "Use anti-aliased fonts for Over-the-Spot/Root-Window preedit"
 msgstr "編集領域のフォントにアンチエイリアスをかける"
 
-#: scm/im-custom.lisp:447
+#: scm/im-custom.lisp:452
 msgid "Font name for preedit area (anti-aliased)"
 msgstr "編集領域で使用されるフォント名 (アンチエイリアス時)"
 
@@ -3186,6 +3183,5 @@
 msgid "Zulu"
 msgstr "ズール語"
 
-# FIXME: should be revised
-#~ msgid "Show conjection class code column"
-#~ msgstr "接続詞のコード欄を表示"
+#~ msgid "File"
+#~ msgstr "ファイル"

Modified: branches/r5rs/po/ko.po
===================================================================
--- branches/r5rs/po/ko.po	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/po/ko.po	2006-01-23 17:38:44 UTC (rev 2987)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: uim 1.0.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-16 16:23+0900\n"
+"POT-Creation-Date: 2006-01-24 02:22+0900\n"
 "PO-Revision-Date: 2005-12-07 22:31+0900\n"
 "Last-Translator: Jae-hyeon Park <jhyeon at gmail.com>\n"
 "Language-Team: Korean <LL at li.org>\n"
@@ -389,60 +389,62 @@
 msgid "line"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:384
+#: helper/pref-gtk-custom-widgets.c:443
 msgid "Specify file"
 msgstr "파일을 지정하십시오"
 
-#: helper/pref-gtk-custom-widgets.c:421
-msgid "File..."
+#: helper/pref-gtk-custom-widgets.c:491 helper/pref-gtk-custom-widgets.c:495
+#: qt/pref-customwidgets.cpp:181 qt/pref-customwidgets.cpp:185
+#, fuzzy
+msgid "Select..."
 msgstr "파일..."
 
-#: helper/pref-gtk-custom-widgets.c:1111
+#: helper/pref-gtk-custom-widgets.c:1188
 msgid "Enabled"
 msgstr "유효"
 
-#: helper/pref-gtk-custom-widgets.c:1137
+#: helper/pref-gtk-custom-widgets.c:1214
 msgid "Enabled items"
 msgstr "유효한 항목"
 
-#: helper/pref-gtk-custom-widgets.c:1215
+#: helper/pref-gtk-custom-widgets.c:1292
 msgid "Disabled"
 msgstr "무효"
 
-#: helper/pref-gtk-custom-widgets.c:1241
+#: helper/pref-gtk-custom-widgets.c:1318
 msgid "Disabled items"
 msgstr "무효인 항목"
 
-#: helper/pref-gtk-custom-widgets.c:1279 helper/pref-gtk-custom-widgets.c:1868
+#: helper/pref-gtk-custom-widgets.c:1356 helper/pref-gtk-custom-widgets.c:1966
 msgid "Edit..."
 msgstr "편집..."
 
-#: helper/pref-gtk-custom-widgets.c:1487 qt/pref-customwidgets.cpp:853
+#: helper/pref-gtk-custom-widgets.c:1583 qt/pref-customwidgets.cpp:875
 msgid "Press keys to grab (e.g. <Control>a)"
 msgstr "잡을 키를 누르십시오 (예 <Control>a)"
 
-#: helper/pref-gtk-custom-widgets.c:1488
+#: helper/pref-gtk-custom-widgets.c:1584
 msgid "Grabbing keys"
 msgstr "키를 잡고 있는 중"
 
-#: helper/pref-gtk-custom-widgets.c:1709
+#: helper/pref-gtk-custom-widgets.c:1805
 #, c-format
 msgid "%s - key configuration"
 msgstr "%s - 키 설정"
 
-#: helper/pref-gtk-custom-widgets.c:1746
+#: helper/pref-gtk-custom-widgets.c:1842
 msgid "Key preference"
 msgstr "키 설정"
 
-#: helper/pref-gtk-custom-widgets.c:1792
+#: helper/pref-gtk-custom-widgets.c:1888
 msgid "Key:"
 msgstr "키:"
 
-#: helper/pref-gtk-custom-widgets.c:1813
+#: helper/pref-gtk-custom-widgets.c:1911
 msgid "Grab..."
 msgstr "잡기..."
 
-#: helper/pref-gtk.c:144
+#: helper/pref-gtk.c:145
 msgid ""
 "Some value(s) have been changed.\n"
 "Save?"
@@ -450,7 +452,7 @@
 "바뀐 내용이 있습니다.\n"
 "저장하시겠습니까?"
 
-#: helper/pref-gtk.c:216 qt/pref-qt.cpp:263
+#: helper/pref-gtk.c:217 qt/pref-qt.cpp:263
 msgid ""
 "Some value(s) have been changed.\n"
 "Do you really quit this program?"
@@ -458,32 +460,32 @@
 "바뀐 내용이 있습니다.\n"
 "정말로 종료하시겠습니까?"
 
-#: helper/pref-gtk.c:255 qt/pref-qt.cpp:138
+#: helper/pref-gtk.c:256 qt/pref-qt.cpp:138
 msgid "Group"
 msgstr "그룹"
 
 #. Defaults button
-#: helper/pref-gtk.c:347
+#: helper/pref-gtk.c:348
 msgid "_Defaults"
 msgstr "디폴트(_D)"
 
-#: helper/pref-gtk.c:352
+#: helper/pref-gtk.c:353
 msgid "Revert all changes to default"
 msgstr "모든 설정을 디폴트로"
 
-#: helper/pref-gtk.c:362
+#: helper/pref-gtk.c:363
 msgid "Apply all changes"
 msgstr "바뀐 설정을 모두 적용"
 
-#: helper/pref-gtk.c:370
+#: helper/pref-gtk.c:371
 msgid "Quit this application without applying changes"
 msgstr "바뀐 설정을 버리고 종료"
 
-#: helper/pref-gtk.c:381
+#: helper/pref-gtk.c:382
 msgid "Quit this application with applying changes"
 msgstr "바뀐 설정을 저장하고 종료"
 
-#: helper/pref-gtk.c:530 qt/pref-qt.cpp:106
+#: helper/pref-gtk.c:531 qt/pref-qt.cpp:106
 msgid ""
 "The user customize file \"~/.uim\" is found.\n"
 "This file will override all conflicted settings set by\n"
@@ -542,15 +544,11 @@
 msgid "Unable to parse the geometry string '%s'"
 msgstr ""
 
-#: qt/pref-customwidgets.cpp:172
-msgid "File"
-msgstr "파일"
-
-#: qt/pref-customwidgets.cpp:324 qt/pref-customwidgets.cpp:606
+#: qt/pref-customwidgets.cpp:346 qt/pref-customwidgets.cpp:628
 msgid "Edit"
 msgstr "편집"
 
-#: qt/pref-customwidgets.cpp:856
+#: qt/pref-customwidgets.cpp:878
 msgid "Key Grab Dialog"
 msgstr "키 잡기 대화창"
 
@@ -681,12 +679,12 @@
 #: scm/im-custom.lisp:106 scm/im-custom.lisp:117 scm/im-custom.lisp:127
 #: scm/im-custom.lisp:229 scm/im-custom.lisp:286 scm/im-custom.lisp:292
 #: scm/im-custom.lisp:298 scm/im-custom.lisp:306 scm/im-custom.lisp:326
-#: scm/im-custom.lisp:342 scm/im-custom.lisp:348 scm/im-custom.lisp:355
-#: scm/im-custom.lisp:361 scm/im-custom.lisp:367 scm/im-custom.lisp:373
-#: scm/im-custom.lisp:379 scm/im-custom.lisp:385 scm/im-custom.lisp:391
-#: scm/im-custom.lisp:409 scm/im-custom.lisp:415 scm/im-custom.lisp:422
-#: scm/im-custom.lisp:432 scm/im-custom.lisp:436 scm/im-custom.lisp:442
-#: scm/im-custom.lisp:448 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
+#: scm/im-custom.lisp:347 scm/im-custom.lisp:353 scm/im-custom.lisp:360
+#: scm/im-custom.lisp:366 scm/im-custom.lisp:372 scm/im-custom.lisp:378
+#: scm/im-custom.lisp:384 scm/im-custom.lisp:390 scm/im-custom.lisp:396
+#: scm/im-custom.lisp:414 scm/im-custom.lisp:420 scm/im-custom.lisp:427
+#: scm/im-custom.lisp:437 scm/im-custom.lisp:441 scm/im-custom.lisp:447
+#: scm/im-custom.lisp:453 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
 #: scm/mana-custom.lisp:72 scm/mana-custom.lisp:78 scm/mana-custom.lisp:84
 #: scm/mana-custom.lisp:90 scm/mana-custom.lisp:173 scm/mana-custom.lisp:192
 #: scm/mana-custom.lisp:201 scm/mana-custom.lisp:243 scm/mana-custom.lisp:252
@@ -1444,19 +1442,19 @@
 msgid "[Canna] ESC keys on vi-cooperative mode"
 msgstr ""
 
-#: scm/custom.lisp:749
+#: scm/custom.lisp:756
 msgid "-"
 msgstr ""
 
-#: scm/custom.lisp:750
+#: scm/custom.lisp:757
 msgid "Main settings of this group"
 msgstr ""
 
-#: scm/custom.lisp:753
+#: scm/custom.lisp:760
 msgid "Hidden settings"
 msgstr ""
 
-#: scm/custom.lisp:754
+#: scm/custom.lisp:761
 msgid ""
 "Hidden settings of this group. This group is invisible from uim_custom "
 "clients. Exists for internal variable management."
@@ -1690,87 +1688,87 @@
 msgid "Preedit color"
 msgstr "편집영역 색상"
 
-#: scm/im-custom.lisp:333 scm/im-custom.lisp:334
+#: scm/im-custom.lisp:338 scm/im-custom.lisp:339
 msgid "Adjacent to cursor"
 msgstr "커서 옆"
 
-#: scm/im-custom.lisp:336 scm/im-custom.lisp:337
+#: scm/im-custom.lisp:341 scm/im-custom.lisp:342
 msgid "Left end of preedit area"
 msgstr "편집영역의 왼쪽 끝"
 
-#: scm/im-custom.lisp:339 scm/im-custom.lisp:340
+#: scm/im-custom.lisp:344 scm/im-custom.lisp:345
 msgid "Right end of preedit area"
 msgstr "편집영역의 오른쪽 끝"
 
-#: scm/im-custom.lisp:341
+#: scm/im-custom.lisp:346
 msgid "Candidate window position"
 msgstr "후보 창의 위치"
 
-#: scm/im-custom.lisp:347
+#: scm/im-custom.lisp:352
 msgid "Enable lazy input method loading for fast startup"
 msgstr "빨리 시작하기 위해서 입력기 로드를 늦춤"
 
-#: scm/im-custom.lisp:354
+#: scm/im-custom.lisp:359
 msgid "input method switcher"
 msgstr "입력기 전환"
 
-#: scm/im-custom.lisp:360
+#: scm/im-custom.lisp:365
 msgid "preference tool"
 msgstr "설정"
 
-#: scm/im-custom.lisp:366
+#: scm/im-custom.lisp:371
 msgid "Japanese dictionary tool"
 msgstr "일본어 사전 도구"
 
-#: scm/im-custom.lisp:372
+#: scm/im-custom.lisp:377
 msgid "input pad"
 msgstr "입력 패드"
 
-#: scm/im-custom.lisp:378
+#: scm/im-custom.lisp:383
 msgid "handwriting-input pad"
 msgstr "손글씨 입력 패드"
 
-#: scm/im-custom.lisp:384
+#: scm/im-custom.lisp:389
 msgid "help"
 msgstr "도움말"
 
-#: scm/im-custom.lisp:390
+#: scm/im-custom.lisp:395
 msgid "Show input mode nearby cursor"
 msgstr "입력 모드를 커서 근처에 표시"
 
-#: scm/im-custom.lisp:396
+#: scm/im-custom.lisp:401
 msgid "Time length for showing input mode nearby the cursor"
 msgstr "커서 근처에 입력 모드를 표시하는 시간"
 
-#: scm/im-custom.lisp:397
+#: scm/im-custom.lisp:402
 msgid "Set 0 to show indicator always."
 msgstr "입력 모드를 항상 표시하려면 0으로 두십시오."
 
-#: scm/im-custom.lisp:408
+#: scm/im-custom.lisp:413
 msgid "EB library"
 msgstr ""
 
-#: scm/im-custom.lisp:414
+#: scm/im-custom.lisp:419
 msgid "Use EB library to search annotations"
 msgstr ""
 
-#: scm/im-custom.lisp:421
+#: scm/im-custom.lisp:426
 msgid "The directory which contains EB dictionary file"
 msgstr ""
 
-#: scm/im-custom.lisp:431
+#: scm/im-custom.lisp:436
 msgid "XIM"
 msgstr ""
 
-#: scm/im-custom.lisp:435
+#: scm/im-custom.lisp:440
 msgid "Preedit settings of XIM"
 msgstr "XIM 편집영역"
 
-#: scm/im-custom.lisp:441
+#: scm/im-custom.lisp:446
 msgid "Use anti-aliased fonts for Over-the-Spot/Root-Window preedit"
 msgstr ""
 
-#: scm/im-custom.lisp:447
+#: scm/im-custom.lisp:452
 msgid "Font name for preedit area (anti-aliased)"
 msgstr ""
 
@@ -3075,6 +3073,9 @@
 msgid "Zulu"
 msgstr ""
 
+#~ msgid "File"
+#~ msgstr "파일"
+
 #~ msgid ""
 #~ "The user customize file \"~/.uim\" is found.\n"
 #~ "This file will override all conflicted settings set by\n"

Modified: branches/r5rs/po/uim.pot
===================================================================
--- branches/r5rs/po/uim.pot	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/po/uim.pot	2006-01-23 17:38:44 UTC (rev 2987)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-16 16:23+0900\n"
+"POT-Creation-Date: 2006-01-24 02:22+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -389,97 +389,98 @@
 msgid "line"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:384
+#: helper/pref-gtk-custom-widgets.c:443
 msgid "Specify file"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:421
-msgid "File..."
+#: helper/pref-gtk-custom-widgets.c:491 helper/pref-gtk-custom-widgets.c:495
+#: qt/pref-customwidgets.cpp:181 qt/pref-customwidgets.cpp:185
+msgid "Select..."
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1111
+#: helper/pref-gtk-custom-widgets.c:1188
 msgid "Enabled"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1137
+#: helper/pref-gtk-custom-widgets.c:1214
 msgid "Enabled items"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1215
+#: helper/pref-gtk-custom-widgets.c:1292
 msgid "Disabled"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1241
+#: helper/pref-gtk-custom-widgets.c:1318
 msgid "Disabled items"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1279 helper/pref-gtk-custom-widgets.c:1868
+#: helper/pref-gtk-custom-widgets.c:1356 helper/pref-gtk-custom-widgets.c:1966
 msgid "Edit..."
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1487 qt/pref-customwidgets.cpp:853
+#: helper/pref-gtk-custom-widgets.c:1583 qt/pref-customwidgets.cpp:875
 msgid "Press keys to grab (e.g. <Control>a)"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1488
+#: helper/pref-gtk-custom-widgets.c:1584
 msgid "Grabbing keys"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1709
+#: helper/pref-gtk-custom-widgets.c:1805
 #, c-format
 msgid "%s - key configuration"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1746
+#: helper/pref-gtk-custom-widgets.c:1842
 msgid "Key preference"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1792
+#: helper/pref-gtk-custom-widgets.c:1888
 msgid "Key:"
 msgstr ""
 
-#: helper/pref-gtk-custom-widgets.c:1813
+#: helper/pref-gtk-custom-widgets.c:1911
 msgid "Grab..."
 msgstr ""
 
-#: helper/pref-gtk.c:144
+#: helper/pref-gtk.c:145
 msgid ""
 "Some value(s) have been changed.\n"
 "Save?"
 msgstr ""
 
-#: helper/pref-gtk.c:216 qt/pref-qt.cpp:263
+#: helper/pref-gtk.c:217 qt/pref-qt.cpp:263
 msgid ""
 "Some value(s) have been changed.\n"
 "Do you really quit this program?"
 msgstr ""
 
-#: helper/pref-gtk.c:255 qt/pref-qt.cpp:138
+#: helper/pref-gtk.c:256 qt/pref-qt.cpp:138
 msgid "Group"
 msgstr ""
 
 #. Defaults button
-#: helper/pref-gtk.c:347
+#: helper/pref-gtk.c:348
 msgid "_Defaults"
 msgstr ""
 
-#: helper/pref-gtk.c:352
+#: helper/pref-gtk.c:353
 msgid "Revert all changes to default"
 msgstr ""
 
-#: helper/pref-gtk.c:362
+#: helper/pref-gtk.c:363
 msgid "Apply all changes"
 msgstr ""
 
-#: helper/pref-gtk.c:370
+#: helper/pref-gtk.c:371
 msgid "Quit this application without applying changes"
 msgstr ""
 
-#: helper/pref-gtk.c:381
+#: helper/pref-gtk.c:382
 msgid "Quit this application with applying changes"
 msgstr ""
 
-#: helper/pref-gtk.c:530 qt/pref-qt.cpp:106
+#: helper/pref-gtk.c:531 qt/pref-qt.cpp:106
 msgid ""
 "The user customize file \"~/.uim\" is found.\n"
 "This file will override all conflicted settings set by\n"
@@ -534,15 +535,11 @@
 msgid "Unable to parse the geometry string '%s'"
 msgstr ""
 
-#: qt/pref-customwidgets.cpp:172
-msgid "File"
-msgstr ""
-
-#: qt/pref-customwidgets.cpp:324 qt/pref-customwidgets.cpp:606
+#: qt/pref-customwidgets.cpp:346 qt/pref-customwidgets.cpp:628
 msgid "Edit"
 msgstr ""
 
-#: qt/pref-customwidgets.cpp:856
+#: qt/pref-customwidgets.cpp:878
 msgid "Key Grab Dialog"
 msgstr ""
 
@@ -671,12 +668,12 @@
 #: scm/im-custom.lisp:106 scm/im-custom.lisp:117 scm/im-custom.lisp:127
 #: scm/im-custom.lisp:229 scm/im-custom.lisp:286 scm/im-custom.lisp:292
 #: scm/im-custom.lisp:298 scm/im-custom.lisp:306 scm/im-custom.lisp:326
-#: scm/im-custom.lisp:342 scm/im-custom.lisp:348 scm/im-custom.lisp:355
-#: scm/im-custom.lisp:361 scm/im-custom.lisp:367 scm/im-custom.lisp:373
-#: scm/im-custom.lisp:379 scm/im-custom.lisp:385 scm/im-custom.lisp:391
-#: scm/im-custom.lisp:409 scm/im-custom.lisp:415 scm/im-custom.lisp:422
-#: scm/im-custom.lisp:432 scm/im-custom.lisp:436 scm/im-custom.lisp:442
-#: scm/im-custom.lisp:448 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
+#: scm/im-custom.lisp:347 scm/im-custom.lisp:353 scm/im-custom.lisp:360
+#: scm/im-custom.lisp:366 scm/im-custom.lisp:372 scm/im-custom.lisp:378
+#: scm/im-custom.lisp:384 scm/im-custom.lisp:390 scm/im-custom.lisp:396
+#: scm/im-custom.lisp:414 scm/im-custom.lisp:420 scm/im-custom.lisp:427
+#: scm/im-custom.lisp:437 scm/im-custom.lisp:441 scm/im-custom.lisp:447
+#: scm/im-custom.lisp:453 scm/mana-custom.lisp:51 scm/mana-custom.lisp:57
 #: scm/mana-custom.lisp:72 scm/mana-custom.lisp:78 scm/mana-custom.lisp:84
 #: scm/mana-custom.lisp:90 scm/mana-custom.lisp:173 scm/mana-custom.lisp:192
 #: scm/mana-custom.lisp:201 scm/mana-custom.lisp:243 scm/mana-custom.lisp:252
@@ -1433,19 +1430,19 @@
 msgid "[Canna] ESC keys on vi-cooperative mode"
 msgstr ""
 
-#: scm/custom.lisp:749
+#: scm/custom.lisp:756
 msgid "-"
 msgstr ""
 
-#: scm/custom.lisp:750
+#: scm/custom.lisp:757
 msgid "Main settings of this group"
 msgstr ""
 
-#: scm/custom.lisp:753
+#: scm/custom.lisp:760
 msgid "Hidden settings"
 msgstr ""
 
-#: scm/custom.lisp:754
+#: scm/custom.lisp:761
 msgid ""
 "Hidden settings of this group. This group is invisible from uim_custom "
 "clients. Exists for internal variable management."
@@ -1679,87 +1676,87 @@
 msgid "Preedit color"
 msgstr ""
 
-#: scm/im-custom.lisp:333 scm/im-custom.lisp:334
+#: scm/im-custom.lisp:338 scm/im-custom.lisp:339
 msgid "Adjacent to cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:336 scm/im-custom.lisp:337
+#: scm/im-custom.lisp:341 scm/im-custom.lisp:342
 msgid "Left end of preedit area"
 msgstr ""
 
-#: scm/im-custom.lisp:339 scm/im-custom.lisp:340
+#: scm/im-custom.lisp:344 scm/im-custom.lisp:345
 msgid "Right end of preedit area"
 msgstr ""
 
-#: scm/im-custom.lisp:341
+#: scm/im-custom.lisp:346
 msgid "Candidate window position"
 msgstr ""
 
-#: scm/im-custom.lisp:347
+#: scm/im-custom.lisp:352
 msgid "Enable lazy input method loading for fast startup"
 msgstr ""
 
-#: scm/im-custom.lisp:354
+#: scm/im-custom.lisp:359
 msgid "input method switcher"
 msgstr ""
 
-#: scm/im-custom.lisp:360
+#: scm/im-custom.lisp:365
 msgid "preference tool"
 msgstr ""
 
-#: scm/im-custom.lisp:366
+#: scm/im-custom.lisp:371
 msgid "Japanese dictionary tool"
 msgstr ""
 
-#: scm/im-custom.lisp:372
+#: scm/im-custom.lisp:377
 msgid "input pad"
 msgstr ""
 
-#: scm/im-custom.lisp:378
+#: scm/im-custom.lisp:383
 msgid "handwriting-input pad"
 msgstr ""
 
-#: scm/im-custom.lisp:384
+#: scm/im-custom.lisp:389
 msgid "help"
 msgstr ""
 
-#: scm/im-custom.lisp:390
+#: scm/im-custom.lisp:395
 msgid "Show input mode nearby cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:396
+#: scm/im-custom.lisp:401
 msgid "Time length for showing input mode nearby the cursor"
 msgstr ""
 
-#: scm/im-custom.lisp:397
+#: scm/im-custom.lisp:402
 msgid "Set 0 to show indicator always."
 msgstr ""
 
-#: scm/im-custom.lisp:408
+#: scm/im-custom.lisp:413
 msgid "EB library"
 msgstr ""
 
-#: scm/im-custom.lisp:414
+#: scm/im-custom.lisp:419
 msgid "Use EB library to search annotations"
 msgstr ""
 
-#: scm/im-custom.lisp:421
+#: scm/im-custom.lisp:426
 msgid "The directory which contains EB dictionary file"
 msgstr ""
 
-#: scm/im-custom.lisp:431
+#: scm/im-custom.lisp:436
 msgid "XIM"
 msgstr ""
 
-#: scm/im-custom.lisp:435
+#: scm/im-custom.lisp:440
 msgid "Preedit settings of XIM"
 msgstr ""
 
-#: scm/im-custom.lisp:441
+#: scm/im-custom.lisp:446
 msgid "Use anti-aliased fonts for Over-the-Spot/Root-Window preedit"
 msgstr ""
 
-#: scm/im-custom.lisp:447
+#: scm/im-custom.lisp:452
 msgid "Font name for preedit area (anti-aliased)"
 msgstr ""
 

Modified: branches/r5rs/qt/pref-customwidgets.cpp
===================================================================
--- branches/r5rs/qt/pref-customwidgets.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/qt/pref-customwidgets.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -163,13 +163,29 @@
     : QHBox( parent, name ),
       UimCustomItemIface( c )
 {
+    const char *button;
+
     setSpacing( 3 );
     m_lineEdit = new QLineEdit( this );
     QObject::connect( m_lineEdit, SIGNAL(textChanged(const QString &)),
                       this, SLOT(slotCustomTextChanged(const QString &)) );
 
     m_fileButton = new QPushButton( this );
-    m_fileButton->setText( _("File") );
+    /* Since both pathname type opens the file dialog to select an item rather
+     * than open it, the label should always be "Select..." here.  The type is
+     * obvious for uses even if the button label does not indicate
+     * it. Information about the action the button causes is more important.
+     *   -- YamaKen 2006-01-21 */
+    switch (m_custom->value->as_pathname->type) {
+    case UCustomPathnameType_Directory:
+        button = N_( "Select..." );
+        break;
+    case UCustomPathnameType_RegularFile:
+    default:
+        button = N_( "Select..." );
+        break;
+    }
+    m_fileButton->setText( mygettext(button) );
     QObject::connect( m_fileButton, SIGNAL(clicked()),
                       this, SLOT(slotPathnameButtonClicked()) );
 
@@ -181,7 +197,7 @@
     if( !m_custom || m_custom->type != UCustom_Pathname )
         return;
 
-    m_lineEdit->setText( _FU8(m_custom->value->as_pathname) );
+    m_lineEdit->setText( _FU8(m_custom->value->as_pathname->str) );
 
     /* sync with Label */
     parentWidget()->setEnabled( m_custom->is_active );
@@ -189,8 +205,9 @@
 
 void CustomPathnameEdit::setDefault()
 {
-    free( m_custom->value->as_pathname );
-    m_custom->value->as_pathname = strdup( m_custom->default_value->as_pathname );
+    free( m_custom->value->as_pathname->str );
+    m_custom->value->as_pathname->str = strdup( m_custom->default_value->as_pathname->str );
+    m_custom->value->as_pathname->type = m_custom->default_value->as_pathname->type;
 
     setCustom( m_custom );
     update();
@@ -202,10 +219,15 @@
     QObject::connect( m_fileDialog, SIGNAL(filterSelected(const QString&)),
                       this, SLOT(slotFileDialogFilterSelected(const QString&)) );
 
-
-    m_fileDialog->setMode( QFileDialog::ExistingFile );
-    m_fileDialog->addFilter( "Directories" );
-    m_fileDialog->setSelectedFilter( "All Files (*)" );
+    switch (m_custom->value->as_pathname->type) {
+    case UCustomPathnameType_Directory:
+        m_fileDialog->setMode( QFileDialog::Directory );
+        break;
+    case UCustomPathnameType_RegularFile:
+    default:
+         m_fileDialog->setMode( QFileDialog::ExistingFile );
+         break;
+    }
     if ( m_fileDialog->exec() == QDialog::Accepted )
     {
         QString fileName = m_fileDialog->selectedFile();
@@ -218,8 +240,8 @@
 {
     Q_ASSERT( m_custom->type == UCustom_Pathname );
 
-    free( m_custom->value->as_pathname );
-    m_custom->value->as_pathname = strdup( (const char*)text.utf8() );
+    free( m_custom->value->as_pathname->str );
+    m_custom->value->as_pathname->str = strdup( (const char*)text.utf8() );
 
     setCustom( m_custom );
 }

Modified: branches/r5rs/qt/qtgettext.h
===================================================================
--- branches/r5rs/qt/qtgettext.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/qt/qtgettext.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -39,17 +39,20 @@
 /* NLS can be disabled through the configure --disable-nls option.  */
 #if ENABLE_NLS
 
+/* translation without being the tag for xgettext(1) */
+#define mygettext(String) QString::fromUtf8( dgettext(GETTEXT_PACKAGE,String) )
+
 /* undef original _(String) macro for handling encoding */
 #ifdef _
 #undef _
 #endif
-#define _(String) QString::fromUtf8( dgettext(GETTEXT_PACKAGE,String) )
+#define _(String) mygettext(String)
 /* undef original N_(String) macro for handling encoding */
 #ifdef N_
 #undef N_
 #endif
 #ifdef gettext_noop
-#define N_(String) QString::fromUtf8( gettext_noop(String) )
+#define N_(String) gettext_noop(String)
 #else
 #define N_(String) (String)
 #endif /* gettext_noop */

Modified: branches/r5rs/scm/byeoru.scm
===================================================================
--- branches/r5rs/scm/byeoru.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/byeoru.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -1253,19 +1253,31 @@
 (define (byeoru-init-handler id im arg)
   (byeoru-context-new id im))
 
+;; Test that the input is not control-purpose but graphical character.
+;;
+;; TODO:
+;; - rename appropriately in accordance with the intention in byeoru
+;; - move to appropriate place
+;; - CHECK: is this a right way to check shift-only?
+(define byeoru-graphic-key?
+  (let ((shift-or-no-modifier? (make-key-predicate '("<Shift>" ""))))
+    (lambda (key key-state)
+      (shift-or-no-modifier? -1 key-state))))
+
 (define (byeoru-key-to-candidates key key-state)
-  (let* ((layout (symbol-value byeoru-layout))
-	 (pressed-key
-	  (charcode->string
-	   ;; avoid case change due to caps lock.
-	   (if (shift-key-mask key-state)
-	       (char-upcase key) (char-downcase key))))
-	 (entry (assoc pressed-key layout)))
-    (and entry
-	 (let ((candidates (cdr entry)))
-	   (if (number? candidates)
-	       (ucs-to-utf8-string candidates)
-	       candidates)))))
+  (and (byeoru-graphic-key? key key-state)
+       (let* ((layout (symbol-value byeoru-layout))
+	      (pressed-key
+	       (charcode->string
+		;; avoid case change due to caps lock.
+		(if (shift-key-mask key-state)
+		    (char-upcase key) (char-downcase key))))
+	      (entry (assoc pressed-key layout)))
+	 (and entry
+	      (let ((candidates (cdr entry)))
+		(if (number? candidates)
+		    (ucs-to-utf8-string candidates)
+		    candidates))))))
 
 (define byeoru-dic-filename "byeoru-dic.scm")
 (define byeoru-load-dic-hook '())
@@ -1365,8 +1377,8 @@
 ;; romaja, not a jamo.
 (define (byeoru-feed-romaja-key bc key key-state)
   (and
-   (or (not (modifier-key-mask key-state))
-       (= key-state 1)) ; CHECK: is this a right way to check shift-only?
+   ; CHECK: is this a right way to check shift-only?
+   (byeoru-graphic-key? key key-state)
    (begin
 
      (define (flush-automata)
@@ -1450,9 +1462,7 @@
 
 (define (byeoru-feed-hangul-key bc key key-state)
   (let ((candidates (byeoru-key-to-candidates key key-state)))
-    (and (or (not (modifier-key-mask key-state))
-	     (= key-state 1)) ; CHECK: is this a right way?
-	 (list? candidates) (not (null? candidates))
+    (and (list? candidates) (not (null? candidates))
 	 ;; Why should I check the length of candidates?
 	 ;; Isn't scheme supposed to distinguish #f from an empty list?
 	 ;; -> fixed in sigscheme.

Modified: branches/r5rs/scm/custom-rt.scm
===================================================================
--- branches/r5rs/scm/custom-rt.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/custom-rt.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -113,7 +113,7 @@
       (let* ((post-groups (custom-list-primary-groups))
 	     (new-groups (list-tail post-groups (length pre-groups))))
 	(if (and (not (getenv "LIBUIM_VANILLA"))
-		 (not (is-set-ugid?)))
+		 (not (setugid?)))
 	    (for-each (lambda (gsym)
 			(custom-load-group-conf gsym)
 			(custom-update-group-conf-freshness gsym))
@@ -267,7 +267,7 @@
 (define custom-reload-user-configs
   (lambda ()
     (and (not (getenv "LIBUIM_VANILLA"))
-	 (not (is-set-ugid?))
+	 (not (setugid?))
 	 (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	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/custom.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -86,8 +86,10 @@
     (string? x)))
 
 (define custom-pathname?
-  (lambda (str)
-    (string? str)))
+  (lambda (str type)
+    (and (string? str)
+	 (symbol? type)
+	 (memq type '(regular-file directory)))))
 
 (define custom-valid-choice?
   (lambda arg
@@ -117,6 +119,10 @@
 			   (custom-exist? key 'key))))
 		key-repls))))
 
+(define custom-pathname-type
+  (lambda (custom-sym)
+    (car (custom-type-attrs custom-sym))))
+
 (define custom-expand-key-references
   (lambda (key)
     (cond
@@ -644,12 +650,13 @@
   (lambda (sym)
     (let* ((type (custom-type sym))
 	   (attrs (custom-type-attrs sym)))
-      (cond
-       ((or (eq? type 'choice)
-	    (eq? type 'ordered-list))
-	(map custom-choice-rec-sym attrs))
-       (else
-	attrs)))))
+      (case type
+	((choice ordered-list)
+	 (map custom-choice-rec-sym attrs))
+	((integer string)
+	 attrs)
+	(else
+	 ())))))
 
 ;; API
 (define custom-label

Modified: branches/r5rs/scm/im-custom.scm
===================================================================
--- branches/r5rs/scm/im-custom.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/im-custom.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -422,7 +422,7 @@
 (define-custom 'eb-dic-path
   (string-append (getenv "HOME") "/dict")
   '(eb candwin)
-  '(pathname)
+  '(pathname directory)
   (_ "The directory which contains EB dictionary file")
   (_ "long description will be here."))
 

Modified: branches/r5rs/scm/init.scm
===================================================================
--- branches/r5rs/scm/init.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/init.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -57,7 +57,7 @@
 
 (define load-user-conf
   (lambda ()
-    (if (is-set-ugid?)
+    (if (setugid?)
 	#f
 	(let ((orig-verbose (verbose))
 	      (file (or (getenv "LIBUIM_USER_SCM_FILE")

Modified: branches/r5rs/scm/plugin.scm
===================================================================
--- branches/r5rs/scm/plugin.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/plugin.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -35,7 +35,7 @@
 (require "util.scm")
 
 (define uim-plugin-lib-load-path
-   (if (is-set-ugid?)
+   (if (setugid?)
        (list (string-append (sys-pkglibdir) "/plugin"))
        (filter string?
  	      (append (list (getenv "LIBUIM_PLUGIN_LIB_DIR")
@@ -47,7 +47,7 @@
  			  ())))))
 
 (define uim-plugin-scm-load-path
-  (if (is-set-ugid?)
+  (if (setugid?)
       (list (sys-pkgdatadir))
       (filter string?
  	      (list (getenv "LIBUIM_SCM_FILES")
@@ -125,7 +125,7 @@
 	   (conf-file "installed-modules.scm")
 	   (user-conf-file (string-append user-module-dir conf-file)))
       (try-load conf-file)
-      (if (is-set-ugid?)
+      (if (setugid?)
 	  #f
 	  (if (not (getenv "LIBUIM_VANILLA"))
 	      (let ((orig-module-list installed-im-module-list)
@@ -144,6 +144,6 @@
 	   (file "loader.scm")
 	   (user-file (string-append user-module-dir file)))
       (and (try-load file)
-	   (or (and (not (is-set-ugid?))
+	   (or (and (not (setugid?))
 		    (try-load user-file))
 	       #t)))))

Modified: branches/r5rs/scm/skk-custom.scm
===================================================================
--- branches/r5rs/scm/skk-custom.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/skk-custom.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -341,21 +341,21 @@
 (define-custom 'skk-dic-file-name (string-append (sys-datadir)
 						 "/skk/SKK-JISYO.L")
   '(skk-dict)
-  '(pathname)
+  '(pathname regular-file)
   (_ "Dictionary file")
   (_ "long description will be here."))
 
 (define-custom 'skk-personal-dic-filename
   (string-append (getenv "HOME") "/.skk-jisyo")
   '(skk-dict)
-  '(pathname)
+  '(pathname regular-file)
   (_ "Personal dictionary file")
   (_ "long description will be here."))
 
 (define-custom 'skk-uim-personal-dic-filename
   (string-append (getenv "HOME") "/.skk-uim-jisyo")
   '(skk-dict)
-  '(pathname)
+  '(pathname regular-file)
   (_ "Personal dictionary file (dedicated to uim)")
   (_ "long description will be here."))
 

Modified: branches/r5rs/scm/skk.scm
===================================================================
--- branches/r5rs/scm/skk.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/scm/skk.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -336,13 +336,13 @@
 
 (define skk-read-personal-dictionary
   (lambda ()
-    (if (not (is-set-ugid?))
+    (if (not (setugid?))
 	(or (skk-lib-read-personal-dictionary skk-uim-personal-dic-filename)
 	    (skk-lib-read-personal-dictionary skk-personal-dic-filename)))))
 
 (define skk-save-personal-dictionary
   (lambda ()
-    (if (not (is-set-ugid?))
+    (if (not (setugid?))
 	(skk-lib-save-personal-dictionary skk-uim-personal-dic-filename))))
 
 (define skk-flush

Modified: branches/r5rs/test/test-custom.scm
===================================================================
--- branches/r5rs/test/test-custom.scm	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/test/test-custom.scm	2006-01-23 17:38:44 UTC (rev 2987)
@@ -29,7 +29,7 @@
 ;;; SUCH DAMAGE.
 ;;;;
 
-;; This file is tested with revision 1999 of new repository
+;; This file is tested with revision 2950 of new repository
 
 ;; TODO:
 ;;
@@ -117,18 +117,45 @@
    (assert-false (uim-bool '(custom-string? () ".*")))
    (assert-false (uim-bool '(custom-string? '(1 "2" 'three) ".*"))))
   ("test custom-pathname?"
-   (assert-false (uim-bool '(custom-pathname? #f)))
-   (assert-false (uim-bool '(custom-pathname? 'foo)))
-   (assert-false (uim-bool '(custom-pathname? -1)))
-   (assert-false (uim-bool '(custom-pathname? 0)))
-   (assert-false (uim-bool '(custom-pathname? 1)))
-   (assert-false (uim-bool '(custom-pathname? 10)))
-   (assert-false (uim-bool '(custom-pathname? ())))
-   (assert-false (uim-bool '(custom-pathname? '(1 "2" 'three))))
-   (assert-true  (uim-bool '(custom-pathname? "/usr/share/uim/foo.scm")))
-   (assert-true  (uim-bool '(custom-pathname? "~/.uim")))
-   (assert-true  (uim-bool '(custom-pathname? "share/uim/bar.scm")))
-   (assert-true  (uim-bool '(custom-pathname? "baz.scm"))))
+   (assert-error (lambda () (uim-bool '(custom-pathname?))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? #f))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? 'foo))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? -1))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? 0))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? 1))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? 10))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? ()))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? '(1 "2" 'three)))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? "/usr/share/uim/foo.scm"))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? "~/.uim"))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? "share/uim/bar.scm"))))
+   (assert-error (lambda () (uim-bool '(custom-pathname? "baz.scm"))))
+   (assert-false (uim-bool '(custom-pathname? #f 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? 'foo 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? -1 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? 0 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? 1 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? 10 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? () 'regular-file)))
+   (assert-false (uim-bool '(custom-pathname? '(1 "2" 'three) 'regular-file)))
+   ;; regular file
+   (assert-true  (uim-bool '(custom-pathname? "/usr/share/uim/foo.scm"
+					      'regular-file)))
+   (assert-true  (uim-bool '(custom-pathname? "~/.uim" 'regular-file)))
+   (assert-true  (uim-bool '(custom-pathname? "share/uim/bar.scm"
+					      'regular-file)))
+   (assert-true  (uim-bool '(custom-pathname? "baz.scm" 'regular-file)))
+   ;; directory
+   (assert-true  (uim-bool '(custom-pathname? "/usr/share/uim/" 'directory)))
+   (assert-true  (uim-bool '(custom-pathname? "~/" 'directory)))
+   (assert-true  (uim-bool '(custom-pathname? "/" 'directory)))
+   ;; current implementation does not validate the string form
+   (assert-true  (uim-bool '(custom-pathname? "/usr/share/uim/foo.scm"
+					      'directory)))
+   (assert-true  (uim-bool '(custom-pathname? "~/.uim" 'directory)))
+   (assert-true  (uim-bool '(custom-pathname? "share/uim/bar.scm"
+					      'directory)))
+   (assert-true  (uim-bool '(custom-pathname? "baz.scm" 'directory))))
   ("test custom-valid-choice?"
    (assert-false (uim-bool '(custom-valid-choice?
 			     #f
@@ -310,6 +337,29 @@
 		 (uim '(custom-expand-key-references
 			(custom-value 'test-baz-key))))))
 
+(define-uim-test-case "testcase custom custom-pathname"
+  (setup
+   (lambda ()
+     (uim '(require "custom.scm"))
+     (uim '(define-custom 'skk-dic-file-name (string-append (sys-datadir)
+							    "/skk/SKK-JISYO.L")
+	     '(global)
+	     '(pathname regular-file)
+	     (_ "Dictionary file")
+	     (_ "long description will be here.")))
+     (uim '(define-custom 'eb-dic-path
+	     (string-append (getenv "HOME") "/dict")
+	     '(global)
+	     '(pathname directory)
+	     (_ "The directory which contains EB dictionary file")
+	     (_ "long description will be here.")))))
+
+  ("test custom-pathname-type"
+   (assert-equal 'regular-file
+		 (uim '(custom-pathname-type 'skk-dic-file-name)))
+   (assert-equal 'directory
+		 (uim '(custom-pathname-type 'eb-dic-path)))))
+
 (define-uim-test-case "testcase custom custom-choice"
   (setup
    (lambda ()
@@ -471,21 +521,21 @@
 	     (define-custom 'skk-dic-file-name (string-append (sys-datadir)
 							      "/skk/SKK-JISYO.L")
 	       '(skk)
-	       '(pathname)
+	       '(pathname regular-file)
 	       (_ "Dictionary file")
 	       (_ "long description will be here."))
 
 	     (define-custom 'skk-personal-dic-filename
 	       (string-append (getenv "HOME") "/.skk-jisyo")
 	       '(skk)
-	       '(pathname)
+	       '(pathname regular-file)
 	       (_ "Personal dictionary file")
 	       (_ "long description will be here."))
 
 	     (define-custom 'skk-uim-personal-dic-filename
 	       (string-append (getenv "HOME") "/.skk-uim-jisyo")
 	       '(skk)
-	       '(pathname)
+	       '(pathname regular-file)
 	       (_ "Personal dictionary file (dedicated to uim)")
 	       (_ "long description will be here."))
 
@@ -1668,7 +1718,7 @@
 	     "long description will be here."))
      (uim '(define-custom 'test-dic-file-name "/usr/share/skk/SKK-JISYO.L"
 	     '(test)
-	     '(pathname)
+	     '(pathname regular-file)
 	     "Dictionary file"
 	     "long description will be here."))
      (uim '(define-custom 'test-modelist 'hiragana
@@ -1852,8 +1902,9 @@
    (assert-equal "/usr/share/skk/SKK-JISYO.L"
 		 (uim '(custom-value 'test-dic-file-name)))
    ;; valid value
-   (assert-true  (uim-bool '(custom-set-value! 'test-dic-file-name
-					 "/usr/local/share/skk/SKK-JISYO.ML")))
+   (assert-true  (uim-bool '(custom-set-value!
+			     'test-dic-file-name
+			     "/usr/local/share/skk/SKK-JISYO.ML")))
    (assert-equal "/usr/local/share/skk/SKK-JISYO.ML"
 		 (uim '(custom-value 'test-dic-file-name)))
    ;; invalid value is ignored
@@ -2100,7 +2151,7 @@
 		 (uim '(custom-type-attrs 'test-nr-candidate-max)))
    (assert-equal '(".+")
 		 (uim '(custom-type-attrs 'test-string)))
-   (assert-equal ()
+   (assert-equal '(regular-file)
 		 (uim '(custom-type-attrs 'test-dic-file-name))))
 
   ("test custom-range"

Modified: branches/r5rs/uim/libtool-version.mk
===================================================================
--- branches/r5rs/uim/libtool-version.mk	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/libtool-version.mk	2006-01-23 17:38:44 UTC (rev 2987)
@@ -1,5 +1,5 @@
 # The versions consists of CURRENT:REVISION:AGE to indicate ABI information.
 # See "Versioning" section of info of libtool for each meaning.
 
-libuim_version = 1:0:1
-libuim_custom_version = 1:0:1
+libuim_version = 1:1:1
+libuim_custom_version = 2:0:0

Modified: branches/r5rs/uim/prime.c
===================================================================
--- branches/r5rs/uim/prime.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/prime.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -57,7 +57,7 @@
 static char *prime_command = "prime";
 static char *prime_ud_path;
 static int prime_fd;
-static int use_unix_domain_socket;
+static uim_bool use_unix_domain_socket;
 
 static int
 prime_init_ud(char *path)
@@ -195,13 +195,10 @@
 prime_lib_init(uim_lisp use_udp_)
 {
   char *option;
-  uim_bool use_udp = uim_scm_c_bool(use_udp_);
-  if (use_udp == UIM_TRUE)
-    use_unix_domain_socket = UIM_TRUE;
-  else
-    use_unix_domain_socket = UIM_FALSE;
 
-  if (use_unix_domain_socket == UIM_TRUE) {
+  use_unix_domain_socket = uim_scm_c_bool(use_udp_);
+
+  if (use_unix_domain_socket) {
     prime_ud_path = prime_get_ud_path();
     if (!prime_ud_path)
       return uim_scm_f();

Modified: branches/r5rs/uim/uim-custom.c
===================================================================
--- branches/r5rs/uim/uim-custom.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-custom.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -93,6 +93,9 @@
 static char *uim_custom_label(const char *custom_sym);
 static char *uim_custom_desc(const char *custom_sym);
 
+static struct uim_custom_pathname *uim_custom_pathname_get(const char *custom_sym, const char *getter_proc);
+static struct uim_custom_pathname *uim_custom_pathname_new(char *str, int type);
+static void uim_custom_pathname_free(struct uim_custom_pathname *custom_pathname);
 static struct uim_custom_choice *uim_custom_choice_get(const char *custom_sym, const char *choice_sym);
 static char *extract_choice_symbol(const struct uim_custom_choice *custom_choice);
 static char *choice_list_to_str(const struct uim_custom_choice *const *list, const char *sep);
@@ -279,6 +282,58 @@
   return uim_custom_get_str(custom_sym, "custom-desc");
 }
 
+/* pathname */
+static struct uim_custom_pathname *
+uim_custom_pathname_get(const char *custom_sym, const char *getter_proc)
+{
+  struct uim_custom_pathname *custom_pathname;
+  char *str, *type_sym;
+  int type;
+
+  UIM_EVAL_FSTRING2(NULL, "(%s '%s)", getter_proc, custom_sym);
+  return_val = uim_scm_return_value();
+  str = uim_scm_c_str(return_val);
+
+  UIM_EVAL_FSTRING1(NULL, "(custom-pathname-type '%s)", custom_sym);
+  return_val = uim_scm_return_value();
+  type_sym = uim_scm_c_symbol(return_val);
+  if (strcmp(type_sym, "directory") == 0)
+    type = UCustomPathnameType_Directory;
+  else
+    type = UCustomPathnameType_RegularFile;
+  free(type_sym);
+
+  custom_pathname = uim_custom_pathname_new(str, type);
+  if (!custom_pathname)
+    return NULL;
+
+  return custom_pathname;
+}
+
+static struct uim_custom_pathname *
+uim_custom_pathname_new(char *str, int type)
+{
+  struct uim_custom_pathname *custom_pathname;
+
+  custom_pathname = malloc(sizeof(struct uim_custom_pathname));
+  if (!custom_pathname)
+    return NULL;
+
+  custom_pathname->str = str;
+  custom_pathname->type = type;
+
+  return custom_pathname;
+}
+
+static void
+uim_custom_pathname_free(struct uim_custom_pathname *custom_pathname)
+{
+  if (!custom_pathname)
+    return;
+
+  free(custom_pathname->str);
+}
+
 /* choice */
 static struct uim_custom_choice *
 uim_custom_choice_get(const char *custom_sym, const char *choice_sym)
@@ -568,7 +623,7 @@
     value->as_str = uim_scm_c_str(return_val);
     break;
   case UCustom_Pathname:
-    value->as_pathname = uim_scm_c_str(return_val);
+    value->as_pathname = uim_custom_pathname_get(custom_sym, getter_proc);
     break;
   case UCustom_Choice:
     custom_value_symbol = uim_scm_c_symbol(return_val);
@@ -611,7 +666,7 @@
     free(custom_value->as_str);
     break;
   case UCustom_Pathname:
-    free(custom_value->as_pathname);
+    uim_custom_pathname_free(custom_value->as_pathname);
     break;
   case UCustom_Choice:
     uim_custom_choice_free(custom_value->as_choice);
@@ -1155,7 +1210,7 @@
     free(literal);
     break;
   case UCustom_Pathname:
-    literal = literalize_string(custom->value->as_pathname);
+    literal = literalize_string(custom->value->as_pathname->str);
     UIM_EVAL_FSTRING2(NULL, "(custom-set-value! '%s %s)",
 		      custom->symbol, literal);
     free(literal);

Modified: branches/r5rs/uim/uim-custom.h
===================================================================
--- branches/r5rs/uim/uim-custom.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-custom.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -51,6 +51,11 @@
   UCustom_Key
 };
 
+enum UCustomPathnameType {
+  UCustomPathnameType_RegularFile,
+  UCustomPathnameType_Directory
+};
+
 enum UCustomKeyType {
   UCustomKey_Regular,   /* "<Control>j" */
   UCustomKey_Reference  /* "generic-cancel-key" */
@@ -65,12 +70,17 @@
   int as_bool;
   int as_int;
   char *as_str;
-  char *as_pathname;
+  struct uim_custom_pathname *as_pathname;
   struct uim_custom_choice *as_choice;
   struct uim_custom_choice **as_olist;
   struct uim_custom_key **as_key;
 };
 
+struct uim_custom_pathname {
+  char *str;
+  int type;   /* UCustomPathnameType */
+};
+
 struct uim_custom_choice {
   char *symbol;
   char *label;

Modified: branches/r5rs/uim/uim-helper.c
===================================================================
--- branches/r5rs/uim/uim-helper.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-helper.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -127,7 +127,7 @@
   char *login = NULL;
   struct passwd *pw = NULL;
  
-  if (is_setugid() == 0) {
+  if (!uim_issetugid()) {
     login = getenv("LOGNAME");
   }
 
@@ -210,27 +210,23 @@
   return NULL;
 }
 
-/* Interface function for is_setugid. */
+/* Public API for uim_issetugid(). */
+/* TODO: should be renamed to uim_helper_issetugid() */
 uim_bool
 uim_helper_is_setugid(void)
 {
-  if(is_setugid() != 0) {
-    return UIM_TRUE;
-  } else {
-    return UIM_FALSE;
-  }
+  return (uim_issetugid()) ? UIM_TRUE : UIM_FALSE;
 }
 
-int
-is_setugid(void)
+/* For internal use only. libuim clients should use uim_helper_is_setugid()
+ * since this is not a core uim function. */
+uim_bool
+uim_issetugid(void)
 {
   uid_t ruid = getuid();  /* real uid */
   gid_t rgid = getgid();  /* real gid */
   uid_t euid = geteuid(); /* effective uid */
   gid_t egid = getegid(); /* effective gid */
 
-  if (ruid != euid || rgid != egid) {
-    return 1;
-  }
-  return 0;
+  return (ruid != euid || rgid != egid);
 }

Modified: branches/r5rs/uim/uim-internal.h
===================================================================
--- branches/r5rs/uim/uim-internal.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-internal.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -282,6 +282,8 @@
 void uim_release_preedit_segments(uim_context uc);
 void uim_update_preedit_segments(uim_context uc);
 
+uim_bool uim_issetugid(void);
+
 extern struct uim_im *uim_im_array;
 extern int uim_nr_im;
 extern char *uim_last_client_encoding;

Modified: branches/r5rs/uim/uim-ipc.c
===================================================================
--- branches/r5rs/uim/uim-ipc.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-ipc.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -193,7 +193,7 @@
       }
       *ap = NULL;
     }
-    if (is_setugid() != 0) {
+    if (uim_issetugid()) {
       int cmd_len = strlen(command) + 30;
       char *fullpath_command = malloc(cmd_len);
       char *cmd_name = strrchr(command, '/');

Modified: branches/r5rs/uim/uim-util.c
===================================================================
--- branches/r5rs/uim/uim-util.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-util.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -615,9 +615,9 @@
 }
 
 static uim_lisp
-is_setugidp(void)
+setugidp(void)
 {
-  if (is_setugid()) {
+  if (uim_issetugid()) {
     return uim_scm_t();
   }
   return uim_scm_f();
@@ -731,6 +731,6 @@
   uim_scm_init_subr_3("iterate-lists", iterate_lists);
   uim_scm_init_subr_2("find-tail", find_tail);
   uim_scm_init_subr_1("lang-code->lang-name-raw", lang_code_to_lang_name_raw);
-  uim_scm_init_subr_0("is-set-ugid?", is_setugidp);
+  uim_scm_init_subr_0("setugid?", setugidp);
   uim_scm_init_subr_1("string-escape", string_escape);
 }

Modified: branches/r5rs/uim/uim-util.h
===================================================================
--- branches/r5rs/uim/uim-util.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim-util.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -55,9 +55,6 @@
 const char *
 uim_get_language_code_from_language_name(const char *language_name);
 
-int
-is_setugid(void);
-
 /* uim's iconv_open wrapper */
 void *uim_iconv_open(const char *tocode, const char *fromcode);
 

Modified: branches/r5rs/uim/uim.c
===================================================================
--- branches/r5rs/uim/uim.c	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim.c	2006-01-23 17:38:44 UTC (rev 2987)
@@ -643,7 +643,7 @@
   char *scm_files = NULL;
   char *env = NULL;
 
-  /*  if (is_setugid() == 0) {*/
+  /*  if (!uim_issetugid()) {*/
     env = getenv("LIBUIM_VERBOSE");
     /*  }*/
   uim_scm_init(env);  /* init Scheme interpreter */
@@ -657,7 +657,7 @@
   uim_init_im_subrs();
   uim_init_key_subrs();
   
-  if (is_setugid() == 0) {
+  if (!uim_issetugid()) {
     scm_files = getenv("LIBUIM_SCM_FILES");
   }
   uim_scm_set_lib_path((scm_files) ? scm_files : SCM_FILES);

Modified: branches/r5rs/uim/uim.h
===================================================================
--- branches/r5rs/uim/uim.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/uim/uim.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -42,9 +42,13 @@
 #include <stdio.h>
 
 /*
- * A boolean type for uim to explicitly indicate intention about values.  A
- * true value is represented as (val != UIM_FALSE). i.e. Don't test a value
- * with (val == UIM_TRUE).
+ * A boolean type for uim to explicitly indicate intention about values
+ *
+ *                           *** IMPORTANT ***
+ *
+ * Do not test a value with (val == UIM_TRUE). The UIM_TRUE is only A TYPICAL
+ * VALUE FOR TRUE. Use (val) or (val != UIM_FALSE) instead.
+ *
  */
 typedef int uim_bool;
 

Modified: branches/r5rs/xim/canddisp.cpp
===================================================================
--- branches/r5rs/xim/canddisp.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/canddisp.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -30,7 +30,9 @@
   SUCH DAMAGE.
 */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+#endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -66,7 +68,7 @@
 static int candwin_pid;
 static Canddisp *disp;
 static const char *command;
-static bool candwin_inited = false;
+static bool candwin_initted = false;
 
 static void candwin_read_cb(int fd, int ev);
 
@@ -106,7 +108,7 @@
     if (!command)
 	command = candwin_command();
 
-    if (!candwin_inited && command) {
+    if (!candwin_initted && command) {
 	candwin_pid = uim_ipc_open_command(candwin_pid, &candwin_r, &candwin_w, command);
 	if (disp)
 	    delete disp;
@@ -120,7 +122,7 @@
 		    add_fd_watch(fd, READ_OK, candwin_read_cb);
 	    }
 	}
-	candwin_inited = true;
+	candwin_initted = true;
     }
     return disp;
 }
@@ -141,7 +143,7 @@
 
     fprintf(candwin_w, "activate\ncharset=UTF-8\ndisplay_limit=%d\n",
 		    display_limit);
-    for (i = candidates.begin(); i != candidates.end(); i++)
+    for (i = candidates.begin(); i != candidates.end(); ++i)
 	fprintf(candwin_w, "%s\n", *i);
     fprintf(candwin_w, "\n");
     fflush(candwin_w);
@@ -233,7 +235,7 @@
 	terminate_canddisp_connection();
 }
 
-static void candwin_read_cb(int fd, int ev)
+static void candwin_read_cb(int fd, int /* ev */)
 {
     char buf[1024];
     int n;
@@ -291,6 +293,6 @@
     }
 
     candwin_w = candwin_r = NULL;
-    candwin_inited = false;
+    candwin_initted = false;
     return;
 }

Modified: branches/r5rs/xim/connection.cpp
===================================================================
--- branches/r5rs/xim/connection.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/connection.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -93,7 +93,7 @@
 reapOldConnection()
 {
     std::map<Window, XConnection *>::iterator it;
-    for (it = gXConnections.begin(); it != gXConnections.end(); it++) {
+    for (it = gXConnections.begin(); it != gXConnections.end(); ++it) {
 	XConnection *xc = (*it).second;
 	if (!xc->isValid()) {
 	    delete xc;
@@ -150,7 +150,7 @@
     free(mBuf.buf);
 }
 
-void XConnection::destroy(Window w)
+void XConnection::destroy(Window /* w */)
 {
     if (mIsValid)
 	OnClose();
@@ -256,7 +256,7 @@
     bool sent_preedit_done = false;
     int major;
 
-    while (mPendingTxQ.size()) {
+    while (!mPendingTxQ.empty()) {
 	if (hasSyncFlag() || hasPreeditStartSyncFlag() ||
 			hasPreeditCaretSyncFlag())
 	    break;
@@ -291,7 +291,7 @@
 	    // push first XIM_COMMIT into the head of the queue
 	    std::list<TxPacket *> tmp;
 	    bool first = true;
-	    while (mPendingTxQ.size()) {
+	    while (!mPendingTxQ.empty()) {
 		j = mPendingTxQ.begin();
 		major = (*j)->get_major();
 		if (major == XIM_COMMIT && first == true) {
@@ -314,8 +314,8 @@
     bool sent_preedit_done = false;
     int major;
 
-    while (mPTxQ.size()) {
-	if (mPendingTxQ.size())
+    while (!mPTxQ.empty()) {
+	if (!mPendingTxQ.empty())
 	    break;
 
 	i = mPTxQ.begin();
@@ -355,7 +355,7 @@
 	    // push first XIM_COMMIT into the head of passive queue
 	    std::list<TxPacket *> tmp;
 	    bool first = true;
-	    while (mPTxQ.size()) {
+	    while (!mPTxQ.empty()) {
 		j = mPTxQ.begin();
 		major = (*j)->get_major();
 		if (major == XIM_COMMIT && first == true) {
@@ -377,7 +377,7 @@
     std::list<TxPacket *>::iterator i;
     int major;
 
-    while (mTxQ.size()) {
+    while (!mTxQ.empty()) {
 	i = mTxQ.begin();
 	major = (*i)->get_major();
 	if (major == XIM_FORWARD_EVENT) {

Modified: branches/r5rs/xim/convdisp.cpp
===================================================================
--- branches/r5rs/xim/convdisp.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/convdisp.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -676,7 +676,7 @@
     mCursorX = m_x;
     mCharPos = 0;
     std::list<pe_ustring>::iterator i;
-    for (i = p->ustrings.begin(); i != p->ustrings.end(); i++) {
+    for (i = p->ustrings.begin(); i != p->ustrings.end(); ++i) {
 	draw_segment(&(*i));
     }
     draw_cursor();
@@ -733,7 +733,7 @@
     uString::iterator i;
     int caret_pos = mConvdisp->get_caret_pos();
 
-    for (i = s->s.begin(); i != s->s.end(); i++) {
+    for (i = s->s.begin(); i != s->s.end(); ++i) {
 	uchar ch = *i;
 	int width = get_char_width(ch);
 	draw_char(m_x, PE_LINE_WIN_FONT_POS_Y, ch, s->stat);
@@ -768,7 +768,7 @@
     int width = 0;
     uString::iterator i;
 
-    for (i = s->s.begin(); i != s->s.end(); i++) {
+    for (i = s->s.begin(); i != s->s.end(); ++i) {
 	uchar ch = *i;
 	width += get_char_width(ch);
     }
@@ -780,7 +780,7 @@
     int width = 0;
     std::list<pe_ustring>::iterator i;
 
-    for (i = p->ustrings.begin(); i != p->ustrings.end(); i++)
+    for (i = p->ustrings.begin(); i != p->ustrings.end(); ++i)
 	width += calc_segment_extent(&(*i));	
 
     if (width < PE_LINE_WIN_WIDTH)
@@ -921,7 +921,7 @@
 {
     uString s;
     std::list<pe_ustring>::iterator it;
-    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); it++) {
+    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); ++it) {
 	append_ustring(&s, &(*it).s);
     }
     return s;
@@ -1395,9 +1395,9 @@
     uString::iterator j;
     int s;
     int c = 0;
-    for (i = m_pe->ustrings.begin(); i != m_pe->ustrings.end(); i++) {
+    for (i = m_pe->ustrings.begin(); i != m_pe->ustrings.end(); ++i) {
 	s = (*i).stat;
-	for (j = (*i).s.begin(); j != (*i).s.end(); j++) {
+	for (j = (*i).s.begin(); j != (*i).s.end(); ++j) {
 	    m_ce[c].c = *j;
 	    m_ce[c].stat = s;
 	    c++;
@@ -1552,7 +1552,7 @@
     t->pushC32(0); // chg_first
     t->pushC32(mPrevLen); // chg_length
 
-    if (m_pe->ustrings.size())
+    if (!m_pe->ustrings.empty())
 	t->pushC32(0);
     else
 	t->pushC32(3);
@@ -1631,7 +1631,7 @@
 {
     uString s;
     std::list<pe_ustring>::iterator it;
-    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); it++) {
+    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); ++it) {
 	append_ustring(&s, &(*it).s);
     }
 
@@ -1659,7 +1659,7 @@
     t->pushC16(len * 4);
     t->pushC16(0);
     std::list<pe_ustring>::iterator it;
-    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); it++) {
+    for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); ++it) {
 	len = (*it).s.size();
 	stat = (*it).stat;
 	xstat = FB_None;

Modified: branches/r5rs/xim/helper.cpp
===================================================================
--- branches/r5rs/xim/helper.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/helper.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -32,7 +32,9 @@
 
 // uim-helper connection
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+#endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -61,7 +63,7 @@
 
     if (!strcmp(level, "im_change_whole_desktop")) {
 	std::map<Window, XimServer *>::iterator it;
-	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
 	    (*it).second->changeContext(engine);
 	}
     }
@@ -93,7 +95,7 @@
 	return;
 
     std::list<UIMInfo>::iterator it;
-    for (it = uim_info.begin(); it != uim_info.end(); it++) {
+    for (it = uim_info.begin(); it != uim_info.end(); ++it) {
 	if (client_locale) { // context with legacy encodings
 	    const char *engine_locales =
 		    compose_localenames_from_im_lang(it->lang);
@@ -239,13 +241,13 @@
 	    return;
 
 	std::map<Window, XimServer *>::iterator it;
-	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
 	    (*it).second->customContext(custom, val);
 	}
 	return;
     } else if (strcmp("custom_reload_notify", line) == 0) {
 	std::map<Window, XimServer *>::iterator it;
-	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
 	    (*it).second->reloadConfigs();
 	}
 	return;
@@ -253,7 +255,7 @@
 }
 
 static void
-helper_read_cb(int fd, int ev)
+helper_read_cb(int fd, int /* ev */)
 {
     uim_helper_read_proc(fd);
     char *tmp;

Modified: branches/r5rs/xim/locale.cpp
===================================================================
--- branches/r5rs/xim/locale.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/locale.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -32,7 +32,9 @@
 
 // Locale dependent routines
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+#endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -169,14 +171,14 @@
     int l = 0, nbyte;
     unsigned char utf8[6];
     // count the length
-    for (i = s->begin(); i != s->end(); i++) {
+    for (i = s->begin(); i != s->end(); ++i) {
 	nbyte = utf8_wctomb(utf8, *i);
 	l += nbyte;
     }
     char *c = (char *)malloc(l + 1);
     c[l] = 0;
     l = 0;
-    for (i = s->begin(); i != s->end(); i++) {
+    for (i = s->begin(); i != s->end(); ++i) {
 	nbyte = utf8_wctomb(utf8, *i);
 	int j;
 	for (j = 0; j < nbyte; j++) {

Modified: branches/r5rs/xim/main.cpp
===================================================================
--- branches/r5rs/xim/main.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/main.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -33,7 +33,9 @@
 // XIM Server supporting CJK languages
 // initialize many modules
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+#endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -151,7 +153,7 @@
 
 	std::map<int, fd_watch_struct>::iterator it;
 	int  fd_max = 0;
-	for (it = fd_watch_stat.begin(); it != fd_watch_stat.end(); it++) {
+	for (it = fd_watch_stat.begin(); it != fd_watch_stat.end(); ++it) {
 	    int fd = it->first;
 	    if (it->second.mask & READ_OK)
 		FD_SET(fd, &rfds);
@@ -179,7 +181,7 @@
 	    it = fd_watch_stat.find(fd);
 	    if (it == fd_watch_stat.end())	// shouldn't happen
 		break;
-	    it++;
+	    ++it;
 	}
     }
 }
@@ -335,7 +337,7 @@
 }
 
 static void
-xEventRead(int fd, int ev)
+xEventRead(int /* fd */, int /* ev */)
 {
     XFlush(XimServer::gDpy);
     check_pending_xevent();
@@ -405,7 +407,7 @@
     if (uim_info.empty())
 	printf("  None.\n");
     else
-	for (it = uim_info.begin(); it != uim_info.end(); it++)
+	for (it = uim_info.begin(); it != uim_info.end(); ++it)
 	    printf("  %s (%s)\n", it->name, it->lang);
     
 }
@@ -414,7 +416,7 @@
 clear_uim_info()
 {
     std::list<UIMInfo>::iterator it;
-    for (it = uim_info.begin(); it != uim_info.end(); it++) {
+    for (it = uim_info.begin(); it != uim_info.end(); ++it) {
 	free(it->name);
 	free(it->lang);
 	free(it->desc);
@@ -494,7 +496,7 @@
     bool found = false;
     if (default_engine) {
 	std::list<UIMInfo>::iterator it;
-	for (it = uim_info.begin(); it != uim_info.end(); it++) {
+	for (it = uim_info.begin(); it != uim_info.end(); ++it) {
 	    if (!strcmp(it->name, default_engine)) {
 		found = true;
 		break;
@@ -526,7 +528,7 @@
 }
 
 void
-reload_uim(int x)
+reload_uim(int /* x */)
 {
     fprintf(stderr, "\nReloading uim...\n\n");
 
@@ -537,9 +539,9 @@
     std::map<Window, XimServer *>::iterator it;
     std::list<InputContext *>::iterator it_c;
 
-    for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+    for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
 	XimServer *xs = it->second;
-	for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); it_c++)
+	for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c)
 	    (*it_c)->clear();
     }
 
@@ -548,9 +550,9 @@
     get_uim_info();
     //print_uim_info();
 
-    for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+    for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
 	XimServer *xs = it->second;
-	for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); it_c++) {
+	for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c) {
 	    const char *engine = (*it_c)->get_engine_name();
 	    (*it_c)->createUimContext(engine);
 	}
@@ -611,7 +613,7 @@
 
     // First, setup conversion engine selected by cmdline option or
     // "default-im-name" on ~/.uim.
-    for (it = uim_info.begin(); it != uim_info.end(); it++) {
+    for (it = uim_info.begin(); it != uim_info.end(); ++it) {
 	if (strcmp(it->name, default_engine) == 0) {
 	    XimServer *xs = new XimServer(it->name, it->lang);
 	    res = xs->setupConnection(true);

Modified: branches/r5rs/xim/util.cpp
===================================================================
--- branches/r5rs/xim/util.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/util.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -626,7 +626,7 @@
     double x = x0;
     double f = 1.0;
 
-    for (i=0;i<100;i++) {
+    for (i = 0; i < 100; i++) {
 	l = (long)x;
 	if (l <= (x+1) && l >= (x-1)) break;
 	x *= 0.1;

Modified: branches/r5rs/xim/ximic.cpp
===================================================================
--- branches/r5rs/xim/ximic.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximic.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -73,7 +73,7 @@
 get_font_set(const char *name, const char *locale)
 {
     std::list<FSCache>::iterator it;
-    for (it = fs_cache.begin(); it != fs_cache.end(); it++) {
+    for (it = fs_cache.begin(); it != fs_cache.end(); ++it) {
 	if (!strcmp(it->name, name) && !strcmp(it->locale, locale)) {
 	    it->refc++;
 	    return it->fs;
@@ -103,7 +103,7 @@
 release_font_set(const char *name, const char *locale)
 {
     std::list<FSCache>::iterator it;
-    for (it = fs_cache.begin(); it != fs_cache.end(); it++) {
+    for (it = fs_cache.begin(); it != fs_cache.end(); ++it) {
 	if (!strcmp(it->name, name) && !strcmp(it->locale, locale)) {
 	    it->refc--;
 	    if (!it->refc) {
@@ -147,8 +147,8 @@
     std::list<pe_ustring>::iterator i;
     uString::iterator j;
     int k = 0;
-    for (i = ustrings.begin(); i != ustrings.end(); i++) {
-	for (j = (*i).s.begin(); j != (*i).s.end(); j++) {
+    for (i = ustrings.begin(); i != ustrings.end(); ++i) {
+	for (j = (*i).s.begin(); j != (*i).s.end(); ++j) {
 	    k++;
 	}
     }
@@ -574,7 +574,7 @@
     // m_kkContext->get_preedit_string() returns uncommitted preedit
     // strings, which will be committed in client applications.
     s = m_kkContext->get_preedit_string();
-    if (s.size()) {
+    if (!s.empty()) {
 	char *p;
 	int i, len = 0;
 	p = get_im_by_id(mIMid)->uStringToCtext(&s);
@@ -615,7 +615,7 @@
 
 void XimIC::onSendPacket()
 {
-    if (!mPending.size())
+    if (mPending.empty())
 	return;
 
     char *p;

Modified: branches/r5rs/xim/ximim.cpp
===================================================================
--- branches/r5rs/xim/ximim.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximim.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -154,7 +154,7 @@
 void XimIM_impl::changeContext(const char *engine)
 {
     std::map<int, XimIC *>::iterator i;
-    for (i = m_ics.begin(); i != m_ics.end(); i++) {
+    for (i = m_ics.begin(); i != m_ics.end(); ++i) {
 	(*i).second->changeContext(engine);
     }
     if (mEngineName)
@@ -234,7 +234,7 @@
 {
     std::map<int, XimIC *>::iterator i;
     int max_id = 1; // Does ID of input-context start with 1?
-    for (i = m_ics.begin(); i != m_ics.end(); i++) {
+    for (i = m_ics.begin(); i != m_ics.end(); ++i) {
 	if (max_id <= (*i).first)
 	    max_id = (*i).first + 1;
     }
@@ -336,7 +336,7 @@
 void XimIM_impl::free_all_ic()
 {
     std::map<int, XimIC *>::iterator i;
-    for (i = m_ics.begin(); i != m_ics.end(); i++) {
+    for (i = m_ics.begin(); i != m_ics.end(); ++i) {
 	(*i).second->unsetFocus();
 	delete (*i).second;
     }
@@ -346,7 +346,7 @@
 void XimIM_impl::delete_ic(XimIC *ic)
 {
     std::map<int, XimIC *>::iterator it;
-    for (it = m_ics.begin(); it != m_ics.end(); it++) {
+    for (it = m_ics.begin(); it != m_ics.end(); ++it) {
 	if (it->second == ic) {
 	    it->second->unsetFocus();
 	    delete it->second;
@@ -375,7 +375,7 @@
 void XimIM_impl::onSendPacket()
 {
     std::map<int, XimIC *>::iterator i;
-    for (i = m_ics.begin(); i != m_ics.end(); i++) {
+    for (i = m_ics.begin(); i != m_ics.end(); ++i) {
 	(*i).second->onSendPacket();
     }
 }
@@ -472,7 +472,7 @@
     int max_id;
     std::map<int, XimIM *>::iterator i;
     max_id = 1;
-    for (i = g_ims.begin(); i != g_ims.end(); i++) {
+    for (i = g_ims.begin(); i != g_ims.end(); ++i) {
 	if ((*i).first == max_id)
 	    max_id = (*i).first + 1;
     }

Modified: branches/r5rs/xim/ximpacket.cpp
===================================================================
--- branches/r5rs/xim/ximpacket.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximpacket.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -54,7 +54,7 @@
 }
 
 void
-writeC8(C8 val, int byte_order, unsigned char *buf)
+writeC8(C8 val, int /* byte_order */, unsigned char *buf)
 {
     buf[0] = val;
 }
@@ -211,7 +211,7 @@
     virtual int get_size() {
 	return m_len;
     }
-    virtual int write_to_buf(unsigned char *buf, int bo) {
+    virtual int write_to_buf(unsigned char *buf, int /* bo */) {
 	memcpy(buf, m_str, m_len);
 	return get_size();
     }
@@ -253,7 +253,7 @@
 TxPacket_impl::~TxPacket_impl()
 {
     std::list<TxElement *>::iterator i;
-    for (i = m_elms.begin(); i != m_elms.end(); i++) {
+    for (i = m_elms.begin(); i != m_elms.end(); ++i) {
 	delete *i;
     }
 }
@@ -263,7 +263,7 @@
     std::list<TxElement *>::iterator i;
     int l;
     l = 4;
-    for (i = m_elms.begin(); i != m_elms.end(); i++) {
+    for (i = m_elms.begin(); i != m_elms.end(); ++i) {
 	l +=  (*i)->get_size();
     }  
     return l;
@@ -274,7 +274,7 @@
     std::list<TxElement *>::iterator i;
     int l, m;
     l = 4;
-    for (i = m_elms.begin(); i != m_elms.end(); i++) {
+    for (i = m_elms.begin(); i != m_elms.end(); ++i) {
 	m = (*i)->get_size();
 	if (l + m > buflen)
 	    return 0;

Modified: branches/r5rs/xim/ximserver.cpp
===================================================================
--- branches/r5rs/xim/ximserver.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximserver.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -30,7 +30,9 @@
   SUCH DAMAGE.
 */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // for asprintf on stdio.h with old glibc/gcc
+#endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -66,8 +68,7 @@
 InputContext *InputContext::mFocusedContext = NULL;
 
 static int check_modifier(std::list<KeySym> list);
-static int gShiftMask, gLockMask, gControlMask, gMod1Mask,
-	   gMod2Mask, gMod3Mask, gMod4Mask, gMod5Mask;
+static int gMod1Mask, gMod2Mask, gMod3Mask, gMod4Mask, gMod5Mask;
 static int gXNumLockMask;
 
 
@@ -78,7 +79,7 @@
     uchar ch;
     char utf8[6];
     int nbyte;
-    for (i = s->begin(); i != s->end(); i++) {
+    for (i = s->begin(); i != s->end(); ++i) {
 	ch = *i;
 	nbyte = utf8_wctomb((unsigned char *)utf8, ch);
 	utf8[nbyte] = '\0';
@@ -95,7 +96,7 @@
 void append_ustring(uString *d, uString *s)
 {
     uString::iterator i;
-    for (i = s->begin(); i !=s->end(); i++) {
+    for (i = s->begin(); i !=s->end(); ++i) {
 	d->push_back(*i);
     }
 }
@@ -116,7 +117,7 @@
 void XimServer::deleteContext(InputContext *ic)
 {
     std::list<InputContext *>::iterator it;
-    for (it = ic_list.begin(); it != ic_list.end(); it++) {
+    for (it = ic_list.begin(); it != ic_list.end(); ++it) {
 	if (*it == ic) {
 	    ic_list.erase(it);
 	    break;
@@ -127,7 +128,7 @@
 void XimServer::changeContext(const char *engine) {
     set_im(engine);
     std::list<InputContext *>::iterator it;
-    for (it = ic_list.begin(); it != ic_list.end(); it++) {
+    for (it = ic_list.begin(); it != ic_list.end(); ++it) {
 	(*it)->changeContext(engine);
     }
     // make sure to use appropriate locale for the focused context
@@ -138,7 +139,7 @@
 
 void XimServer::customContext(const char *custom, const char *val) {
     std::list<InputContext *>::iterator it;
-    for (it = ic_list.begin(); it != ic_list.end(); it++) {
+    for (it = ic_list.begin(); it != ic_list.end(); ++it) {
 	(*it)->customContext(custom, val);
 	break;
     }
@@ -299,7 +300,7 @@
 const char *get_im_lang_from_engine(const char *engine)
 {
     std::list<UIMInfo>::iterator it;
-    for (it = uim_info.begin(); it != uim_info.end(); it++) {
+    for (it = uim_info.begin(); it != uim_info.end(); ++it) {
 	if (!strcmp(it->name, engine))
 	    return it->lang;
     }
@@ -661,7 +662,7 @@
     mServer->strToUstring(&js, str);
 
     uString::iterator it;
-    for (it = js.begin(); it != js.end(); it++) {
+    for (it = js.begin(); it != js.end(); ++it) {
 	m_pe->push_uchar(*it);
     }
 }
@@ -827,7 +828,7 @@
 	Canddisp *disp = canddisp_singleton();
 
 	disp->deactivate();
-	for (i = active_candidates.begin(); i != active_candidates.end(); i++) {
+	for (i = active_candidates.begin(); i != active_candidates.end(); ++i) {
 	    free((char *)*i);
 	}
 	mCandwinActive = false;
@@ -885,10 +886,7 @@
     XimIM *im;
     DefTree *top;
 
-    mAltOn = false;
-    mMetaOn = false;
-    mSuperOn = false;
-    mHyperOn = false;
+    mModState = 0;
     mIc = ic;
 
     im = get_im_by_id(mIc->get_imid());
@@ -908,32 +906,31 @@
     mXKeySym = x->key_sym;
     mXKeyState = x->state;
 
+    mPreModState = mModState;
+
     if (x->press) {
 	m_bPush = true;
 
-	if (!(g_option_mask & OPT_ON_DEMAND_SYNC)) {
-	    // Only KeyPress is forwarded with full-synchronous
-	    // method.  So reset modifiers here.
-	    if (!(x->state) || x->state == LockMask || x->state == gXNumLockMask)
-		mAltOn = mMetaOn = mSuperOn = mHyperOn = false;
-	}
+	if (!(x->state) || x->state == LockMask || x->state == gXNumLockMask)
+	    mModState = mPreModState = 0;
 
+	mPreModState = mModState;
 	switch (x->key_sym) {
 	case XK_Alt_L:
 	case XK_Alt_R:
-	    mAltOn = true;
+	    mModState |= UMod_Alt;
 	    break;
 	case XK_Meta_L:
 	case XK_Meta_R:
-	    mMetaOn = true;
+	    mModState |= UMod_Meta;
 	    break;
 	case XK_Super_L:
 	case XK_Super_R:
-	    mSuperOn = true;
+	    mModState |= UMod_Super;
 	    break;
 	case XK_Hyper_L:
 	case XK_Hyper_R:
-	    mHyperOn = true;
+	    mModState |= UMod_Hyper;
 	    break;
 	default:
 	    break;
@@ -944,19 +941,19 @@
 	switch (x->key_sym) {
 	case XK_Alt_L:
 	case XK_Alt_R:
-	    mAltOn = false;
+	    mModState &= ~UMod_Alt;
 	    break;
 	case XK_Meta_L:
 	case XK_Meta_R:
-	    mMetaOn = false;
+	    mModState &= ~UMod_Meta;
 	    break;
 	case XK_Super_L:
 	case XK_Super_R:
-	    mSuperOn = false;
+	    mModState &= ~UMod_Super;
 	    break;
 	case XK_Hyper_L:
 	case XK_Hyper_R:
-	    mHyperOn = false;
+	    mModState &= ~UMod_Hyper;
 	    break;
 	default:
 	    break;
@@ -964,21 +961,19 @@
     }
 
     if (x->state & ShiftMask)
-	mModifier |= gShiftMask;
-    if (x->state & LockMask)
-	mModifier |= gLockMask;
+	mModifier |= UMod_Shift;
     if (x->state & ControlMask)
-	mModifier |= gControlMask;
+	mModifier |= UMod_Control;
     if (x->state & Mod1Mask)
-	mModifier |= revise_mod(gMod1Mask);
+	mModifier |= (gMod1Mask & mPreModState);
     if (x->state & Mod2Mask)
-	mModifier |= revise_mod(gMod2Mask);
+	mModifier |= (gMod2Mask & mPreModState);
     if (x->state & Mod3Mask)
-	mModifier |= revise_mod(gMod3Mask);
+	mModifier |= (gMod3Mask & mPreModState);
     if (x->state & Mod4Mask)
-	mModifier |= revise_mod(gMod4Mask);
+	mModifier |= (gMod4Mask & mPreModState);
     if (x->state & Mod5Mask)
-	mModifier |= revise_mod(gMod5Mask);
+	mModifier |= (gMod5Mask & mPreModState);
 
     if (x->key_sym < 128 && x->key_sym >= 32)
 	mKey = x->key_sym;
@@ -1047,20 +1042,6 @@
     return m_bPush;
 }
 
-int keyState::revise_mod(int uim_mod)
-{
-    if ((uim_mod & UMod_Alt) && (mAltOn == false))
-	uim_mod &= ~UMod_Alt;
-    if ((uim_mod & UMod_Meta) && (mMetaOn == false))
-	uim_mod &= ~UMod_Meta;
-    if ((uim_mod & UMod_Super) && (mSuperOn == false))
-	uim_mod &= ~UMod_Super;
-    if ((uim_mod & UMod_Hyper) && (mHyperOn == false))
-	uim_mod &= ~UMod_Hyper;
-
-    return uim_mod;
-}
-
 KeySym keyState::xkeysym()
 {
     return mXKeySym;
@@ -1073,7 +1054,7 @@
 
 void keyState::reset()
 {
-    mAltOn = mMetaOn = mHyperOn = mSuperOn = false;
+    mModState = 0;
     mCompose->reset();
 }
 
@@ -1087,16 +1068,8 @@
 {
     int ret = 0;
     std::list<KeySym>::iterator i;
-    for (i = keysym_list.begin(); i != keysym_list.end(); i++) {
+    for (i = keysym_list.begin(); i != keysym_list.end(); ++i) {
 	switch (*i) {
-	case XK_Shift_L:
-	case XK_Shift_R:
-	    ret |= UMod_Shift;
-	    break;
-	case XK_Control_L:
-	case XK_Control_R:
-	    ret |= UMod_Control;
-	    break;
 	case XK_Alt_L:
 	case XK_Alt_R:
 	    ret |= UMod_Alt;
@@ -1124,8 +1097,7 @@
     int i, k = 0;
     int min_keycode, max_keycode, keysyms_per_keycode = 0;
 
-    std::list<KeySym> ShiftMaskSyms, LockMaskSyms, ControlMaskSyms,
-		      Mod1MaskSyms, Mod2MaskSyms, Mod3MaskSyms,
+    std::list<KeySym> Mod1MaskSyms, Mod2MaskSyms, Mod3MaskSyms,
 		      Mod4MaskSyms, Mod5MaskSyms;
 
     gXNumLockMask = 0;
@@ -1146,9 +1118,9 @@
 		} while (!ks && index < keysyms_per_keycode);
 
 		switch (i) {
-		case ShiftMapIndex: ShiftMaskSyms.push_back(ks); break;
-		case LockMapIndex: LockMaskSyms.push_back(ks); break;
-		case ControlMapIndex: ControlMaskSyms.push_back(ks); break;
+		case ShiftMapIndex: break;
+		case LockMapIndex: break;
+		case ControlMapIndex: break;
 		case Mod1MapIndex: Mod1MaskSyms.push_back(ks); break;
 		case Mod2MapIndex: Mod2MaskSyms.push_back(ks); break;
 		case Mod3MapIndex: Mod3MaskSyms.push_back(ks); break;
@@ -1166,9 +1138,6 @@
     XFreeModifiermap(map);
     XFree(sym);
 
-    gShiftMask = check_modifier(ShiftMaskSyms);
-    gLockMask = check_modifier(LockMaskSyms);
-    gControlMask = check_modifier(ControlMaskSyms);
     gMod1Mask = check_modifier(Mod1MaskSyms);
     gMod2Mask = check_modifier(Mod2MaskSyms);
     gMod3Mask = check_modifier(Mod3MaskSyms);

Modified: branches/r5rs/xim/ximserver.h
===================================================================
--- branches/r5rs/xim/ximserver.h	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximserver.h	2006-01-23 17:38:44 UTC (rev 2987)
@@ -133,16 +133,13 @@
     bool is_push(); // for distinguish from release
     void print();
 private:
-    int revise_mod(int uim_mod);
     int mKey;
     int mModifier;
     KeySym mXKeySym;
     int mXKeyState;
     bool m_bPush;
-    bool mAltOn;
-    bool mMetaOn;
-    bool mHyperOn;
-    bool mSuperOn;
+    int mModState;
+    int mPreModState;
     Compose *mCompose;
     XimIC *mIc;
 };

Modified: branches/r5rs/xim/ximtrans.cpp
===================================================================
--- branches/r5rs/xim/ximtrans.cpp	2006-01-23 17:29:07 UTC (rev 2986)
+++ branches/r5rs/xim/ximtrans.cpp	2006-01-23 17:38:44 UTC (rev 2987)
@@ -203,22 +203,22 @@
 {
     // destruct all the IM created by this Connection
     std::list<int>::iterator i;
-    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); i++) {
+    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
 	close_im(*i);
     }
     //
     std::list<RxPacket *>::iterator ir;
-    for (ir = mRxQ.begin(); ir != mRxQ.end(); ir++) {
+    for (ir = mRxQ.begin(); ir != mRxQ.end(); ++ir) {
 	delete *ir;
     }
     std::list<TxPacket *>::iterator it;
-    for (it = mTxQ.begin(); it != mTxQ.end(); it++) {
+    for (it = mTxQ.begin(); it != mTxQ.end(); ++it) {
 	delete *it;
     }
-    for (it = mPTxQ.begin(); it != mPTxQ.end(); it++) {
+    for (it = mPTxQ.begin(); it != mPTxQ.end(); ++it) {
 	delete *it;
     }
-    for (it = mPendingTxQ.begin(); it != mPendingTxQ.end(); it++) {
+    for (it = mPendingTxQ.begin(); it != mPendingTxQ.end(); ++it) {
 	delete *it;
     }
 }
@@ -231,7 +231,7 @@
 void Connection::OnRecv()
 {
     std::list<RxPacket *>::iterator i;
-    while (mRxQ.size()) {
+    while (!mRxQ.empty()) {
 	i = mRxQ.begin();
 	int major = (*i)->getMajor();
 	if (g_option_mask & OPT_TRACE_XIM)
@@ -321,7 +321,7 @@
 void Connection::OnSend()
 {
     std::list<int>::iterator i;
-    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); i++) {
+    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
 	XimIM *im;
 	im = get_im_by_id(*i);
 	if (im)
@@ -332,7 +332,7 @@
 void Connection::OnClose()
 {
     std::list<int>::iterator i;
-    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); i++) {
+    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
 	close_im(*i);
     }
     mCreatedIm.erase(mCreatedIm.begin(), mCreatedIm.end());
@@ -537,7 +537,7 @@
     push_packet(t);
     close_im(imid);
     std::list<int>::iterator i;
-    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); i++) {
+    for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
 	if (*i == imid) {
 	    mCreatedIm.erase(i);
 	    return;
@@ -799,7 +799,7 @@
 
 void Connection::clear_pending_queue() {
     std::list<TxPacket *>::iterator i;
-    while (mPendingTxQ.size()) {
+    while (!mPendingTxQ.empty()) {
 	i = mPendingTxQ.begin();
 	mPendingTxQ.pop_front();
 	delete *i;



More information about the uim-commit mailing list