From 463cc8b02b362af84935ae07200b2d1e1689a219 Mon Sep 17 00:00:00 2001 From: Friedrich Delgado Friedrichs Date: Sat, 25 Oct 2008 14:35:57 +0200 Subject: [PATCH] Patch by shawn to enable AltGr, working on a proposal by me, see also http://paste.lisp.org/display/69084 --- help.lisp | 3 ++- input.lisp | 12 ++++++++---- primitives.lisp | 7 ++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/help.lisp b/help.lisp index aa66f97..70ef9db 100644 --- a/help.lisp +++ b/help.lisp @@ -121,4 +121,5 @@ command prints the command bound to the specified key sequence." "Meta" (modifiers-meta *modifiers*) "Alt" (modifiers-alt *modifiers*) "Super" (modifiers-super *modifiers*) - "Hyper" (modifiers-hyper *modifiers*))) + "Hyper" (modifiers-hyper *modifiers*) + "AltGr" (modifiers-altgr *modifiers*))) diff --git a/input.lisp b/input.lisp index 176bd04..932e990 100644 --- a/input.lisp +++ b/input.lisp @@ -274,9 +274,11 @@ to return a list of matches." (defun code-state->key (code state) (let* ((mods (xlib:make-state-keys state)) - (sym (xlib:keycode->keysym *display* code 0)) - (upsym (xlib:keycode->keysym *display* code 1)) - (shift-p (and (find :shift mods) t))) + (shift-p (and (find :shift mods) t)) + (altgr-p (and (intersection (modifiers-altgr *modifiers*) mods) t)) + (base (if altgr-p 2 0)) + (sym (xlib:keycode->keysym *display* code base)) + (upsym (xlib:keycode->keysym *display* code (+ base 1)))) ;; If a keysym has a shift modifier, then use the uppercase keysym ;; and remove remove the shift modifier. (make-key :keysym (if (and shift-p (not (eql sym upsym))) @@ -599,7 +601,9 @@ input (pressing Return), nil otherwise." (find-mod "Hyper_R" codes)) (push mod (modifiers-hyper modifiers))) ((find-mod "Num_Lock" codes) - (push mod (modifiers-numlock modifiers))))) + (push mod (modifiers-numlock modifiers))) + ((find-mod "ISO_Level3_Shift" codes) + (push mod (modifiers-altgr modifiers))))) ;; If alt is defined but meta isn't set meta to alt and clear alt (when (and (modifiers-alt modifiers) (null (modifiers-meta modifiers))) diff --git a/primitives.lisp b/primitives.lisp index 0161094..01da193 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -115,9 +115,9 @@ run-hook run-hook-with-args split-string - with-restarts-menu + with-restarts-menu with-data-file - move-to-head)) + move-to-head)) ;;; Message Timer @@ -467,6 +467,7 @@ single char keys are supported.") (alt nil) (hyper nil) (super nil) + (altgr nil) (numlock nil)) (defvar *all-modifiers* nil @@ -492,7 +493,7 @@ single char keys are supported.") (defvar *interactivep* nil "True when a defcommand is executed from colon or a keybinding") - + ;;; The restarts menu macro (defmacro with-restarts-menu (&body body) -- 1.5.6.5