Mercurial > hg > xemacs-beta
comparison src/redisplay-tty.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | bbff43aa5eb7 |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
54 /* # include <curses.h> */ | 54 /* # include <curses.h> */ |
55 /* # include <term.h> */ | 55 /* # include <term.h> */ |
56 #ifdef __cplusplus | 56 #ifdef __cplusplus |
57 extern "C" { | 57 extern "C" { |
58 #endif | 58 #endif |
59 extern int tgetent (CONST char *, CONST char *); | 59 extern int tgetent (const char *, const char *); |
60 extern int tgetflag (CONST char *); | 60 extern int tgetflag (const char *); |
61 extern int tgetnum (CONST char *); | 61 extern int tgetnum (const char *); |
62 extern char *tgetstr (CONST char *, char **); | 62 extern char *tgetstr (const char *, char **); |
63 extern void tputs (CONST char *, int, void (*)(int)); | 63 extern void tputs (const char *, int, void (*)(int)); |
64 #ifdef __cplusplus | 64 #ifdef __cplusplus |
65 } | 65 } |
66 #endif | 66 #endif |
67 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0) | 67 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0) |
68 #define OUTPUTN(c, a, n) \ | 68 #define OUTPUTN(c, a, n) \ |
105 is considered to be fixed width -- in other words, we return LEN. | 105 is considered to be fixed width -- in other words, we return LEN. |
106 Under Mule, however, a character can still cover more than one | 106 Under Mule, however, a character can still cover more than one |
107 column, so we use emchar_string_displayed_columns(). | 107 column, so we use emchar_string_displayed_columns(). |
108 ****************************************************************************/ | 108 ****************************************************************************/ |
109 static int | 109 static int |
110 tty_text_width (struct frame *f, struct face_cachel *cachel, CONST Emchar *str, | 110 tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, |
111 Charcount len) | 111 Charcount len) |
112 { | 112 { |
113 return emchar_string_displayed_columns (str, len); | 113 return emchar_string_displayed_columns (str, len); |
114 } | 114 } |
115 | 115 |
390 | 390 |
391 case IMAGE_MONO_PIXMAP: | 391 case IMAGE_MONO_PIXMAP: |
392 case IMAGE_COLOR_PIXMAP: | 392 case IMAGE_COLOR_PIXMAP: |
393 case IMAGE_SUBWINDOW: | 393 case IMAGE_SUBWINDOW: |
394 case IMAGE_WIDGET: | 394 case IMAGE_WIDGET: |
395 case IMAGE_LAYOUT: | |
395 /* just do nothing here */ | 396 /* just do nothing here */ |
396 break; | 397 break; |
397 | 398 |
398 case IMAGE_POINTER: | 399 case IMAGE_POINTER: |
399 abort (); | 400 abort (); |
462 Clear the area in the box defined by the given parameters. | 463 Clear the area in the box defined by the given parameters. |
463 ****************************************************************************/ | 464 ****************************************************************************/ |
464 static void | 465 static void |
465 tty_clear_region (Lisp_Object window, struct device* d, struct frame * f, | 466 tty_clear_region (Lisp_Object window, struct device* d, struct frame * f, |
466 face_index findex, int x, int y, | 467 face_index findex, int x, int y, |
467 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, | 468 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, |
468 Lisp_Object background_pixmap) | 469 Lisp_Object background_pixmap) |
469 { | 470 { |
470 struct console *c = XCONSOLE (FRAME_CONSOLE (f)); | 471 struct console *c = XCONSOLE (FRAME_CONSOLE (f)); |
471 int line; | 472 int line; |
472 struct window* w = XWINDOW (window); | 473 struct window* w = XWINDOW (window); |
947 void | 948 void |
948 tty_redisplay_shutdown (struct console *c) | 949 tty_redisplay_shutdown (struct console *c) |
949 { | 950 { |
950 Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c); | 951 Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c); |
951 | 952 |
952 if (!GC_NILP (dev)) | 953 if (!NILP (dev)) |
953 { | 954 { |
954 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev)); | 955 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev)); |
955 | 956 |
956 if (!GC_NILP (frm)) | 957 if (!NILP (frm)) |
957 { | 958 { |
958 struct frame *f = XFRAME (frm); | 959 struct frame *f = XFRAME (frm); |
959 | 960 |
960 /* Clear the bottom line of the frame. */ | 961 /* Clear the bottom line of the frame. */ |
961 redisplay_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0, | 962 redisplay_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0, |
1302 return TTY_INIT_SUCCESS; | 1303 return TTY_INIT_SUCCESS; |
1303 } | 1304 } |
1304 | 1305 |
1305 struct fkey_table | 1306 struct fkey_table |
1306 { | 1307 { |
1307 CONST char *cap, *name; | 1308 const char *cap; |
1309 const char *name; | |
1308 }; | 1310 }; |
1309 | 1311 |
1310 /* Termcap capability names that correspond directly to X keysyms. | 1312 /* Termcap capability names that correspond directly to X keysyms. |
1311 Some of these (marked "terminfo") aren't supplied by old-style | 1313 Some of these (marked "terminfo") aren't supplied by old-style |
1312 (Berkeley) termcap entries. They're listed in X keysym order; | 1314 (Berkeley) termcap entries. They're listed in X keysym order; |
1434 for (i = 0; i < countof (keys); i++) | 1436 for (i = 0; i < countof (keys); i++) |
1435 { | 1437 { |
1436 char *sequence = tgetstr (keys[i].cap, address); | 1438 char *sequence = tgetstr (keys[i].cap, address); |
1437 if (sequence) | 1439 if (sequence) |
1438 Fdefine_key (function_key_map, | 1440 Fdefine_key (function_key_map, |
1439 build_ext_string (sequence, FORMAT_BINARY), | 1441 build_ext_string (sequence, Qbinary), |
1440 vector1 (intern (keys[i].name))); | 1442 vector1 (intern (keys[i].name))); |
1441 } | 1443 } |
1442 | 1444 |
1443 /* The uses of the "k0" capability are inconsistent; sometimes it | 1445 /* The uses of the "k0" capability are inconsistent; sometimes it |
1444 describes F10, whereas othertimes it describes F0 and "k;" describes F10. | 1446 describes F10, whereas othertimes it describes F0 and "k;" describes F10. |
1445 We will attempt to politely accommodate both systems by testing for | 1447 We will attempt to politely accommodate both systems by testing for |
1446 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. | 1448 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. |
1447 */ | 1449 */ |
1448 { | 1450 { |
1449 char *k_semi = tgetstr ("k;", address); | 1451 const char *k_semi = tgetstr ("k;", address); |
1450 char *k0 = tgetstr ("k0", address); | 1452 const char *k0 = tgetstr ("k0", address); |
1451 CONST char *k0_name = "f10"; | |
1452 | 1453 |
1453 if (k_semi) | 1454 if (k_semi) |
1454 { | 1455 Fdefine_key (function_key_map, build_ext_string (k_semi, Qbinary), |
1455 Fdefine_key (function_key_map, build_ext_string (k_semi, FORMAT_BINARY), | 1456 vector1 (intern ("f10"))); |
1456 vector1 (intern ("f10"))); | |
1457 k0_name = "f0"; | |
1458 } | |
1459 | 1457 |
1460 if (k0) | 1458 if (k0) |
1461 Fdefine_key (function_key_map, build_ext_string (k0, FORMAT_BINARY), | 1459 Fdefine_key (function_key_map, build_ext_string (k0, Qbinary), |
1462 vector1 (intern (k0_name))); | 1460 vector1 (intern (k_semi ? "f0" : "f10"))); |
1463 } | 1461 } |
1464 | 1462 |
1465 /* Set up cookies for numbered function keys above f10. */ | 1463 /* Set up cookies for numbered function keys above f10. */ |
1466 { | 1464 { |
1467 char fcap[3], fkey[4]; | 1465 char fcap[3], fkey[4]; |
1480 char *sequence = tgetstr (fcap, address); | 1478 char *sequence = tgetstr (fcap, address); |
1481 if (sequence) | 1479 if (sequence) |
1482 { | 1480 { |
1483 sprintf (fkey, "f%d", i); | 1481 sprintf (fkey, "f%d", i); |
1484 Fdefine_key (function_key_map, | 1482 Fdefine_key (function_key_map, |
1485 build_ext_string (sequence, FORMAT_BINARY), | 1483 build_ext_string (sequence, Qbinary), |
1486 vector1 (intern (fkey))); | 1484 vector1 (intern (fkey))); |
1487 } | 1485 } |
1488 } | 1486 } |
1489 } | 1487 } |
1490 } | 1488 } |
1491 | 1489 |
1492 /* | 1490 /* |
1493 * Various mappings to try and get a better fit. | 1491 * Various mappings to try and get a better fit. |
1494 */ | 1492 */ |
1495 { | 1493 #define CONDITIONAL_REASSIGN(cap1, cap2, keyname) do { \ |
1496 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \ | 1494 if (!tgetstr (cap1, address)) \ |
1497 if (!tgetstr (cap1, address)) \ | 1495 { \ |
1498 { \ | 1496 char *sequence = tgetstr (cap2, address); \ |
1499 char *sequence = tgetstr (cap2, address); \ | 1497 if (sequence) \ |
1500 if (sequence) \ | 1498 Fdefine_key (function_key_map, \ |
1501 Fdefine_key (function_key_map, \ | 1499 build_ext_string (sequence, Qbinary), \ |
1502 build_ext_string (sequence, FORMAT_BINARY), \ | 1500 vector1 (intern (keyname))); \ |
1503 vector1 (intern (sym))); \ | 1501 } \ |
1504 } | 1502 } while (0) |
1505 | 1503 |
1506 /* if there's no key_next keycap, map key_npage to `next' keysym */ | 1504 /* if there's no key_next keycap, map key_npage to `next' keysym */ |
1507 CONDITIONAL_REASSIGN ("%5", "kN", "next"); | 1505 CONDITIONAL_REASSIGN ("%5", "kN", "next"); |
1508 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */ | 1506 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */ |
1509 CONDITIONAL_REASSIGN ("%8", "kP", "prior"); | 1507 CONDITIONAL_REASSIGN ("%8", "kP", "prior"); |
1510 /* if there's no key_dc keycap, map key_ic to `insert' keysym */ | 1508 /* if there's no key_dc keycap, map key_ic to `insert' keysym */ |
1511 CONDITIONAL_REASSIGN ("kD", "kI", "insert"); | 1509 CONDITIONAL_REASSIGN ("kD", "kI", "insert"); |
1512 | 1510 |
1513 /* IBM has their own non-standard dialect of terminfo. | 1511 /* IBM has their own non-standard dialect of terminfo. |
1514 If the standard name isn't found, try the IBM name. */ | 1512 If the standard name isn't found, try the IBM name. */ |
1515 CONDITIONAL_REASSIGN ("kB", "KO", "backtab"); | 1513 CONDITIONAL_REASSIGN ("kB", "KO", "backtab"); |
1516 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */ | 1514 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */ |
1517 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */ | 1515 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */ |
1518 CONDITIONAL_REASSIGN ("%7", "ki", "menu"); | 1516 CONDITIONAL_REASSIGN ("%7", "ki", "menu"); |
1519 CONDITIONAL_REASSIGN ("@7", "kw", "end"); | 1517 CONDITIONAL_REASSIGN ("@7", "kw", "end"); |
1520 CONDITIONAL_REASSIGN ("F1", "k<", "f11"); | 1518 CONDITIONAL_REASSIGN ("F1", "k<", "f11"); |
1521 CONDITIONAL_REASSIGN ("F2", "k>", "f12"); | 1519 CONDITIONAL_REASSIGN ("F2", "k>", "f12"); |
1522 CONDITIONAL_REASSIGN ("%1", "kq", "help"); | 1520 CONDITIONAL_REASSIGN ("%1", "kq", "help"); |
1523 CONDITIONAL_REASSIGN ("*6", "kU", "select"); | 1521 CONDITIONAL_REASSIGN ("*6", "kU", "select"); |
1524 #undef CONDITIONAL_REASSIGN | 1522 #undef CONDITIONAL_REASSIGN |
1525 } | |
1526 | 1523 |
1527 return Qnil; | 1524 return Qnil; |
1528 } | 1525 } |
1529 | 1526 |
1530 | 1527 |