Author: ek.kato
Date: Thu Jul 17 09:24:07 2008
New Revision: 5507

Modified:
  trunk/scm/im-custom.scm
  trunk/scm/im.scm

Log:
* scm/im.scm
 - (next-im) : Use enabled-im-list to for the correct IM
   sequence.
 - (next-im-for-switch-im) : New.
 - (switch-im) : Use next-im-for-switch-im instead of next-im.
* scm/im-custom.scm
 - (im-switching)
 - (enable-im-switch)
 - (switch-im-key)
   - Re-enable IM-switching by hot key.  See
     http://groups.google.com/group/uim-en/browse_thread/thread/1a64d86493fb1bc
 - (switch-im-skip-direct-im)
  - New.


Modified: trunk/scm/im-custom.scm
==============================================================================
--- trunk/scm/im-custom.scm     (original)
+++ trunk/scm/im-custom.scm     Thu Jul 17 09:24:07 2008
@@ -274,34 +274,38 @@
;;
;; im-switching
;;
+(define-custom-group 'im-switching
+  (N_ "Input method switching")
+  (N_ "long description will be here."))

-;; I think that current "im-switching by hotkey" feature is not
-;; useful. So commented out them to avoid confusion of users.
-;;   -- YamaKen 2005-02-01
+(define-custom 'enable-im-switch #f
+  '(global im-switching)
+  '(boolean)
+  (N_ "Enable IM switching by hotkey")
+  (N_ "long description will be here."))

-;;(define-custom-group 'im-switching
-;;                  (N_ "Input method switching")
-;;                  (N_ "long description will be here."))
-;;
-;;(define-custom 'enable-im-switch #f
-;;  '(global im-switching)
-;;  '(boolean)
-;;  (N_ "Enable IM switching by hotkey")
-;;  (N_ "long description will be here."))
-;;
-;;(define-custom 'switch-im-key '("<Control>Shift_key" "<Shift>Control_key")
-;;  '(global im-switching)
-;;  '(key)
-;;  (N_ "IM switching key")
-;;  (N_ "long description will be here."))
-;;
-;;;; activity dependency
-;;(custom-add-hook 'switch-im-key?
-;;              'custom-activity-hooks
-;;              (lambda ()
-;;                enable-im-switch))
+(define-custom 'switch-im-key '("<Control>Shift_key" "<Shift>Control_key")
+  '(global im-switching)
+  '(key)
+  (N_ "IM switching key")
+  (N_ "long description will be here."))

-(define-key switch-im-key? '())
+(define-custom 'switch-im-skip-direct-im? #f
+  '(global im-switching)
+  '(boolean)
+  (N_ "Skip direct method for IM switching by hotkey")
+  (N_ "long description will be here."))
+
+;; activity dependency
+(custom-add-hook 'switch-im-key?
+                'custom-activity-hooks
+                (lambda ()
+                  enable-im-switch))
+
+(custom-add-hook 'switch-im-skip-direct-im?
+                'custom-activity-hooks
+                (lambda ()
+                  enable-im-switch))

;; im-toggle
(define-custom-group 'im-toggle

Modified: trunk/scm/im.scm
==============================================================================
--- trunk/scm/im.scm    (original)
+++ trunk/scm/im.scm    Thu Jul 17 09:24:07 2008
@@ -246,18 +246,28 @@

(define next-im
  (lambda (name)
-    (let* ((im-names (map car im-list))
+    (let* ((im-names enabled-im-list)
           (im-rest (memq name im-names)))
      (or (and im-rest
               (pair? (cdr im-rest))
               (cadr im-rest))
          (car im-names)))))

+(define next-im-for-switch-im
+  (lambda (name)
+    (let ((im (next-im name)))
+      (or
+       (and
+       switch-im-skip-direct-im?
+       (eq? im 'direct)
+       (next-im im))
+       im))))
+
;; 'switch-im' is not a API but an IM-switching method. Don't confuse with
;; im-switch-im
(define switch-im
  (lambda (uc name)
-    (im-switch-im uc (next-im name))))
+    (im-switch-im uc (next-im-for-switch-im name))))

;; FIXME: Input states are kept only if the state is appeared in the
;; toolbar.

Reply via email to