cvs diff: Diffing . Index: ChangeLog =================================================================== RCS file: /sources/stumpwm/stumpwm/ChangeLog,v retrieving revision 1.84 diff -u -r1.84 ChangeLog --- ChangeLog 6 May 2006 19:28:16 -0000 1.84 +++ ChangeLog 7 May 2006 21:17:13 -0000 @@ -1,3 +1,15 @@ +2006-05-07 Matthew Kennedy + + * kmap.lisp (print-key): print the stumpwm key name instead of + the keysym key name + + * keytrans.lisp (*keysym-name->stumpwm-name-translations*): new + mapping for keysym names to stumpwm key names + (define-keysym-name): also set the reverse mapping from keysym + name to stumpwm name + (keysym-name->stumpwm-name): new function + (keysym->stumpwm-name): new function + 2006-05-06 Shawn Betts * input.lisp (*input-map*): use DEL to refer to the backspace Index: keytrans.lisp =================================================================== RCS file: /sources/stumpwm/stumpwm/keytrans.lisp,v retrieving revision 1.1 diff -u -r1.1 keytrans.lisp --- keytrans.lisp 6 May 2006 19:28:16 -0000 1.1 +++ keytrans.lisp 7 May 2006 21:17:13 -0000 @@ -28,12 +28,17 @@ (defvar *stumpwm-name->keysym-name-translations* (make-hash-table :test #'equal) "Hashtable mapping from stumpwm key names to keysym names.") +(defvar *keysym-name->stumpwm-name-translations* (make-hash-table :test #'equal) + "Hashtable mapping from keysym names to stumpwm key names.") + (defun define-keysym-name (stumpwm-name keysym-name) "Define a mapping from a STUMPWM-NAME to KEYSYM-NAME. This function is used to translate Emacs-like names to keysym names." (setf (gethash stumpwm-name *stumpwm-name->keysym-name-translations*) - keysym-name)) + keysym-name + (gethash keysym-name *keysym-name->stumpwm-name-translations*) + stumpwm-name)) (defun stumpwm-name->keysym-name (stumpwm-name) (multiple-value-bind (value present-p) @@ -41,13 +46,27 @@ (declare (ignore present-p)) value)) +(defun keysym-name->stumpwm-name (keysym-name) + (multiple-value-bind (value present-p) + (gethash keysym-name *keysym-name->stumpwm-name-translations*) + (declare (ignore present-p)) + value)) + (defun stumpwm-name->keysym (stumpwm-name) "Return the keysym corresponding to STUMPWM-NAME. If no mapping for STUMPWM-NAME exists, then fallback by calling -NAME-KEYSYM." +KEYSYM-NAME->KEYSYM." (let ((keysym-name (stumpwm-name->keysym-name stumpwm-name))) (keysym-name->keysym (or keysym-name stumpwm-name)))) +(defun keysym->stumpwm-name (keysym) + "Return the stumpwm key name corresponding to KEYSYM. +If no mapping for the stumpwm key name exists, then fall back by +calling KEYSYM->KEYSYM-NAME." + (let ((keysym-name (keysym->keysym-name keysym))) + (or (keysym-name->stumpwm-name keysym-name) + keysym-name))) + (define-keysym-name "RET" "Return") (define-keysym-name "ESC" "Escape") (define-keysym-name "TAB" "Tab") Index: kmap.lisp =================================================================== RCS file: /sources/stumpwm/stumpwm/kmap.lisp,v retrieving revision 1.6 diff -u -r1.6 kmap.lisp --- kmap.lisp 6 May 2006 19:28:16 -0000 1.6 +++ kmap.lisp 7 May 2006 21:17:13 -0000 @@ -114,7 +114,7 @@ (defun print-key (key) (format nil "~a~a" (print-mods key) - (keysym->keysym-name (key-keysym key)))) + (keysym->stumpwm-name (key-keysym key)))) (defun define-key (map key command) (setf (gethash key map) command))