comparison src/console-tty.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 04bc9d2f42c7
children ad0054aa11f1
comparison
equal deleted inserted replaced
2827:936a6576c655 2828:a25c824ed558
28 #include "lisp.h" 28 #include "lisp.h"
29 29
30 #include "console-tty-impl.h" 30 #include "console-tty-impl.h"
31 #include "console-stream.h" 31 #include "console-stream.h"
32 32
33 #include "elhash.h"
33 #include "faces.h" 34 #include "faces.h"
34 #include "file-coding.h" 35 #include "file-coding.h"
35 #include "frame.h" 36 #include "frame.h"
36 #include "glyphs.h" 37 #include "glyphs.h"
37 #include "lstream.h" 38 #include "lstream.h"
46 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); 47 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
47 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); 48 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit);
48 49
49 Lisp_Object Qterminal_type; 50 Lisp_Object Qterminal_type;
50 Lisp_Object Qcontrolling_process; 51 Lisp_Object Qcontrolling_process;
52
53 static Lisp_Object Qseen_characters;
51 54
52 static const struct memory_description tty_console_data_description_1 [] = { 55 static const struct memory_description tty_console_data_description_1 [] = {
53 { XD_LISP_OBJECT, offsetof (struct tty_console, terminal_type) }, 56 { XD_LISP_OBJECT, offsetof (struct tty_console, terminal_type) },
54 { XD_LISP_OBJECT, offsetof (struct tty_console, instream) }, 57 { XD_LISP_OBJECT, offsetof (struct tty_console, instream) },
55 { XD_LISP_OBJECT, offsetof (struct tty_console, outstream) }, 58 { XD_LISP_OBJECT, offsetof (struct tty_console, outstream) },
342 Error_Behavior errb) 345 Error_Behavior errb)
343 { 346 {
344 return stream_canonicalize_console_connection (connection, errb); 347 return stream_canonicalize_console_connection (connection, errb);
345 } 348 }
346 349
350 static Lisp_Object
351 tty_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
352 Lisp_Object key)
353 {
354 Ichar val;
355 extern Lisp_Object Vcurrent_global_map;
356
357 if (SYMBOLP(key))
358 {
359 /* We've no idea what to default an unknown symbol to on the TTY. */
360 return Qnil;
361 }
362
363 CHECK_CHAR(key);
364
365 if (!(HASH_TABLEP(Qseen_characters)))
366 {
367 /* All the keysyms we deal with are character objects; therefore, we
368 can use eq as the test without worrying. */
369 Qseen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
370 HASH_TABLE_EQ);
371 }
372
373 /* Might give the user an opaque error if make_lisp_hash_table fails,
374 but it won't crash. */
375 CHECK_HASH_TABLE(Qseen_characters);
376
377 val = XCHAR(key);
378
379 /* Same logic as in x_has_keysym; I'm not convinced it's always sane. */
380 if (val < 0x80)
381 {
382 return Qnil;
383 }
384
385 if (!NILP(Fgethash(key, Qseen_characters, Qnil)))
386 {
387 return Qnil;
388 }
389
390 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil)))
391 {
392 Fputhash(key, Qt, Qseen_characters);
393 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command);
394 return Qt;
395 }
396
397 return Qnil;
398 }
399
347 400
348 /************************************************************************/ 401 /************************************************************************/
349 /* initialization */ 402 /* initialization */
350 /************************************************************************/ 403 /************************************************************************/
351 404
375 CONSOLE_HAS_METHOD (tty, delete_console); 428 CONSOLE_HAS_METHOD (tty, delete_console);
376 CONSOLE_HAS_METHOD (tty, canonicalize_console_connection); 429 CONSOLE_HAS_METHOD (tty, canonicalize_console_connection);
377 CONSOLE_HAS_METHOD (tty, canonicalize_device_connection); 430 CONSOLE_HAS_METHOD (tty, canonicalize_device_connection);
378 CONSOLE_HAS_METHOD (tty, semi_canonicalize_console_connection); 431 CONSOLE_HAS_METHOD (tty, semi_canonicalize_console_connection);
379 CONSOLE_HAS_METHOD (tty, semi_canonicalize_device_connection); 432 CONSOLE_HAS_METHOD (tty, semi_canonicalize_device_connection);
433 CONSOLE_HAS_METHOD (tty, perhaps_init_unseen_key_defaults);
380 } 434 }
381 435
382 void 436 void
383 reinit_console_type_create_tty (void) 437 reinit_console_type_create_tty (void)
384 { 438 {
395 } 449 }
396 450
397 void 451 void
398 vars_of_console_tty (void) 452 vars_of_console_tty (void)
399 { 453 {
454 Qseen_characters = Qnil;
400 Fprovide (Qtty); 455 Fprovide (Qtty);
401 } 456 }