diff options
| author | Karoly Lorentey | 2004-01-11 21:59:40 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-11 21:59:40 +0000 |
| commit | 2246281fb0e2ab610d14efa7166a9ceb02597643 (patch) | |
| tree | 09416af10eec00f4d43af0dd569cc90cda408ce6 /src/sysdep.c | |
| parent | c0707982ab8a080139a45b35fc7906415ba2f1bc (diff) | |
| download | emacs-2246281fb0e2ab610d14efa7166a9ceb02597643.tar.gz emacs-2246281fb0e2ab610d14efa7166a9ceb02597643.zip | |
Support for opening X frames from a tty session.
lisp/cus-face.el (custom-declare-face): Handle multiple concurrent
display methods correctly.
lisp/faces.el (x-create-frame-with-faces): Set the window-system frame
parameter instead of frame-creation-function.
(tty-create-frame-with-faces): Ditto.
lisp/frame.el (frame-creation-function): Removed.
(frame-creation-function-alist): New variable.
(frame-initialize): Use initial-window-system instead of window-system.
Add window-system parameter to initial-frame-alist.
Removed tty initialization, it was moved to frame-creation-function-alist.
(frame-notice-user-settings): Use initial-window-system instead of window-system.
(make-frame-on-display): Make sure term/x-win is loaded. Added
window-system parameter for make-frame.
(make-frame-on-tty): Removed unnecessary autoload declaration. Added
window-system parameter for make-frame.
(make-frame): Use frame-creation-function-alist to determine the
function to use depending on the specified window system.
(select-frame-by-name): Use the window-system function instead of the
variable.
lisp/startup.el (window-system): New variable (previously built-in,
now frame-local).
(normal-top-level, command-line): Use initial-window-system instead
of window-system.
lisp/loadup.el: Load startup.el before faces.el, for the
window-system variable.
lisp/term/x-win.el: Check for the x-create-frame function instead of
window-system to see if X is available. Don't exit Emacs if the
display can not be opened when X is not the initial display method.
Set up frame-creation-function-alist instead of
frame-creation-function. Provide the x-win feature.
src/dispnew.c (Vwindow_system): Renamed to Vinitial_window_system.
(init_display, syms_of_display): Updated to use Vinitial_window_system
instead of Vwindow_system.
src/emacs.c (shut_down_emacs): Updated to use Vinitial_window_system
instead of Vwindow_system.
src/keyboard.c (Fset_input_mode): Call reset_all_sys_modes, not
reset_sys_modes. Ditto for init_all_sys_modes. Process the quit
parameter correctly.
src/sysdep.c (init_sys_modes, reset_sys_modes): Unconditionally set up
the terminal. We don't get called if there is nothing to do anymore.
(sys_select): Use Vinitial_window_system, not Vwindow_system.
src/window.h (Vwindow_system): Renamed to Vinitial_window_system.
src/xfns.c (Fx_create_frame): Don't check_x. We initialize it anyway.
(x_display_info_for_name, Fx_open_connection): Don't look at
Vinitial_window_system.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-54
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 360 |
1 files changed, 163 insertions, 197 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 5a2bb449df1..d57fe146fc0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1394,267 +1394,261 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1394 | #if 0 | 1394 | #if 0 |
| 1395 | /* read_socket_hook is not global anymore. I think doing this | 1395 | /* read_socket_hook is not global anymore. I think doing this |
| 1396 | unconditionally will not cause any problems. */ | 1396 | unconditionally will not cause any problems. */ |
| 1397 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1397 | if (! read_socket_hook && EQ (Vinitial_window_system, Qnil)) |
| 1398 | #endif | 1398 | #endif |
| 1399 | narrow_foreground_group (fileno (TTY_INPUT (tty_out))); | 1399 | narrow_foreground_group (fileno (TTY_INPUT (tty_out))); |
| 1400 | #endif | 1400 | #endif |
| 1401 | 1401 | ||
| 1402 | #ifdef HAVE_WINDOW_SYSTEM | 1402 | if (! tty_out->old_tty) |
| 1403 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1403 | tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); |
| 1404 | needs the initialization code below. */ | ||
| 1405 | if (tty_out->input != stdin || EQ (Vwindow_system, Qnil)) | ||
| 1406 | #endif | ||
| 1407 | { | ||
| 1408 | if (! tty_out->old_tty) | ||
| 1409 | tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); | ||
| 1410 | 1404 | ||
| 1411 | EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty); | 1405 | EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty); |
| 1412 | 1406 | ||
| 1413 | tty = *tty_out->old_tty; | 1407 | tty = *tty_out->old_tty; |
| 1414 | 1408 | ||
| 1415 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1409 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
| 1416 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); | 1410 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); |
| 1417 | 1411 | ||
| 1418 | #ifdef DGUX | 1412 | #ifdef DGUX |
| 1419 | /* This allows meta to be sent on 8th bit. */ | 1413 | /* This allows meta to be sent on 8th bit. */ |
| 1420 | tty.main.c_iflag &= ~INPCK; /* don't check input for parity */ | 1414 | tty.main.c_iflag &= ~INPCK; /* don't check input for parity */ |
| 1421 | #endif | 1415 | #endif |
| 1422 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ | 1416 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ |
| 1423 | tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */ | 1417 | tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */ |
| 1424 | #ifdef INLCR /* I'm just being cautious, | 1418 | #ifdef INLCR /* I'm just being cautious, |
| 1425 | since I can't check how widespread INLCR is--rms. */ | 1419 | since I can't check how widespread INLCR is--rms. */ |
| 1426 | tty.main.c_iflag &= ~INLCR; /* Disable map of NL to CR on input */ | 1420 | tty.main.c_iflag &= ~INLCR; /* Disable map of NL to CR on input */ |
| 1427 | #endif | 1421 | #endif |
| 1428 | #ifdef ISTRIP | 1422 | #ifdef ISTRIP |
| 1429 | tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ | 1423 | tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ |
| 1430 | #endif | 1424 | #endif |
| 1431 | tty.main.c_lflag &= ~ECHO; /* Disable echo */ | 1425 | tty.main.c_lflag &= ~ECHO; /* Disable echo */ |
| 1432 | tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */ | 1426 | tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */ |
| 1433 | #ifdef IEXTEN | 1427 | #ifdef IEXTEN |
| 1434 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ | 1428 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ |
| 1435 | #endif | 1429 | #endif |
| 1436 | tty.main.c_lflag |= ISIG; /* Enable signals */ | 1430 | tty.main.c_lflag |= ISIG; /* Enable signals */ |
| 1437 | if (tty_out->flow_control) | 1431 | if (tty_out->flow_control) |
| 1438 | { | 1432 | { |
| 1439 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ | 1433 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ |
| 1440 | #ifdef IXANY | 1434 | #ifdef IXANY |
| 1441 | tty.main.c_iflag &= ~IXANY; | 1435 | tty.main.c_iflag &= ~IXANY; |
| 1442 | #endif /* IXANY */ | 1436 | #endif /* IXANY */ |
| 1443 | } | 1437 | } |
| 1444 | else | 1438 | else |
| 1445 | tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */ | 1439 | tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */ |
| 1446 | tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL | 1440 | tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL |
| 1447 | on output */ | 1441 | on output */ |
| 1448 | tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */ | 1442 | tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */ |
| 1449 | #ifdef CS8 | 1443 | #ifdef CS8 |
| 1450 | if (tty_out->meta_key) | 1444 | if (tty_out->meta_key) |
| 1451 | { | 1445 | { |
| 1452 | tty.main.c_cflag |= CS8; /* allow 8th bit on input */ | 1446 | tty.main.c_cflag |= CS8; /* allow 8th bit on input */ |
| 1453 | tty.main.c_cflag &= ~PARENB;/* Don't check parity */ | 1447 | tty.main.c_cflag &= ~PARENB;/* Don't check parity */ |
| 1454 | } | 1448 | } |
| 1455 | #endif | 1449 | #endif |
| 1456 | if (tty_out->input == stdin) | 1450 | if (tty_out->input == stdin) |
| 1457 | { | 1451 | { |
| 1458 | tty.main.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ | 1452 | tty.main.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ |
| 1459 | /* Set up C-g for both SIGQUIT and SIGINT. | 1453 | /* Set up C-g for both SIGQUIT and SIGINT. |
| 1460 | We don't know which we will get, but we handle both alike | 1454 | We don't know which we will get, but we handle both alike |
| 1461 | so which one it really gives us does not matter. */ | 1455 | so which one it really gives us does not matter. */ |
| 1462 | tty.main.c_cc[VQUIT] = quit_char; | 1456 | tty.main.c_cc[VQUIT] = quit_char; |
| 1463 | } | 1457 | } |
| 1464 | else | 1458 | else |
| 1465 | { | 1459 | { |
| 1466 | /* We normally don't get interrupt or quit signals from tty | 1460 | /* We normally don't get interrupt or quit signals from tty |
| 1467 | devices other than our controlling terminal; therefore, | 1461 | devices other than our controlling terminal; therefore, |
| 1468 | we must handle C-g as normal input. Unfortunately, this | 1462 | we must handle C-g as normal input. Unfortunately, this |
| 1469 | means that the interrupt and quit feature must be | 1463 | means that the interrupt and quit feature must be |
| 1470 | disabled on secondary ttys, or we would not even see the | 1464 | disabled on secondary ttys, or we would not even see the |
| 1471 | keypress. | 1465 | keypress. |
| 1472 | 1466 | ||
| 1473 | Note that even though emacsclient could have special code | 1467 | Note that even though emacsclient could have special code |
| 1474 | to pass SIGINT to Emacs, we should _not_ enable | 1468 | to pass SIGINT to Emacs, we should _not_ enable |
| 1475 | interrupt/quit keys for emacsclient frames. This means | 1469 | interrupt/quit keys for emacsclient frames. This means |
| 1476 | that we can't break out of loops in C code from a | 1470 | that we can't break out of loops in C code from a |
| 1477 | secondary tty frame, but we can always decide what | 1471 | secondary tty frame, but we can always decide what |
| 1478 | display the C-g came from, which is more important from a | 1472 | display the C-g came from, which is more important from a |
| 1479 | usability point of view. (Consider the case when two | 1473 | usability point of view. (Consider the case when two |
| 1480 | people work together using the same Emacs instance.) */ | 1474 | people work together using the same Emacs instance.) */ |
| 1481 | tty.main.c_cc[VINTR] = CDISABLE; | 1475 | tty.main.c_cc[VINTR] = CDISABLE; |
| 1482 | tty.main.c_cc[VQUIT] = CDISABLE; | 1476 | tty.main.c_cc[VQUIT] = CDISABLE; |
| 1483 | } | 1477 | } |
| 1484 | tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ | 1478 | tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ |
| 1485 | tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ | 1479 | tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ |
| 1486 | #ifdef VSWTCH | 1480 | #ifdef VSWTCH |
| 1487 | tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use | 1481 | tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use |
| 1488 | of C-z */ | 1482 | of C-z */ |
| 1489 | #endif /* VSWTCH */ | 1483 | #endif /* VSWTCH */ |
| 1490 | 1484 | ||
| 1491 | #if defined (mips) || defined (HAVE_TCATTR) | 1485 | #if defined (mips) || defined (HAVE_TCATTR) |
| 1492 | #ifdef VSUSP | 1486 | #ifdef VSUSP |
| 1493 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ | 1487 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ |
| 1494 | #endif /* VSUSP */ | 1488 | #endif /* VSUSP */ |
| 1495 | #ifdef V_DSUSP | 1489 | #ifdef V_DSUSP |
| 1496 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ | 1490 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ |
| 1497 | #endif /* V_DSUSP */ | 1491 | #endif /* V_DSUSP */ |
| 1498 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ | 1492 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ |
| 1499 | tty.main.c_cc[VDSUSP] = CDISABLE; | 1493 | tty.main.c_cc[VDSUSP] = CDISABLE; |
| 1500 | #endif /* VDSUSP */ | 1494 | #endif /* VDSUSP */ |
| 1501 | #ifdef VLNEXT | 1495 | #ifdef VLNEXT |
| 1502 | tty.main.c_cc[VLNEXT] = CDISABLE; | 1496 | tty.main.c_cc[VLNEXT] = CDISABLE; |
| 1503 | #endif /* VLNEXT */ | 1497 | #endif /* VLNEXT */ |
| 1504 | #ifdef VREPRINT | 1498 | #ifdef VREPRINT |
| 1505 | tty.main.c_cc[VREPRINT] = CDISABLE; | 1499 | tty.main.c_cc[VREPRINT] = CDISABLE; |
| 1506 | #endif /* VREPRINT */ | 1500 | #endif /* VREPRINT */ |
| 1507 | #ifdef VWERASE | 1501 | #ifdef VWERASE |
| 1508 | tty.main.c_cc[VWERASE] = CDISABLE; | 1502 | tty.main.c_cc[VWERASE] = CDISABLE; |
| 1509 | #endif /* VWERASE */ | 1503 | #endif /* VWERASE */ |
| 1510 | #ifdef VDISCARD | 1504 | #ifdef VDISCARD |
| 1511 | tty.main.c_cc[VDISCARD] = CDISABLE; | 1505 | tty.main.c_cc[VDISCARD] = CDISABLE; |
| 1512 | #endif /* VDISCARD */ | 1506 | #endif /* VDISCARD */ |
| 1513 | 1507 | ||
| 1514 | if (tty_out->flow_control) | 1508 | if (tty_out->flow_control) |
| 1515 | { | 1509 | { |
| 1516 | #ifdef VSTART | 1510 | #ifdef VSTART |
| 1517 | tty.main.c_cc[VSTART] = '\021'; | 1511 | tty.main.c_cc[VSTART] = '\021'; |
| 1518 | #endif /* VSTART */ | 1512 | #endif /* VSTART */ |
| 1519 | #ifdef VSTOP | 1513 | #ifdef VSTOP |
| 1520 | tty.main.c_cc[VSTOP] = '\023'; | 1514 | tty.main.c_cc[VSTOP] = '\023'; |
| 1521 | #endif /* VSTOP */ | 1515 | #endif /* VSTOP */ |
| 1522 | } | 1516 | } |
| 1523 | else | 1517 | else |
| 1524 | { | 1518 | { |
| 1525 | #ifdef VSTART | 1519 | #ifdef VSTART |
| 1526 | tty.main.c_cc[VSTART] = CDISABLE; | 1520 | tty.main.c_cc[VSTART] = CDISABLE; |
| 1527 | #endif /* VSTART */ | 1521 | #endif /* VSTART */ |
| 1528 | #ifdef VSTOP | 1522 | #ifdef VSTOP |
| 1529 | tty.main.c_cc[VSTOP] = CDISABLE; | 1523 | tty.main.c_cc[VSTOP] = CDISABLE; |
| 1530 | #endif /* VSTOP */ | 1524 | #endif /* VSTOP */ |
| 1531 | } | 1525 | } |
| 1532 | #endif /* mips or HAVE_TCATTR */ | 1526 | #endif /* mips or HAVE_TCATTR */ |
| 1533 | 1527 | ||
| 1534 | #ifdef SET_LINE_DISCIPLINE | 1528 | #ifdef SET_LINE_DISCIPLINE |
| 1535 | /* Need to explicitly request TERMIODISC line discipline or | 1529 | /* Need to explicitly request TERMIODISC line discipline or |
| 1536 | Ultrix's termios does not work correctly. */ | 1530 | Ultrix's termios does not work correctly. */ |
| 1537 | tty.main.c_line = SET_LINE_DISCIPLINE; | 1531 | tty.main.c_line = SET_LINE_DISCIPLINE; |
| 1538 | #endif | 1532 | #endif |
| 1539 | #ifdef AIX | 1533 | #ifdef AIX |
| 1540 | #ifndef IBMR2AIX | 1534 | #ifndef IBMR2AIX |
| 1541 | /* AIX enhanced edit loses NULs, so disable it. */ | 1535 | /* AIX enhanced edit loses NULs, so disable it. */ |
| 1542 | tty.main.c_line = 0; | 1536 | tty.main.c_line = 0; |
| 1543 | tty.main.c_iflag &= ~ASCEDIT; | 1537 | tty.main.c_iflag &= ~ASCEDIT; |
| 1544 | #else | 1538 | #else |
| 1545 | tty.main.c_cc[VSTRT] = 255; | 1539 | tty.main.c_cc[VSTRT] = 255; |
| 1546 | tty.main.c_cc[VSTOP] = 255; | 1540 | tty.main.c_cc[VSTOP] = 255; |
| 1547 | tty.main.c_cc[VSUSP] = 255; | 1541 | tty.main.c_cc[VSUSP] = 255; |
| 1548 | tty.main.c_cc[VDSUSP] = 255; | 1542 | tty.main.c_cc[VDSUSP] = 255; |
| 1549 | #endif /* IBMR2AIX */ | 1543 | #endif /* IBMR2AIX */ |
| 1550 | if (tty_out->flow_control) | 1544 | if (tty_out->flow_control) |
| 1551 | { | 1545 | { |
| 1552 | #ifdef VSTART | 1546 | #ifdef VSTART |
| 1553 | tty.main.c_cc[VSTART] = '\021'; | 1547 | tty.main.c_cc[VSTART] = '\021'; |
| 1554 | #endif /* VSTART */ | 1548 | #endif /* VSTART */ |
| 1555 | #ifdef VSTOP | 1549 | #ifdef VSTOP |
| 1556 | tty.main.c_cc[VSTOP] = '\023'; | 1550 | tty.main.c_cc[VSTOP] = '\023'; |
| 1557 | #endif /* VSTOP */ | 1551 | #endif /* VSTOP */ |
| 1558 | } | 1552 | } |
| 1559 | /* Also, PTY overloads NUL and BREAK. | 1553 | /* Also, PTY overloads NUL and BREAK. |
| 1560 | don't ignore break, but don't signal either, so it looks like NUL. | 1554 | don't ignore break, but don't signal either, so it looks like NUL. |
| 1561 | This really serves a purpose only if running in an XTERM window | 1555 | This really serves a purpose only if running in an XTERM window |
| 1562 | or via TELNET or the like, but does no harm elsewhere. */ | 1556 | or via TELNET or the like, but does no harm elsewhere. */ |
| 1563 | tty.main.c_iflag &= ~IGNBRK; | 1557 | tty.main.c_iflag &= ~IGNBRK; |
| 1564 | tty.main.c_iflag &= ~BRKINT; | 1558 | tty.main.c_iflag &= ~BRKINT; |
| 1565 | #endif | 1559 | #endif |
| 1566 | #else /* if not HAVE_TERMIO */ | 1560 | #else /* if not HAVE_TERMIO */ |
| 1567 | #ifdef VMS | 1561 | #ifdef VMS |
| 1568 | tty.main.tt_char |= TT$M_NOECHO; | 1562 | tty.main.tt_char |= TT$M_NOECHO; |
| 1569 | if (meta_key) | 1563 | if (meta_key) |
| 1570 | tty.main.tt_char |= TT$M_EIGHTBIT; | 1564 | tty.main.tt_char |= TT$M_EIGHTBIT; |
| 1571 | if (tty_out->flow_control) | 1565 | if (tty_out->flow_control) |
| 1572 | tty.main.tt_char |= TT$M_TTSYNC; | 1566 | tty.main.tt_char |= TT$M_TTSYNC; |
| 1573 | else | 1567 | else |
| 1574 | tty.main.tt_char &= ~TT$M_TTSYNC; | 1568 | tty.main.tt_char &= ~TT$M_TTSYNC; |
| 1575 | tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; | 1569 | tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; |
| 1576 | #else /* not VMS (BSD, that is) */ | 1570 | #else /* not VMS (BSD, that is) */ |
| 1577 | #ifndef DOS_NT | 1571 | #ifndef DOS_NT |
| 1578 | XSETINT (Vtty_erase_char, tty.main.sg_erase); | 1572 | XSETINT (Vtty_erase_char, tty.main.sg_erase); |
| 1579 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); | 1573 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); |
| 1580 | if (meta_key) | 1574 | if (meta_key) |
| 1581 | tty.main.sg_flags |= ANYP; | 1575 | tty.main.sg_flags |= ANYP; |
| 1582 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; | 1576 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; |
| 1583 | #endif /* not DOS_NT */ | 1577 | #endif /* not DOS_NT */ |
| 1584 | #endif /* not VMS (BSD, that is) */ | 1578 | #endif /* not VMS (BSD, that is) */ |
| 1585 | #endif /* not HAVE_TERMIO */ | 1579 | #endif /* not HAVE_TERMIO */ |
| 1586 | 1580 | ||
| 1587 | /* If going to use CBREAK mode, we must request C-g to interrupt | 1581 | /* If going to use CBREAK mode, we must request C-g to interrupt |
| 1588 | and turn off start and stop chars, etc. If not going to use | 1582 | and turn off start and stop chars, etc. If not going to use |
| 1589 | CBREAK mode, do this anyway so as to turn off local flow | 1583 | CBREAK mode, do this anyway so as to turn off local flow |
| 1590 | control for user coming over network on 4.2; in this case, | 1584 | control for user coming over network on 4.2; in this case, |
| 1591 | only t_stopc and t_startc really matter. */ | 1585 | only t_stopc and t_startc really matter. */ |
| 1592 | #ifndef HAVE_TERMIO | 1586 | #ifndef HAVE_TERMIO |
| 1593 | #ifdef HAVE_TCHARS | 1587 | #ifdef HAVE_TCHARS |
| 1594 | /* Note: if not using CBREAK mode, it makes no difference how we | 1588 | /* Note: if not using CBREAK mode, it makes no difference how we |
| 1595 | set this */ | 1589 | set this */ |
| 1596 | tty.tchars = new_tchars; | 1590 | tty.tchars = new_tchars; |
| 1597 | tty.tchars.t_intrc = quit_char; | 1591 | tty.tchars.t_intrc = quit_char; |
| 1598 | if (tty_out->flow_control) | 1592 | if (tty_out->flow_control) |
| 1599 | { | 1593 | { |
| 1600 | tty.tchars.t_startc = '\021'; | 1594 | tty.tchars.t_startc = '\021'; |
| 1601 | tty.tchars.t_stopc = '\023'; | 1595 | tty.tchars.t_stopc = '\023'; |
| 1602 | } | 1596 | } |
| 1603 | 1597 | ||
| 1604 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; | 1598 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; |
| 1605 | #ifdef ultrix | 1599 | #ifdef ultrix |
| 1606 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt | 1600 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt |
| 1607 | anything, and leaving it in breaks the meta key. Go figure. */ | 1601 | anything, and leaving it in breaks the meta key. Go figure. */ |
| 1608 | tty.lmode &= ~LLITOUT; | 1602 | tty.lmode &= ~LLITOUT; |
| 1609 | #endif | 1603 | #endif |
| 1610 | 1604 | ||
| 1611 | #ifdef BSD4_1 | 1605 | #ifdef BSD4_1 |
| 1612 | lmode = tty.lmode; | 1606 | lmode = tty.lmode; |
| 1613 | #endif | 1607 | #endif |
| 1614 | 1608 | ||
| 1615 | #endif /* HAVE_TCHARS */ | 1609 | #endif /* HAVE_TCHARS */ |
| 1616 | #endif /* not HAVE_TERMIO */ | 1610 | #endif /* not HAVE_TERMIO */ |
| 1617 | 1611 | ||
| 1618 | #ifdef HAVE_LTCHARS | 1612 | #ifdef HAVE_LTCHARS |
| 1619 | tty.ltchars = new_ltchars; | 1613 | tty.ltchars = new_ltchars; |
| 1620 | #endif /* HAVE_LTCHARS */ | 1614 | #endif /* HAVE_LTCHARS */ |
| 1621 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ | 1615 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ |
| 1622 | if (!tty_out->term_initted) | 1616 | if (!tty_out->term_initted) |
| 1623 | internal_terminal_init (); | 1617 | internal_terminal_init (); |
| 1624 | dos_ttraw (); | 1618 | dos_ttraw (); |
| 1625 | #endif | 1619 | #endif |
| 1626 | 1620 | ||
| 1627 | EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); | 1621 | EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); |
| 1628 | 1622 | ||
| 1629 | /* This code added to insure that, if flow-control is not to be used, | 1623 | /* This code added to insure that, if flow-control is not to be used, |
| 1630 | we have an unlocked terminal at the start. */ | 1624 | we have an unlocked terminal at the start. */ |
| 1631 | 1625 | ||
| 1632 | #ifdef TCXONC | 1626 | #ifdef TCXONC |
| 1633 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); | 1627 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); |
| 1634 | #endif | 1628 | #endif |
| 1635 | #ifndef APOLLO | 1629 | #ifndef APOLLO |
| 1636 | #ifdef TIOCSTART | 1630 | #ifdef TIOCSTART |
| 1637 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); | 1631 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); |
| 1638 | #endif | 1632 | #endif |
| 1639 | #endif | 1633 | #endif |
| 1640 | 1634 | ||
| 1641 | #if defined (HAVE_TERMIOS) || defined (HPUX9) | 1635 | #if defined (HAVE_TERMIOS) || defined (HPUX9) |
| 1642 | #ifdef TCOON | 1636 | #ifdef TCOON |
| 1643 | if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); | 1637 | if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); |
| 1644 | #endif | 1638 | #endif |
| 1645 | #endif | 1639 | #endif |
| 1646 | 1640 | ||
| 1647 | #ifdef AIXHFT | 1641 | #ifdef AIXHFT |
| 1648 | hft_init (tty_out); | 1642 | hft_init (tty_out); |
| 1649 | #ifdef IBMR2AIX | 1643 | #ifdef IBMR2AIX |
| 1650 | { | 1644 | { |
| 1651 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it | 1645 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it |
| 1652 | to be only LF. This is the way that is done. */ | 1646 | to be only LF. This is the way that is done. */ |
| 1653 | struct termio tty; | 1647 | struct termio tty; |
| 1654 | 1648 | ||
| 1655 | if (ioctl (1, HFTGETID, &tty) != -1) | 1649 | if (ioctl (1, HFTGETID, &tty) != -1) |
| 1656 | write (1, "\033[20l", 5); | 1650 | write (1, "\033[20l", 5); |
| 1657 | } | 1651 | } |
| 1658 | #endif | 1652 | #endif |
| 1659 | #endif /* AIXHFT */ | 1653 | #endif /* AIXHFT */ |
| 1660 | 1654 | ||
| @@ -1663,15 +1657,13 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1663 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, | 1657 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, |
| 1664 | interrupt_signal, oob_chars, 0, 0, 0, 0); | 1658 | interrupt_signal, oob_chars, 0, 0, 0, 0); |
| 1665 | */ | 1659 | */ |
| 1666 | queue_kbd_input (0); | 1660 | queue_kbd_input (0); |
| 1667 | #endif /* VMS */ | 1661 | #endif /* VMS */ |
| 1668 | } | ||
| 1669 | 1662 | ||
| 1670 | #ifdef F_SETFL | 1663 | #ifdef F_SETFL |
| 1671 | #ifndef F_SETOWN_BUG | 1664 | #ifndef F_SETOWN_BUG |
| 1672 | #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ | 1665 | #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ |
| 1673 | if (interrupt_input | 1666 | if (interrupt_input) |
| 1674 | && (tty_out->input != stdin || EQ (Vwindow_system, Qnil))) | ||
| 1675 | { | 1667 | { |
| 1676 | old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = | 1668 | old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = |
| 1677 | fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); | 1669 | fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); |
| @@ -1699,20 +1691,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1699 | setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); | 1691 | setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); |
| 1700 | #endif | 1692 | #endif |
| 1701 | 1693 | ||
| 1702 | #if 0 /* We always need this with multi-tty support. */ | 1694 | tty_set_terminal_modes (tty_out->display); |
| 1703 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1704 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | ||
| 1705 | needs the initialization code below. */ | ||
| 1706 | if (EQ (Vwindow_system, Qnil) | ||
| 1707 | #ifndef WINDOWSNT | ||
| 1708 | /* When running in tty mode on NT/Win95, we have a read_socket | ||
| 1709 | hook, but still need the rest of the initialization code below. */ | ||
| 1710 | && (! read_socket_hook) | ||
| 1711 | #endif | ||
| 1712 | ) | ||
| 1713 | #endif | ||
| 1714 | #endif | ||
| 1715 | tty_set_terminal_modes (tty_out->display); | ||
| 1716 | 1695 | ||
| 1717 | if (!tty_out->term_initted) | 1696 | if (!tty_out->term_initted) |
| 1718 | { | 1697 | { |
| @@ -1875,21 +1854,6 @@ reset_sys_modes (tty_out) | |||
| 1875 | } | 1854 | } |
| 1876 | if (!tty_out->term_initted) | 1855 | if (!tty_out->term_initted) |
| 1877 | return; | 1856 | return; |
| 1878 | #if 0 /* We always need to do this with multi-tty support. */ | ||
| 1879 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1880 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | ||
| 1881 | needs the clean-up code below. */ | ||
| 1882 | if (tty_out->input != stdin | ||
| 1883 | || (!EQ (Vwindow_system, Qnil) | ||
| 1884 | #ifndef WINDOWSNT | ||
| 1885 | /* When running in tty mode on NT/Win95, we have a read_socket | ||
| 1886 | hook, but still need the rest of the clean-up code below. */ | ||
| 1887 | || read_socket_hook | ||
| 1888 | #endif | ||
| 1889 | )) | ||
| 1890 | return; | ||
| 1891 | #endif | ||
| 1892 | #endif | ||
| 1893 | 1857 | ||
| 1894 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1858 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
| 1895 | #if 0 /* XXX This doesn't work anymore, the signature has changed. */ | 1859 | #if 0 /* XXX This doesn't work anymore, the signature has changed. */ |
| @@ -2578,7 +2542,9 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2578 | SELECT_TYPE *rfds, *wfds, *efds; | 2542 | SELECT_TYPE *rfds, *wfds, *efds; |
| 2579 | EMACS_TIME *timeout; | 2543 | EMACS_TIME *timeout; |
| 2580 | { | 2544 | { |
| 2581 | int ravail = 0; | 2545 | /* XXX This needs to be updated for multi-tty support. Is there |
| 2546 | anybody who needs to emulate select these days? */ | ||
| 2547 | int ravail = 0; | ||
| 2582 | SELECT_TYPE orfds; | 2548 | SELECT_TYPE orfds; |
| 2583 | int timeoutval; | 2549 | int timeoutval; |
| 2584 | int *local_timeout; | 2550 | int *local_timeout; |
| @@ -2593,7 +2559,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2593 | #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) | 2559 | #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) |
| 2594 | /* If we're using X, then the native select will work; we only need the | 2560 | /* If we're using X, then the native select will work; we only need the |
| 2595 | emulation for non-X usage. */ | 2561 | emulation for non-X usage. */ |
| 2596 | if (!NILP (Vwindow_system)) | 2562 | if (!NILP (Vinitial_window_system)) |
| 2597 | return select (nfds, rfds, wfds, efds, timeout); | 2563 | return select (nfds, rfds, wfds, efds, timeout); |
| 2598 | #endif | 2564 | #endif |
| 2599 | timeoutval = timeout ? EMACS_SECS (*timeout) : 100000; | 2565 | timeoutval = timeout ? EMACS_SECS (*timeout) : 100000; |
| @@ -2717,8 +2683,8 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2717 | void | 2683 | void |
| 2718 | read_input_waiting () | 2684 | read_input_waiting () |
| 2719 | { | 2685 | { |
| 2720 | /* XXX This needs to be updated for multi-tty support. Does | 2686 | /* XXX This needs to be updated for multi-tty support. Is there |
| 2721 | anybody need to emulate select these days? */ | 2687 | anybody who needs to emulate select these days? */ |
| 2722 | int nread, i; | 2688 | int nread, i; |
| 2723 | extern int quit_char; | 2689 | extern int quit_char; |
| 2724 | 2690 | ||