[uim-commit] r739 - branches/composer/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Mar 2 01:09:04 PST 2005


Author: yamaken
Date: 2005-03-02 01:09:01 -0800 (Wed, 02 Mar 2005)
New Revision: 739

Modified:
   branches/composer/scm/anthy.scm
   branches/composer/scm/event.scm
Log:
* scm/event.scm
  - (key-event-inspect): New procedure
* scm/anthy.scm
  - (anthy-key-handler): Add debug print inspecting key-event. define
    anthy-debug? as #t in ~/.uim to enable the inspection


Modified: branches/composer/scm/anthy.scm
===================================================================
--- branches/composer/scm/anthy.scm	2005-03-02 06:11:38 UTC (rev 738)
+++ branches/composer/scm/anthy.scm	2005-03-02 09:09:01 UTC (rev 739)
@@ -924,8 +924,15 @@
 
 (define anthy-key-handler
   (lambda (ac key key-state press?)
-    (let ((ev (legacy-key->key-event key key-state press?)))
+    (let ((ev (legacy-key->key-event key key-state press?))
+	  (debug? (and (symbol-bound? 'anthy-debug?)
+		       anthy-debug?)))
 
+      (if debug?
+	  (begin
+	    (puts "key-event:  ")
+	    (puts (key-event-inspect ev))))
+
       ;; temporary workaround for NICOLA input
       ;; TODO: replace with ja-nicola-jp106-pseudo-thumb-shift-ruleset
       (if (eq? (key-event-lkey ev)
@@ -935,6 +942,11 @@
 	       'lkey_Muhenkan)
 	  (key-event-set-lkey! ev 'lkey_Thumb_Shift_L))
 
+      (if debug?
+	  (begin
+	    (puts "translated: ")
+	    (puts (key-event-inspect ev))))
+
       (if (anthy-context-on ac)
 	  (if (anthy-context-converting ac)
 	      (anthy-proc-converting-state ac ev key key-state)

Modified: branches/composer/scm/event.scm
===================================================================
--- branches/composer/scm/event.scm	2005-03-02 06:11:38 UTC (rev 738)
+++ branches/composer/scm/event.scm	2005-03-02 09:09:01 UTC (rev 739)
@@ -171,3 +171,39 @@
 			  (getter other)))
 		(list key-event-press
 		      key-event-autorepeat)))))
+
+;; TODO: write test
+(define key-event-inspect
+  (lambda (ev)
+    (string-append
+     (if (key-event-str ev)
+	 (string-append "\"" (key-event-str ev) "\"")
+	 "-")
+     " "
+     (symbol->string (or (key-event-lkey ev)
+			 '-))
+     " "
+     (symbol->string (or (key-event-pkey ev)
+			 '-))
+     " ("
+     (string-join
+      " "
+      (filter-map (lambda (mod-sym)
+		    (and (not (= (bitwise-and (symbol-value mod-sym)
+					      (key-event-modifier ev))
+				 0))
+			 (symbol->string mod-sym)))
+		  valid-modifiers))
+     ") "
+     (if (key-event-press ev)
+	 "press"
+	 "release")
+     " "
+     (if (key-event-autorepeat ev)
+	 "autorepeat"
+	 "nonrepeat")
+     " "
+     (if (event-consumed ev)
+	 "consumed"
+	 "not-consumed")
+     "\n")))



More information about the Uim-commit mailing list