Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 2828:a25c824ed558
[xemacs-hg @ 2005-06-26 18:04:49 by aidan]
Rename the ascii-character property, support more keysyms.
author | aidan |
---|---|
date | Sun, 26 Jun 2005 18:05:05 +0000 |
parents | 96036853a107 |
children | c1ec282bb160 |
comparison
equal
deleted
inserted
replaced
2827:936a6576c655 | 2828:a25c824ed558 |
---|---|
69 | 69 |
70 #ifdef WIN32_ANY | 70 #ifdef WIN32_ANY |
71 extern int mswindows_is_blocking; | 71 extern int mswindows_is_blocking; |
72 #endif | 72 #endif |
73 | 73 |
74 EXFUN (Funicode_to_char, 2); /* In unicode.c. */ | 74 /* For Russian C-x processing. */ |
75 #define FIRST_ALPHABETIC_QWERTY_KEYCODE 24 | |
76 #define LAST_ALPHABETIC_QWERTY_KEYCODE 58 | |
75 | 77 |
76 /* used in glyphs-x.c */ | 78 /* used in glyphs-x.c */ |
77 void enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p); | 79 void enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p); |
78 static void handle_focus_event_1 (struct frame *f, int in_p); | 80 static void handle_focus_event_1 (struct frame *f, int in_p); |
79 static void handle_focus_event_2 (Window w, struct frame *f, int in_p); | 81 static void handle_focus_event_2 (Window w, struct frame *f, int in_p); |
134 | 136 |
135 /************************************************************************/ | 137 /************************************************************************/ |
136 /* keymap handling */ | 138 /* keymap handling */ |
137 /************************************************************************/ | 139 /************************************************************************/ |
138 | 140 |
139 /* X bogusly doesn't define the interpretations of any bits besides | 141 /* See comment near character_to_event(). */ |
140 ModControl, ModShift, and ModLock; so the Interclient Communication | 142 static void |
141 Conventions Manual says that we have to bend over backwards to figure | 143 maybe_define_x_key_as_self_inserting_character (KeySym keysym, |
142 out what the other modifier bits mean. According to ICCCM: | 144 Lisp_Object symbol) |
143 | |
144 - Any keycode which is assigned ModControl is a "control" key. | |
145 | |
146 - Any modifier bit which is assigned to a keycode which generates Meta_L | |
147 or Meta_R is the modifier bit meaning "meta". Likewise for Super, Hyper, | |
148 etc. | |
149 | |
150 - Any keypress event which contains ModControl in its state should be | |
151 interpreted as a "control" character. | |
152 | |
153 - Any keypress event which contains a modifier bit in its state which is | |
154 generated by a keycode whose corresponding keysym is Meta_L or Meta_R | |
155 should be interpreted as a "meta" character. Likewise for Super, Hyper, | |
156 etc. | |
157 | |
158 - It is illegal for a keysym to be associated with more than one modifier | |
159 bit. | |
160 | |
161 This means that the only thing that emacs can reasonably interpret as a | |
162 "meta" key is a key whose keysym is Meta_L or Meta_R, and which generates | |
163 one of the modifier bits Mod1-Mod5. | |
164 | |
165 Unfortunately, many keyboards don't have Meta keys in their default | |
166 configuration. So, if there are no Meta keys, but there are "Alt" keys, | |
167 emacs will interpret Alt as Meta. If there are both Meta and Alt keys, | |
168 then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to | |
169 mean "Symbol," but that just confused the hell out of way too many people). | |
170 | |
171 This works with the default configurations of the 19 keyboard-types I've | |
172 checked. | |
173 | |
174 Emacs detects keyboard configurations which violate the above rules, and | |
175 prints an error message on the standard-error-output. (Perhaps it should | |
176 use a pop-up-window instead.) | |
177 */ | |
178 | |
179 /* For every key on the keyboard that has a known character correspondence, | |
180 we define the ascii-character property of the keysym, and make the | |
181 default binding for the key be self-insert-command. | |
182 | |
183 The following magic is basically intimate knowledge of X11/keysymdef.h. | |
184 The keysym mappings defined by X11 are based on the iso8859 standards, | |
185 except for Cyrillic and Greek. | |
186 | |
187 In a non-Mule world, a user can still have a multi-lingual editor, by doing | |
188 (set-face-font "...-iso8859-2" (current-buffer)) | |
189 for all their Latin-2 buffers, etc. */ | |
190 | |
191 static Lisp_Object | |
192 x_keysym_to_character (KeySym keysym) | |
193 { | |
194 #ifdef MULE | |
195 Lisp_Object charset = Qzero; | |
196 #define USE_CHARSET(var,cs) \ | |
197 ((var) = charset_by_leading_byte (LEADING_BYTE_##cs)) | |
198 #else | |
199 #define USE_CHARSET(var,lb) | |
200 #endif /* MULE */ | |
201 int code = 0; | |
202 | |
203 if ((keysym & 0xff) < 0xa0) | |
204 return Qnil; | |
205 | |
206 /* The spec says keysyms in the range #x01000100 to #x0110FFFF and | |
207 only those should correspond directly to Unicode code points, in | |
208 the range #x100-#x10FFFF; actual implementations can have the Latin | |
209 1 code points do the same thing with keysyms | |
210 #x010000A0-#x01000100. Oops. */ | |
211 | |
212 if (keysym >= 0x010000A0 && keysym <= 0x0110FFFF) | |
213 return Funicode_to_char (make_int(keysym & 0xffffff), Qnil); | |
214 | |
215 switch (keysym >> 8) | |
216 { | |
217 case 0: /* ASCII + Latin1 */ | |
218 USE_CHARSET (charset, LATIN_ISO8859_1); | |
219 code = keysym & 0x7f; | |
220 break; | |
221 case 1: /* Latin2 */ | |
222 USE_CHARSET (charset, LATIN_ISO8859_2); | |
223 code = keysym & 0x7f; | |
224 break; | |
225 case 2: /* Latin3 */ | |
226 USE_CHARSET (charset, LATIN_ISO8859_3); | |
227 code = keysym & 0x7f; | |
228 break; | |
229 case 3: /* Latin4 */ | |
230 USE_CHARSET (charset, LATIN_ISO8859_4); | |
231 code = keysym & 0x7f; | |
232 break; | |
233 case 4: /* Katakana */ | |
234 USE_CHARSET (charset, KATAKANA_JISX0201); | |
235 if ((keysym & 0xff) > 0xa0) | |
236 code = keysym & 0x7f; | |
237 break; | |
238 case 5: /* Arabic */ | |
239 USE_CHARSET (charset, ARABIC_ISO8859_6); | |
240 code = keysym & 0x7f; | |
241 break; | |
242 case 6: /* Cyrillic */ | |
243 { | |
244 static unsigned char const cyrillic[] = /* 0x20 - 0x7f */ | |
245 {0x00, 0x72, 0x73, 0x71, 0x74, 0x75, 0x76, 0x77, | |
246 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x00, 0x7e, 0x7f, | |
247 0x70, 0x22, 0x23, 0x21, 0x24, 0x25, 0x26, 0x27, | |
248 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x00, 0x2e, 0x2f, | |
249 0x6e, 0x50, 0x51, 0x66, 0x54, 0x55, 0x64, 0x53, | |
250 0x65, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, | |
251 0x5f, 0x6f, 0x60, 0x61, 0x62, 0x63, 0x56, 0x52, | |
252 0x6c, 0x6b, 0x57, 0x68, 0x6d, 0x69, 0x67, 0x6a, | |
253 0x4e, 0x30, 0x31, 0x46, 0x34, 0x35, 0x44, 0x33, | |
254 0x45, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, | |
255 0x3f, 0x4f, 0x40, 0x41, 0x42, 0x43, 0x36, 0x32, | |
256 0x4c, 0x4b, 0x37, 0x48, 0x4d, 0x49, 0x47, 0x4a}; | |
257 USE_CHARSET (charset, CYRILLIC_ISO8859_5); | |
258 code = cyrillic[(keysym & 0x7f) - 0x20]; | |
259 break; | |
260 } | |
261 case 7: /* Greek */ | |
262 { | |
263 static unsigned char const greek[] = /* 0x20 - 0x7f */ | |
264 {0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c, | |
265 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f, | |
266 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c, | |
267 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, | |
268 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | |
269 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
270 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57, | |
271 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
272 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | |
273 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
274 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77, | |
275 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | |
276 USE_CHARSET (charset, GREEK_ISO8859_7); | |
277 code = greek[(keysym & 0x7f) - 0x20]; | |
278 break; | |
279 } | |
280 case 8: /* Technical */ | |
281 break; | |
282 case 9: /* Special */ | |
283 break; | |
284 case 10: /* Publishing */ | |
285 break; | |
286 case 11: /* APL */ | |
287 break; | |
288 case 12: /* Hebrew */ | |
289 USE_CHARSET (charset, HEBREW_ISO8859_8); | |
290 code = keysym & 0x7f; | |
291 break; | |
292 case 13: /* Thai */ | |
293 /* #### This needs to deal with character composition. */ | |
294 USE_CHARSET (charset, THAI_TIS620); | |
295 code = keysym & 0x7f; | |
296 break; | |
297 case 14: /* Korean Hangul */ | |
298 break; | |
299 case 19: /* Latin 9 - ISO8859-15 - unsupported charset. */ | |
300 break; | |
301 case 32: /* Currency */ | |
302 break; | |
303 default: | |
304 break; | |
305 } | |
306 | |
307 if (code == 0) | |
308 return Qnil; | |
309 | |
310 #ifdef MULE | |
311 return make_char (make_ichar (charset, code, 0)); | |
312 #else | |
313 return make_char (code + 0x80); | |
314 #endif | |
315 } | |
316 | |
317 /* See comment near character_to_event(). | |
318 */ | |
319 static void | |
320 maybe_define_x_key_as_self_inserting_character (KeySym keysym, Lisp_Object symbol) | |
321 { | 145 { |
322 Lisp_Object character = x_keysym_to_character (keysym); | 146 Lisp_Object character = x_keysym_to_character (keysym); |
323 | 147 |
324 if (CHARP (character)) | 148 if (CHARP (character)) |
325 { | 149 { |
326 extern Lisp_Object Vcurrent_global_map; | 150 extern Lisp_Object Vcurrent_global_map; |
327 extern Lisp_Object Qascii_character; | 151 extern Lisp_Object Qcharacter_of_keysym; |
328 if (NILP (Flookup_key (Vcurrent_global_map, symbol, Qnil))) | 152 if (NILP (Flookup_key (Vcurrent_global_map, symbol, Qnil))) |
329 { | 153 { |
330 Fput (symbol, Qascii_character, character); | 154 Fput (symbol, Qcharacter_of_keysym, character); |
331 Fdefine_key (Vcurrent_global_map, symbol, Qself_insert_command); | 155 Fdefine_key (Vcurrent_global_map, symbol, Qself_insert_command); |
332 } | 156 } |
333 } | 157 } |
334 } | 158 } |
335 | 159 |
336 static void | 160 void |
337 x_has_keysym (KeySym keysym, Lisp_Object hash_table, int with_modifiers) | 161 x_has_keysym (KeySym keysym, Lisp_Object hash_table, int with_modifiers) |
338 { | 162 { |
339 KeySym upper_lower[2]; | 163 KeySym upper_lower[2]; |
340 int j; | 164 int j; |
341 | 165 |
353 upper_lower[0] = upper_lower[1] = keysym; | 177 upper_lower[0] = upper_lower[1] = keysym; |
354 #endif | 178 #endif |
355 | 179 |
356 for (j = 0; j < (upper_lower[0] == upper_lower[1] ? 1 : 2); j++) | 180 for (j = 0; j < (upper_lower[0] == upper_lower[1] ? 1 : 2); j++) |
357 { | 181 { |
358 char *name; | 182 Extbyte *name; |
359 keysym = upper_lower[j]; | 183 keysym = upper_lower[j]; |
360 | 184 |
361 name = XKeysymToString (keysym); | 185 name = XKeysymToString (keysym); |
362 if (name) | 186 if (name) |
363 { | 187 { |
369 if (! EQ (old_value, new_value) | 193 if (! EQ (old_value, new_value) |
370 && ! (EQ (old_value, Qsans_modifiers) && | 194 && ! (EQ (old_value, Qsans_modifiers) && |
371 EQ (new_value, Qt))) | 195 EQ (new_value, Qt))) |
372 { | 196 { |
373 maybe_define_x_key_as_self_inserting_character (keysym, sym); | 197 maybe_define_x_key_as_self_inserting_character (keysym, sym); |
374 Fputhash (build_ext_string (name, Qbinary), new_value, hash_table); | 198 Fputhash (build_ext_string (name, Qbinary), new_value, |
199 hash_table); | |
375 Fputhash (sym, new_value, hash_table); | 200 Fputhash (sym, new_value, hash_table); |
376 } | 201 } |
377 } | 202 } |
378 } | 203 } |
379 } | 204 } |
424 x_has_keysym (keysym[j], hash_table, 1); | 249 x_has_keysym (keysym[j], hash_table, 1); |
425 } | 250 } |
426 } | 251 } |
427 } | 252 } |
428 | 253 |
429 static const char * | 254 static const Ascbyte * |
430 index_to_name (int indice) | 255 index_to_name (int indice) |
431 { | 256 { |
432 switch (indice) | 257 switch (indice) |
433 { | 258 { |
434 case ShiftMapIndex: return "ModShift"; | 259 case ShiftMapIndex: return "ModShift"; |
441 case Mod5MapIndex: return "Mod5"; | 266 case Mod5MapIndex: return "Mod5"; |
442 default: return "???"; | 267 default: return "???"; |
443 } | 268 } |
444 } | 269 } |
445 | 270 |
446 /* Boy, I really wish C had local functions... */ | 271 /* X bogusly doesn't define the interpretations of any bits besides |
447 struct c_doesnt_have_closures /* #### not yet used */ | 272 ModControl, ModShift, and ModLock; so the Interclient Communication |
448 { | 273 Conventions Manual says that we have to bend over backwards to figure |
449 int warned_about_overlapping_modifiers; | 274 out what the other modifier bits mean. According to ICCCM: |
450 int warned_about_predefined_modifiers; | 275 |
451 int warned_about_duplicate_modifiers; | 276 - Any keycode which is assigned ModControl is a "control" key. |
452 int meta_bit; | 277 |
453 int hyper_bit; | 278 - Any modifier bit which is assigned to a keycode which generates Meta_L |
454 int super_bit; | 279 or Meta_R is the modifier bit meaning "meta". Likewise for Super, Hyper, |
455 int alt_bit; | 280 etc. |
456 int mode_bit; | 281 |
457 }; | 282 - Any keypress event which contains ModControl in its state should be |
283 interpreted as a "control" character. | |
284 | |
285 - Any keypress event which contains a modifier bit in its state which is | |
286 generated by a keycode whose corresponding keysym is Meta_L or Meta_R | |
287 should be interpreted as a "meta" character. Likewise for Super, Hyper, | |
288 etc. | |
289 | |
290 - It is illegal for a keysym to be associated with more than one modifier | |
291 bit. | |
292 | |
293 This means that the only thing that emacs can reasonably interpret as a | |
294 "meta" key is a key whose keysym is Meta_L or Meta_R, and which generates | |
295 one of the modifier bits Mod1-Mod5. | |
296 | |
297 Unfortunately, many keyboards don't have Meta keys in their default | |
298 configuration. So, if there are no Meta keys, but there are "Alt" keys, | |
299 emacs will interpret Alt as Meta. If there are both Meta and Alt keys, | |
300 then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to | |
301 mean "Symbol," but that just confused the hell out of way too many people). | |
302 | |
303 This works with the default configurations of the 19 keyboard-types I've | |
304 checked. | |
305 | |
306 Emacs detects keyboard configurations which violate the above rules, and | |
307 gives a warning. */ | |
458 | 308 |
459 static void | 309 static void |
460 x_reset_modifier_mapping (struct device *d) | 310 x_reset_modifier_mapping (struct device *d) |
461 { | 311 { |
462 Display *display = DEVICE_X_DISPLAY (d); | 312 Display *display = DEVICE_X_DISPLAY (d); |
579 interpret that bit as Meta, because we can't make XLookupString() | 429 interpret that bit as Meta, because we can't make XLookupString() |
580 not interpret it as Mode_switch; and interpreting it as both would | 430 not interpret it as Mode_switch; and interpreting it as both would |
581 be totally wrong. */ | 431 be totally wrong. */ |
582 if (mode_bit) | 432 if (mode_bit) |
583 { | 433 { |
584 const char *warn = 0; | 434 const Ascbyte *warn = 0; |
585 if (mode_bit == meta_bit) warn = "Meta", meta_bit = 0; | 435 if (mode_bit == meta_bit) warn = "Meta", meta_bit = 0; |
586 else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0; | 436 else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0; |
587 else if (mode_bit == super_bit) warn = "Super", super_bit = 0; | 437 else if (mode_bit == super_bit) warn = "Super", super_bit = 0; |
588 else if (mode_bit == alt_bit) warn = "Alt", alt_bit = 0; | 438 else if (mode_bit == alt_bit) warn = "Alt", alt_bit = 0; |
589 if (warn) | 439 if (warn) |
891 /************************************************************************/ | 741 /************************************************************************/ |
892 | 742 |
893 static Lisp_Object | 743 static Lisp_Object |
894 x_keysym_to_emacs_keysym (KeySym keysym, int simple_p) | 744 x_keysym_to_emacs_keysym (KeySym keysym, int simple_p) |
895 { | 745 { |
896 char *name; | 746 Extbyte *name; |
747 DECLARE_EISTRING(einame); | |
748 | |
897 if (keysym >= XK_exclam && keysym <= XK_asciitilde) | 749 if (keysym >= XK_exclam && keysym <= XK_asciitilde) |
898 /* We must assume that the X keysym numbers for the ASCII graphic | 750 /* We must assume that the X keysym numbers for the ASCII graphic |
899 characters are the same as their ASCII codes. */ | 751 characters are the same as their ASCII codes. */ |
900 return make_char (keysym); | 752 return make_char (keysym); |
901 | 753 |
912 case XK_space: return QKspace; | 764 case XK_space: return QKspace; |
913 case XK_Delete: return QKdelete; | 765 case XK_Delete: return QKdelete; |
914 case 0: return Qnil; | 766 case 0: return Qnil; |
915 default: | 767 default: |
916 if (simple_p) return Qnil; | 768 if (simple_p) return Qnil; |
917 /* !!#### not Mule-ized */ | |
918 name = XKeysymToString (keysym); | 769 name = XKeysymToString (keysym); |
919 if (!name || !name[0]) | 770 if (!name || !name[0]) |
920 /* This happens if there is a mismatch between the Xlib of | 771 /* This happens if there is a mismatch between the Xlib of |
921 XEmacs and the Xlib of the X server... | 772 XEmacs and the Xlib of the X server... |
922 | 773 |
940 | 791 |
941 case 0x1005FF10: return KEYSYM ("SunF36"); /* labeled F11 */ | 792 case 0x1005FF10: return KEYSYM ("SunF36"); /* labeled F11 */ |
942 case 0x1005FF11: return KEYSYM ("SunF37"); /* labeled F12 */ | 793 case 0x1005FF11: return KEYSYM ("SunF37"); /* labeled F12 */ |
943 default: | 794 default: |
944 { | 795 { |
945 char buf [64]; | 796 Ascbyte buf [64]; |
946 sprintf (buf, "unknown-keysym-0x%X", (int) keysym); | 797 sprintf (buf, "unknown-keysym-0x%X", (int) keysym); |
947 return KEYSYM (buf); | 798 return KEYSYM (buf); |
948 } | 799 } |
949 } | 800 } |
801 | |
950 /* If it's got a one-character name, that's good enough. */ | 802 /* If it's got a one-character name, that's good enough. */ |
951 if (!name[1]) | 803 if (!name[1]) |
952 return make_char (name[0]); | 804 return make_char ((Ichar)name[0]); |
805 | |
806 /* In theory the Host Portable Character Set is just ASCII, but | |
807 trusting X11 implementors to get that right is likely to lead to | |
808 tears. */ | |
809 eicpy_ext(einame, name, Qbinary); | |
953 | 810 |
954 /* If it's in the "Keyboard" character set, downcase it. | 811 /* If it's in the "Keyboard" character set, downcase it. |
955 The case of those keysyms is too totally random for us to | 812 The case of those keysyms is too totally random for us to |
956 force anyone to remember them. | 813 force anyone to remember them. |
957 The case of the other character sets is significant, however. | 814 The case of the other character sets is significant, however. */ |
958 */ | |
959 if ((((unsigned int) keysym) & (~0x1FF)) == ((unsigned int) 0xFE00)) | 815 if ((((unsigned int) keysym) & (~0x1FF)) == ((unsigned int) 0xFE00)) |
960 { | 816 { |
961 char buf [255]; | 817 Ibyte *iname; |
962 char *s1, *s2; | 818 eilwr(einame); |
963 for (s1 = name, s2 = buf; *s1; s1++, s2++) { | 819 |
964 if (*s1 == '_') { | 820 for (iname = eidata(einame); *iname != '\0';) |
965 *s2 = '-'; | 821 { |
966 } else { | 822 if (*iname == '_') |
967 *s2 = tolower (* (unsigned char *) s1); | 823 { |
824 *iname = '-'; | |
825 } | |
826 INC_IBYTEPTR(iname); | |
968 } | 827 } |
969 } | |
970 *s2 = 0; | |
971 return KEYSYM (buf); | |
972 } | 828 } |
973 return KEYSYM (name); | 829 return KEYSYM (eidata(einame)); |
974 } | 830 } |
975 } | 831 } |
976 | 832 |
977 static Lisp_Object | 833 static Lisp_Object |
978 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) | 834 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) |
1137 Display *display = x_event->xany.display; | 993 Display *display = x_event->xany.display; |
1138 struct device *d = get_device_from_display (display); | 994 struct device *d = get_device_from_display (display); |
1139 struct x_device *xd = DEVICE_X_DATA (d); | 995 struct x_device *xd = DEVICE_X_DATA (d); |
1140 | 996 |
1141 if (DEVICE_X_BEING_DELETED (d)) | 997 if (DEVICE_X_BEING_DELETED (d)) |
1142 /* #### Uh, is this 0 correct? */ | 998 { |
1143 return 0; | 999 /* [[ Uh, is this 0 correct? ]] |
1000 | |
1001 Yup--it means emacs_Xt_event_handler, the only place that calls | |
1002 this, doesn't queue the emacs_event dispatch, instead immediately | |
1003 deallocating it. */ | |
1004 return 0; | |
1005 } | |
1144 | 1006 |
1145 set_last_server_timestamp (d, x_event); | 1007 set_last_server_timestamp (d, x_event); |
1146 | 1008 |
1147 switch (x_event->type) | 1009 switch (x_event->type) |
1148 { | 1010 { |
1241 shift modifier to two-case keys (that is, A-Z and | 1103 shift modifier to two-case keys (that is, A-Z and |
1242 related characters). So at this point (after looking up | 1104 related characters). So at this point (after looking up |
1243 the keysym) if the keysym isn't a dual-case alphabetic, | 1105 the keysym) if the keysym isn't a dual-case alphabetic, |
1244 and if the caps lock key was down but the shift key | 1106 and if the caps lock key was down but the shift key |
1245 wasn't, then turn off the shift modifier. Gag barf */ | 1107 wasn't, then turn off the shift modifier. Gag barf */ |
1108 | |
1246 /* #### type lossage: assuming equivalence of emacs and | 1109 /* #### type lossage: assuming equivalence of emacs and |
1247 X keysyms */ | 1110 X keysyms |
1248 /* !!#### maybe fix for Mule */ | 1111 |
1112 The right thing to do here is to have pass a third, pointer, | |
1113 argument to x_to_emacs_keysym, where it should store the | |
1114 intermediate KeySym it used to calculate the string XEmacs | |
1115 keysym. Then we can call keysym_obeys_caps_lock_p with | |
1116 exactly the right argument. */ | |
1117 /* !!#### maybe fix for Mule | |
1118 | |
1119 Hard, in the absence of a full case infrastructure for | |
1120 Mule characters. When | |
1121 (downcase (make-char 'cyrillic-iso8859-5 73)) | |
1122 works, we should revisit it. */ | |
1123 | |
1249 if (lock_p && !shift_p && | 1124 if (lock_p && !shift_p && |
1250 ! (CHAR_OR_CHAR_INTP (keysym) | 1125 ! (CHAR_OR_CHAR_INTP (keysym) |
1251 && keysym_obeys_caps_lock_p | 1126 && keysym_obeys_caps_lock_p |
1252 ((KeySym) XCHAR_OR_CHAR_INT (keysym), d))) | 1127 ((KeySym) XCHAR_OR_CHAR_INT (keysym), d))) |
1253 modifiers &= (~XEMACS_MOD_SHIFT); | 1128 modifiers &= (~XEMACS_MOD_SHIFT); |
1272 } | 1147 } |
1273 set_event_type (emacs_event, key_press_event); | 1148 set_event_type (emacs_event, key_press_event); |
1274 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | 1149 SET_EVENT_TIMESTAMP (emacs_event, ev->time); |
1275 SET_EVENT_KEY_MODIFIERS (emacs_event, modifiers); | 1150 SET_EVENT_KEY_MODIFIERS (emacs_event, modifiers); |
1276 SET_EVENT_KEY_KEYSYM (emacs_event, keysym); | 1151 SET_EVENT_KEY_KEYSYM (emacs_event, keysym); |
1152 | |
1153 if (ev->keycode >= FIRST_ALPHABETIC_QWERTY_KEYCODE | |
1154 && ev->keycode <= LAST_ALPHABETIC_QWERTY_KEYCODE) | |
1155 { | |
1156 /* This correspondence isn't guaranteed by the standards, to | |
1157 my knowledge. Also, it's incomplete--doesn't include the | |
1158 upper-case characters, etc--I need to get some feedback | |
1159 on it once this is out in the world and actually being | |
1160 used by Russians. */ | |
1161 static const Ascbyte qwerty_map[] = | |
1162 { 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', | |
1163 '[', ']', '\015', '\014', | |
1164 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', | |
1165 ';', '\'', '`', 0, '\\', | |
1166 'z', 'x', 'c', 'v', 'b', 'n', 'm' }; | |
1167 Ichar val = qwerty_map | |
1168 [ev->keycode - FIRST_ALPHABETIC_QWERTY_KEYCODE]; | |
1169 if (val) | |
1170 { | |
1171 SET_EVENT_KEY_ALT_KEYCHARS(emacs_event, KEYCHAR_QWERTY, | |
1172 val); | |
1173 } | |
1174 } | |
1277 } | 1175 } |
1278 else /* Mouse press/release event */ | 1176 else /* Mouse press/release event */ |
1279 { | 1177 { |
1280 XButtonEvent *ev = &x_event->xbutton; | 1178 XButtonEvent *ev = &x_event->xbutton; |
1281 struct frame *frame = x_window_to_frame (d, ev->window); | 1179 struct frame *frame = x_window_to_frame (d, ev->window); |