/[cmucl]/src/hemlock/keysym-defs.lisp
ViewVC logotype

Contents of /src/hemlock/keysym-defs.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Fri Jul 13 15:12:54 1990 UTC (23 years, 9 months ago) by ram
Branch: MAIN
Initial revision
1 ram 1.1 ;;; -*- Log: hemlock.log; Mode: Lisp; Package: Hemlock-Internals -*-
2     ;;;
3     ;;; **********************************************************************
4     ;;; This code was written as part of the Spice Lisp project at
5     ;;; Carnegie-Mellon University, and has been placed in the public domain.
6     ;;; Spice Lisp is currently incomplete and under active development.
7     ;;; If you want to use this code or any part of Spice Lisp, please contact
8     ;;; Scott Fahlman (FAHLMAN@CMUC).
9     ;;; **********************************************************************
10     ;;;
11     ;;; This file defines all the definitions of keysyms (see key-event.lisp).
12     ;;; These keysyms match those for X11.
13     ;;;
14     ;;; Written by Bill Chiles
15     ;;; Modified by Blaine Burks.
16     ;;;
17    
18     (in-package "HEMLOCK-INTERNALS")
19    
20    
21     ;;; The IBM RT keyboard has X11 keysyms defined for the following modifier
22     ;;; keys, but we leave them mapped to nil indicating that they are non-events
23     ;;; to be ignored:
24     ;;; ctrl 65507
25     ;;; meta (left) 65513
26     ;;; meta (right) 65514
27     ;;; shift (left) 65505
28     ;;; shift (right) 65506
29     ;;; lock 65509
30     ;;;
31    
32    
33     ;;; Function keys for the RT.
34     ;;;
35     (ext:define-keysym 65470 "F1")
36     (ext:define-keysym 65471 "F2")
37     (ext:define-keysym 65472 "F3")
38     (ext:define-keysym 65473 "F4")
39     (ext:define-keysym 65474 "F5")
40     (ext:define-keysym 65475 "F6")
41     (ext:define-keysym 65476 "F7")
42     (ext:define-keysym 65477 "F8")
43     (ext:define-keysym 65478 "F9")
44     (ext:define-keysym 65479 "F10")
45     (ext:define-keysym 65480 "F11" "L1")
46     (ext:define-keysym 65481 "F12" "L2")
47    
48     ;;; Function keys for the Sun (and other keyboards) -- L1-L10 and R1-R15.
49     ;;;
50     (ext:define-keysym 65482 "F13" "L3")
51     (ext:define-keysym 65483 "F14" "L4")
52     (ext:define-keysym 65484 "F15" "L5")
53     (ext:define-keysym 65485 "F16" "L6")
54     (ext:define-keysym 65486 "F17" "L7")
55     (ext:define-keysym 65487 "F18" "L8")
56     (ext:define-keysym 65488 "F19" "L9")
57     (ext:define-keysym 65489 "F20" "L10")
58     (ext:define-keysym 65490 "F21" "R1")
59     (ext:define-keysym 65491 "F22" "R2")
60     (ext:define-keysym 65492 "F23" "R3")
61     (ext:define-keysym 65493 "F24" "R4")
62     (ext:define-keysym 65494 "F25" "R5")
63     (ext:define-keysym 65495 "F26" "R6")
64     (ext:define-keysym 65496 "F27" "R7")
65     (ext:define-keysym 65497 "F28" "R8")
66     (ext:define-keysym 65498 "F29" "R9")
67     (ext:define-keysym 65499 "F30" "R10")
68     (ext:define-keysym 65500 "F31" "R11")
69     (ext:define-keysym 65501 "F32" "R12")
70     (ext:define-keysym 65502 "F33" "R13")
71     (ext:define-keysym 65503 "F34" "R14")
72     (ext:define-keysym 65504 "F35" "R15")
73    
74     ;;; Upper right key bank.
75     ;;;
76     (ext:define-keysym 65377 "Printscreen")
77     ;; Couldn't type scroll lock.
78     (ext:define-keysym 65299 "Pause")
79    
80     ;;; Middle right key bank.
81     ;;;
82     (ext:define-keysym 65379 "Insert")
83     (ext:define-keysym 65535 "Delete" "Rubout" (string (code-char 127)))
84     (ext:define-keysym 65360 "Home")
85     (ext:define-keysym 65365 "Pageup")
86     (ext:define-keysym 65367 "End")
87     (ext:define-keysym 65366 "Pagedown")
88    
89     ;;; Arrows.
90     ;;;
91     (ext:define-keysym 65361 "Leftarrow")
92     (ext:define-keysym 65362 "Uparrow")
93     (ext:define-keysym 65364 "Downarrow")
94     (ext:define-keysym 65363 "Rightarrow")
95    
96     ;;; Number pad.
97     ;;;
98     (ext:define-keysym 65407 "Numlock")
99     (ext:define-keysym 65421 "Numpad\-Return" "Numpad\-Enter") ;num-pad-enter
100     (ext:define-keysym 65455 "Numpad/") ;num-pad-/
101     (ext:define-keysym 65450 "Numpad*") ;num-pad-*
102     (ext:define-keysym 65453 "Numpad-") ;num-pad--
103     (ext:define-keysym 65451 "Numpad+") ;num-pad-+
104     (ext:define-keysym 65456 "Numpad0") ;num-pad-0
105     (ext:define-keysym 65457 "Numpad1") ;num-pad-1
106     (ext:define-keysym 65458 "Numpad2") ;num-pad-2
107     (ext:define-keysym 65459 "Numpad3") ;num-pad-3
108     (ext:define-keysym 65460 "Numpad4") ;num-pad-4
109     (ext:define-keysym 65461 "Numpad5") ;num-pad-5
110     (ext:define-keysym 65462 "Numpad6") ;num-pad-6
111     (ext:define-keysym 65463 "Numpad7") ;num-pad-7
112     (ext:define-keysym 65464 "Numpad8") ;num-pad-8
113     (ext:define-keysym 65465 "Numpad9") ;num-pad-9
114     (ext:define-keysym 65454 "Numpad.") ;num-pad-.
115    
116     ;;; "Named" keys.
117     ;;;
118     (ext:define-keysym 65289 "Tab")
119     (ext:define-keysym 65307 "Escape" "Altmode" "Alt") ;escape
120     (ext:define-keysym 65288 "Backspace") ;backspace
121     (ext:define-keysym 65293 "Return" "Enter") ;enter
122     (ext:define-keysym 65512 "Linefeed" "Action" "Newline") ;action
123     (ext:define-keysym 32 "Space" " ")
124    
125     ;;; Letters.
126     ;;;
127     (ext:define-keysym 97 "a") (ext:define-keysym 65 "A")
128     (ext:define-keysym 98 "b") (ext:define-keysym 66 "B")
129     (ext:define-keysym 99 "c") (ext:define-keysym 67 "C")
130     (ext:define-keysym 100 "d") (ext:define-keysym 68 "D")
131     (ext:define-keysym 101 "e") (ext:define-keysym 69 "E")
132     (ext:define-keysym 102 "f") (ext:define-keysym 70 "F")
133     (ext:define-keysym 103 "g") (ext:define-keysym 71 "G")
134     (ext:define-keysym 104 "h") (ext:define-keysym 72 "H")
135     (ext:define-keysym 105 "i") (ext:define-keysym 73 "I")
136     (ext:define-keysym 106 "j") (ext:define-keysym 74 "J")
137     (ext:define-keysym 107 "k") (ext:define-keysym 75 "K")
138     (ext:define-keysym 108 "l") (ext:define-keysym 76 "L")
139     (ext:define-keysym 109 "m") (ext:define-keysym 77 "M")
140     (ext:define-keysym 110 "n") (ext:define-keysym 78 "N")
141     (ext:define-keysym 111 "o") (ext:define-keysym 79 "O")
142     (ext:define-keysym 112 "p") (ext:define-keysym 80 "P")
143     (ext:define-keysym 113 "q") (ext:define-keysym 81 "Q")
144     (ext:define-keysym 114 "r") (ext:define-keysym 82 "R")
145     (ext:define-keysym 115 "s") (ext:define-keysym 83 "S")
146     (ext:define-keysym 116 "t") (ext:define-keysym 84 "T")
147     (ext:define-keysym 117 "u") (ext:define-keysym 85 "U")
148     (ext:define-keysym 118 "v") (ext:define-keysym 86 "V")
149     (ext:define-keysym 119 "w") (ext:define-keysym 87 "W")
150     (ext:define-keysym 120 "x") (ext:define-keysym 88 "X")
151     (ext:define-keysym 121 "y") (ext:define-keysym 89 "Y")
152     (ext:define-keysym 122 "z") (ext:define-keysym 90 "Z")
153    
154     ;;; Standard number keys.
155     ;;;
156     (ext:define-keysym 49 "1") (ext:define-keysym 33 "!")
157     (ext:define-keysym 50 "2") (ext:define-keysym 64 "@")
158     (ext:define-keysym 51 "3") (ext:define-keysym 35 "#")
159     (ext:define-keysym 52 "4") (ext:define-keysym 36 "$")
160     (ext:define-keysym 53 "5") (ext:define-keysym 37 "%")
161     (ext:define-keysym 54 "6") (ext:define-keysym 94 "^")
162     (ext:define-keysym 55 "7") (ext:define-keysym 38 "&")
163     (ext:define-keysym 56 "8") (ext:define-keysym 42 "*")
164     (ext:define-keysym 57 "9") (ext:define-keysym 40 "(")
165     (ext:define-keysym 48 "0") (ext:define-keysym 41 ")")
166    
167     ;;; "Standard" symbol keys.
168     ;;;
169     (ext:define-keysym 96 "`") (ext:define-keysym 126 "~")
170     (ext:define-keysym 45 "-") (ext:define-keysym 95 "_")
171     (ext:define-keysym 61 "=") (ext:define-keysym 43 "+")
172     (ext:define-keysym 91 "[") (ext:define-keysym 123 "{")
173     (ext:define-keysym 93 "]") (ext:define-keysym 125 "}")
174     (ext:define-keysym 92 "\\") (ext:define-keysym 124 "|")
175     (ext:define-keysym 59 ";") (ext:define-keysym 58 ":")
176     (ext:define-keysym 39 "'") (ext:define-keysym 34 "\"")
177     (ext:define-keysym 44 ",") (ext:define-keysym 60 "<")
178     (ext:define-keysym 46 ".") (ext:define-keysym 62 ">")
179     (ext:define-keysym 47 "/") (ext:define-keysym 63 "?")
180    
181     ;;; Standard Mouse keysyms.
182     ;;;
183     (ext::define-mouse-keysym 1 25601 "Leftdown" "Super" :button-press)
184     (ext::define-mouse-keysym 1 25602 "Leftup" "Super" :button-release)
185    
186     (ext::define-mouse-keysym 2 25603 "Middledown" "Super" :button-press)
187     (ext::define-mouse-keysym 2 25604 "Middleup" "Super" :button-release)
188    
189     (ext::define-mouse-keysym 3 25605 "Rightdown" "Super" :button-press)
190     (ext::define-mouse-keysym 3 25606 "Rightup" "Super" :button-release)
191    
192     ;;; Sun keyboard.
193     ;;;
194     (ext:define-keysym 65387 "break") ;alternate (Sun).
195     ;(ext:define-keysym 65290 "linefeed")
196    
197    
198    
199     ;;;; SETFs of KEY-EVANT-CHAR and CHAR-KEY-EVENT.
200    
201     ;;; Converting ASCII control characters to Common Lisp control characters:
202     ;;; ASCII control character codes are separated from the codes of the
203     ;;; "non-controlified" characters by the code of atsign. The ASCII control
204     ;;; character codes range from ^@ (0) through ^_ (one less than the code of
205     ;;; space). We iterate over this range adding the ASCII code of atsign to
206     ;;; get the "non-controlified" character code. With each of these, we turn
207     ;;; the code into a Common Lisp character and set its :control bit. Certain
208     ;;; ASCII control characters have to be translated to special Common Lisp
209     ;;; characters outside of the loop.
210     ;;; With the advent of Hemlock running under X, and all the key bindings
211     ;;; changing, we also downcase each Common Lisp character (where normally
212     ;;; control characters come in upcased) in an effort to obtain normal command
213     ;;; bindings. Commands bound to uppercase modified characters will not be
214     ;;; accessible to terminal interaction.
215     ;;;
216     (let ((@-code (char-code #\@)))
217     (dotimes (i (char-code #\space))
218     (setf (ext:char-key-event (code-char i))
219     (ext::make-key-event (string (char-downcase (code-char (+ i @-code))))
220     (key-event-modifier-mask "control")))))
221     (setf (ext:char-key-event (code-char 9)) (ext::make-key-event #k"Tab"))
222     (setf (ext:char-key-event (code-char 10)) (ext::make-key-event #k"Linefeed"))
223     (setf (ext:char-key-event (code-char 13)) (ext::make-key-event #k"Return"))
224     (setf (ext:char-key-event (code-char 27)) (ext::make-key-event #k"Alt"))
225     (setf (ext:char-key-event (code-char 8)) (ext::make-key-event #k"Backspace"))
226     ;;;
227     ;;; Other ASCII codes are exactly the same as the Common Lisp codes.
228     ;;;
229     (do ((i (char-code #\space) (1+ i)))
230     ((= i 128))
231     (setf (ext:char-key-event (code-char i))
232     (ext::make-key-event (string (code-char i)))))
233    
234     ;;; This makes KEY-EVENT-CHAR the inverse of CHAR-KEY-EVENT from the start.
235     ;;; It need not be this way, but it is.
236     ;;;
237     (dotimes (i 128)
238     (let ((character (code-char i)))
239     (setf (ext::key-event-char (ext:char-key-event character)) character)))
240    
241     ;;; Since we treated these characters specially above when setting
242     ;;; EXT:CHAR-KEY-EVENT above, we must set these EXT:KEY-EVENT-CHAR's specially
243     ;;; to make quoting characters into Hemlock buffers more obvious for users.
244     ;;;
245     (setf (ext:key-event-char #k"C-h") #\backspace)
246     (setf (ext:key-event-char #k"C-i") #\tab)
247     (setf (ext:key-event-char #k"C-j") #\linefeed)
248     (setf (ext:key-event-char #k"C-m") #\return)

  ViewVC Help
Powered by ViewVC 1.1.5