comparison lisp/x11/x-win-sun.el @ 74:54cc21c15cbb r20-0b32

Import from CVS: tag r20-0b32
author cvs
date Mon, 13 Aug 2007 09:04:33 +0200
parents 131b0175ea99
children 538048ae2ab8
comparison
equal deleted inserted replaced
73:e2d7a37b7c8d 74:54cc21c15cbb
34 ;; 34 ;;
35 ;; - Use xmodmap to give all keys more sensible names for all apps: 35 ;; - Use xmodmap to give all keys more sensible names for all apps:
36 ;; I use this shell script: 36 ;; I use this shell script:
37 ;; 37 ;;
38 ;; for i in 0 1 2 3 4 5 6 7 8 9 Add Subtract Multiply Divide Decimal ; do 38 ;; for i in 0 1 2 3 4 5 6 7 8 9 Add Subtract Multiply Divide Decimal ; do
39 ;; echo "keysym KP_$i = KP_$i" 39 ;; echo "keysym KP-$i = KP-$i"
40 ;; done 40 ;; done
41 ;; 41 ;;
42 ;; Clearly, as a good X11 citizen, we can't do this. 42 ;; Clearly, as a good X11 citizen, we can't do this.
43 ;; 43 ;;
44 ;; - Use keyboard-translate-table to remap the keybindings at a low level. 44 ;; - Use keyboard-translate-table to remap the keybindings at a low level.
46 ;; This is like running xmodmap within XEmacs only. 46 ;; This is like running xmodmap within XEmacs only.
47 ;; This is not the default, however, so that legacy keybindings in users' 47 ;; This is not the default, however, so that legacy keybindings in users'
48 ;; .emacs files like (global-set-key [(f35)] 'foo) continue to work 48 ;; .emacs files like (global-set-key [(f35)] 'foo) continue to work
49 ;; 49 ;;
50 ;; - Use keyboard macros to provide indirection for keybindings. 50 ;; - Use keyboard macros to provide indirection for keybindings.
51 ;; If we do (global-set-key [(f35)] [(kp_3)]), then the user's keybindings 51 ;; If we do (global-set-key [(f35)] [(kp-3)]), then the user's keybindings
52 ;; work whether he uses `f35' or `kp_3'. 52 ;; work whether he uses `f35' or `kp-3'.
53 ;; This is also compatible with FSF Emacs and other X11 apps. 53 ;; This is also compatible with FSF Emacs and other X11 apps.
54 ;; Although this has the disadvantage that these remappings 54 ;; Although this has the disadvantage that these remappings
55 ;; only work with the global key map, we use this as the default. 55 ;; only work with the global key map, we use this as the default.
56 ;; 56 ;;
57 ;; - The Right Way to do this remains to be written... 57 ;; - The Right Way to do this remains to be written...
85 ;; help is ok 85 ;; help is ok
86 ;; num_lock is ok 86 ;; num_lock is ok
87 ;; up is ok 87 ;; up is ok
88 ;; left is ok 88 ;; left is ok
89 ;; right is ok 89 ;; right is ok
90 ;; kp_add is ok 90 ;; kp-add is ok
91 ;; down is ok 91 ;; down is ok
92 ;; insert is ok 92 ;; insert is ok
93 ;; delete is ok 93 ;; delete is ok
94 ;; kp_enter is ok 94 ;; kp-enter is ok
95 (append 95 (append
96 ;; Sun Function keys 96 ;; Sun Function keys
97 (cond ((x-keysym-on-keyboard-p "F21") 97 (cond ((x-keysym-on-keyboard-p "F21")
98 '((f21 . pause) 98 '((f21 . pause)
99 (f22 . print) 99 (f22 . print)
115 (if (x-keysym-on-keyboard-p "F25") ; Sun Sparc keyboards 115 (if (x-keysym-on-keyboard-p "F25") ; Sun Sparc keyboards
116 (append 116 (append
117 '((f21 . pause) 117 '((f21 . pause)
118 (f22 . prsc) 118 (f22 . prsc)
119 (f23 . scroll) 119 (f23 . scroll)
120 (f25 . kp_divide) 120 (f25 . kp-divide)
121 (f26 . kp_multiply) 121 (f26 . kp-multiply)
122 (f31 . kp_5)) 122 (f31 . kp-5))
123 123
124 ;; Map f33 and r13 to end or kp_end 124 ;; Map f33 and r13 to end or kp-end
125 (cond 125 (cond
126 ((not (x-keysym-on-keyboard-p "End")) 126 ((not (x-keysym-on-keyboard-p "End"))
127 '((f33 . end) (r13 . end))) 127 '((f33 . end) (r13 . end)))
128 ((not (x-keysym-on-keyboard-p "KP_End")) 128 ((not (x-keysym-on-keyboard-p "KP_End"))
129 '((f33 . kp_end) (r13 . kp_end)))) 129 '((f33 . kp-end) (r13 . kp-end))))
130 130
131 (if (x-keysym-on-keyboard-p "F36") 131 (if (x-keysym-on-keyboard-p "F36")
132 '((f36 . stop) (f37 . again)) ; MIT Type 5 name 132 '((f36 . stop) (f37 . again)) ; MIT Type 5 name
133 '((f11 . stop) (f12 . again))) ; Sun name or MIT Type 4 name 133 '((f11 . stop) (f12 . again))) ; Sun name or MIT Type 4 name
134 134
135 ;; Type 4 keyboards have a real kp_subtract and a f24 labelled `=' 135 ;; Type 4 keyboards have a real kp-subtract and a f24 labelled `='
136 ;; Type 5 keyboards have no key labelled `=' and a f24 labelled `-' 136 ;; Type 5 keyboards have no key labelled `=' and a f24 labelled `-'
137 (if (x-keysym-on-keyboard-p "F24") 137 (if (x-keysym-on-keyboard-p "F24")
138 (if (x-keysym-on-keyboard-p "KP_Subtract") 138 (if (x-keysym-on-keyboard-p "KP_Subtract")
139 '((f24 . kp_equal)) 139 '((f24 . kp-equal))
140 '((f24 . kp_subtract)))) 140 '((f24 . kp-subtract))))
141 141
142 ;; Map f27 to home or kp_home, as appropriate 142 ;; Map f27 to home or kp-home, as appropriate
143 (cond ((not (x-keysym-on-keyboard-p "Home")) '((f27 . home))) 143 (cond ((not (x-keysym-on-keyboard-p "Home")) '((f27 . home)))
144 ((not (x-keysym-on-keyboard-p "KP_Home")) '((f27 . kp_home)))) 144 ((not (x-keysym-on-keyboard-p "KP_Home")) '((f27 . kp-home))))
145 145
146 ;; Map f29 to prior or kp_prior, as appropriate 146 ;; Map f29 to prior or kp-prior, as appropriate
147 (cond ((not (x-keysym-on-keyboard-p "Prior")) '((f29 . prior))) 147 (cond ((not (x-keysym-on-keyboard-p "Prior")) '((f29 . prior)))
148 ((not (x-keysym-on-keyboard-p "KP_Prior")) '((f29 . kp_prior)))) 148 ((not (x-keysym-on-keyboard-p "KP_Prior")) '((f29 . kp-prior))))
149 149
150 ;; Map f35 to next or kp_next, as appropriate 150 ;; Map f35 to next or kp-next, as appropriate
151 (cond ((not (x-keysym-on-keyboard-p "Next")) '((f35 . next))) 151 (cond ((not (x-keysym-on-keyboard-p "Next")) '((f35 . next)))
152 ((not (x-keysym-on-keyboard-p "KP_Next")) '((f35 . kp_next)))) 152 ((not (x-keysym-on-keyboard-p "KP_Next")) '((f35 . kp-next))))
153 )) 153 ))
154 154
155 (cond ((x-keysym-on-keyboard-p "apRead") ; SunOS 4.1.1 155 (cond ((x-keysym-on-keyboard-p "apRead") ; SunOS 4.1.1
156 '((apRead . f11) (apEdit . f12))) 156 '((apRead . f11) (apEdit . f12)))
157 ((x-keysym-on-keyboard-p "SunF36") ; SunOS 5 157 ((x-keysym-on-keyboard-p "SunF36") ; SunOS 5
158 '((SunF36 . f11) (SunF37 . f12)))) 158 '((SunF36 . f11) (SunF37 . f12))))
159 159
160 ;; !@#$ SunOS 4 with SunOS5 X server 160 ;; !@#$ SunOS 4 with SunOS5 X server
161 (if (string-match "sunos4.1" system-configuration) 161 (if (string-match "sunos4.1" system-configuration)
162 '((unknown_keysym_0xFF9A . kp_prior) 162 '((unknown_keysym_0xFF9A . kp-prior)
163 (unknown_keysym_0xFF9B . kp_next) 163 (unknown_keysym_0xFF9B . kp-next)
164 (unknown_keysym_0xFF95 . kp_home) 164 (unknown_keysym_0xFF95 . kp-home)
165 (unknown_keysym_0xFF9C . kp_end) 165 (unknown_keysym_0xFF9C . kp-end)
166 (unknown_keysym_0xFF96 . kp_left) 166 (unknown_keysym_0xFF96 . kp-left)
167 (unknown_keysym_0xFF97 . kp_up) 167 (unknown_keysym_0xFF97 . kp-up)
168 (unknown_keysym_0xFF98 . kp_right) 168 (unknown_keysym_0xFF98 . kp-right)
169 (unknown_keysym_0xFF99 . kp_down) 169 (unknown_keysym_0xFF99 . kp-down)
170 (unknown_keysym_0xFF9E . kp_insert))) 170 (unknown_keysym_0xFF9E . kp-insert)))
171 )) 171 ))
172 172
173 (fmakunbound 'x11-remap-keysyms-using-function-key-map) 173 (fmakunbound 'x11-remap-keysyms-using-function-key-map)
174 174
175 175
196 ;;; And I've made it into a function which is not called by default --mrb 196 ;;; And I've made it into a function which is not called by default --mrb
197 197
198 (defun sun-x11-keyboard-translate () 198 (defun sun-x11-keyboard-translate ()
199 "Remap Sun's X11 keyboard. 199 "Remap Sun's X11 keyboard.
200 Keys with names like `f35' are remapped, at a low level, 200 Keys with names like `f35' are remapped, at a low level,
201 to more mnemonic ones,like `kp_3'." 201 to more mnemonic ones,like `kp-3'."
202 (interactive) 202 (interactive)
203 203
204 (keyboard-translate 204 (keyboard-translate
205 'f11 'stop ; the type4 keyboard Sun/MIT name 205 'f11 'stop ; the type4 keyboard Sun/MIT name
206 'f36 'stop ; the type5 keyboard Sun name 206 'f36 'stop ; the type5 keyboard Sun name
224 ;; help is ok 224 ;; help is ok
225 'f21 'pause 225 'f21 'pause
226 'f22 'prsc 226 'f22 'prsc
227 'f23 'scroll 227 'f23 'scroll
228 ;; num_lock is ok 228 ;; num_lock is ok
229 ;;'f24 'kp_equal) ; type4 only! 229 ;;'f24 'kp-equal) ; type4 only!
230 'f25 'kp_divide ; 230 'f25 'kp-divide ;
231 'f26 'kp_multiply ; 231 'f26 'kp-multiply ;
232 'f24 'kp_subtract ; type5 only! 232 'f24 'kp-subtract ; type5 only!
233 'f27 'kp_7 ; 233 'f27 'kp-7 ;
234 ;; up is ok 234 ;; up is ok
235 'f29 'kp_9 235 'f29 'kp-9
236 ;; left is ok 236 ;; left is ok
237 'f31 'kp_5 237 'f31 'kp-5
238 ;; right is ok 238 ;; right is ok
239 ;; kp_add is ok 239 ;; kp-add is ok
240 'f33 'kp_1 ; the Sun name 240 'f33 'kp-1 ; the Sun name
241 'r13 'end ; the MIT name 241 'r13 'end ; the MIT name
242 ;; down is ok 242 ;; down is ok
243 'f35 'kp_3 243 'f35 'kp-3
244 ;; insert is ok 244 ;; insert is ok
245 ;; delete is ok 245 ;; delete is ok
246 ;; kp_enter is ok 246 ;; kp-enter is ok
247 'SunF36 'f11 ; Type 5 keyboards 247 'SunF36 'f11 ; Type 5 keyboards
248 'SunF37 'f12 ; Used to be Stop & Again 248 'SunF37 'f12 ; Used to be Stop & Again
249 )) 249 ))
250 250
251 251