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

  ViewVC Help
Powered by ViewVC 1.1.5