Re: [spr35351] Allegro IDE - entering characters important in Lisp
Ken Cheetham <[email protected]> Wed, 3 Dec 2008 02:57:37 -0800
| Newsgroups | gmane.lisp.allegro |
|---|---|
| Message-ID | <[email protected]> |
I neglected to send my response to this list when I answered Andreas, so here it is: --------------------------------------------------------------------------- I wonder how one inserts a Backslash or At-Sign from Allegros IDE-Editor. If I press then Backslash key (Alt Gr à on german keyboard) the IDE responds "There is no selected object in the selected window to pass to MACROEXPAND-COMMAND" If I press @ (Alt Gr q on german keyboard) a window "Process(es) for Bug Report Backtrace" opens. I find this weird. Can I change this behaviour? How do I insert a Backslash or At-Sign from my german keyboard (german system)? The reason for the behavior is that Common Graphics (CG) is handling all keystrokes itself, rather than letting the OS handle them, and CG is treating both alt keys in the same way. A Czech customer pointed out the same problem, and I came up with the code below my signature to make CG stop handling the righthand alt key. Please try loading this code and see if it corrects the problem. You could place this code into a startup.cl file in your main allegro directory (just create that file if it doesn't exist already) to cause it to be loaded automatically every time you start up the IDE. You could also add the code to a standalone application if needed. Maybe this change should be an official patch, but I was wary of changing the default behavior for backward compatibility reasons. Instead, I turned this code change into a configuration option for the next release, called reserve-righthand-alt-key. Ken Cheetham [email protected] Franz Inc. Voice: (510) 452-2000 x124 555 Twelfth Street, Suite 1450 Fax: (510) 452-0182 Oakland, CA 94607 Web: http://www.franz.com/ (in-package :cg.win) (defmethod WM_SYSKEYDOWN ((window basic-pane) wparam lparam) (if (key-was-down-p vk-right-alt) (call-next-method) (character-procedure window virtual-key-down wparam lparam))) (defmethod WM_SYSKEYUP ((window basic-pane) wparam lparam) (if (key-was-down-p vk-right-alt) (call-next-method) (character-procedure window virtual-key-up wparam lparam))) (defmethod WM_KEYDOWN ((window basic-pane) wparam lparam) (if* (key-was-down-p vk-right-alt) then (TranslateMessage *qmsg*) (call-next-method) else (character-procedure window virtual-key-down wparam lparam))) (defmethod WM_KEYUP ((window basic-pane) wparam lparam) (if (key-was-down-p vk-right-alt) (call-next-method) (character-procedure window virtual-key-up wparam lparam))) (defun translate-menu-accelerator (msg) (let ((message (fslot-value-typed 'msg :foreign msg :message))) (and (or (eql message WM_KEYDOWN) (eql message WM_SYSKEYDOWN)) (not (key-was-down-p vk-right-alt)) (let* ((handle (fslot-value-typed 'msg :foreign msg :hwnd)) (window (window-from-handle handle))) ;; rfe3704c (multiple-value-bind (button-state keycode) (character-event-button-state-and-data (fslot-value-typed 'msg :foreign msg :wparam) (fslot-value-typed 'msg :foreign msg :lparam)) ;; Make sure the message was sent to a CG window ;; rather than a raw Windows window. (and window (run-cg-hook handle-keyboard-shortcut window button-state keycode)))))))