diff options
| author | Karoly Lorentey | 2003-12-26 04:24:54 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2003-12-26 04:24:54 +0000 |
| commit | 9628b8878f46b2b7eeeb4f272d20f2e64de19f4a (patch) | |
| tree | cfccb4da4a6b898780d3bc9856b377fd5d85e4e6 /src | |
| parent | 4f0359deff8eb9ec9ed95e75d77a0dd59f39428c (diff) | |
| download | emacs-9628b8878f46b2b7eeeb4f272d20f2e64de19f4a.tar.gz emacs-9628b8878f46b2b7eeeb4f272d20f2e64de19f4a.zip | |
lib-src/emacsclient.c: Implemented --here option (open a new Emacs tty). Needs more work.
(here): New variable.
(decode_options): Use it.
(ec_get_tty, ec_set_tty, init_tty, window_change, hang_up_signal): New functions.
(window_change_signal, init_signals, reset_tty, init_pty, copy_from_to): Ditto.
(pty_conversation): Ditto.
(main): Use them.
(master, pty_name, old_tty, tty, old_tty_valid, tty_erase_char): New variables.
(flow_control, meta_key, _sobuf, in_conversation, quit_conversation): Ditto.
lisp/server.el (server-process-filter): Added support for opening a new terminal frame.
dispextern.h (get_frame_size): Renamed to get_tty_size, added tty_output parameter.
dispnew.c (Fredraw_frame): fflush the current terminal instead of stdout.
(direct_output_for_insert, direct_output_forward_char, update_frame_1): Ditto.
(Fding, bitch_at_user): Ditto.
(update_frame_1): Count pending output for current terminal instead of stdout.
(window_change_signal): Resize all terminals.
(change_frame_size): Don't resize all terminals to the same size.
frame.c (Vterminal_frame): Removed.
(syms_of_frame): Removed declaration of Vterminal_frame.
(make_terminal_frame): Set the top frame of the terminal to the new frame.
(Fmake_terminal_frame): Get a new frame size from get_tty_size, don't copy it.
(do_switch_frame): Handle terminal frame visibility.
(next_frame, prev_frame): Skip over frames on different terminals.
frame.h (Vterminal_frame): Removed.
keyboard.c (input_fd): Removed.
(read_avail_input): Removed first argument from read_socket_hook.
Try to read from each available tty, until one succeeds.
(Fsuspend_emacs): Don't suspend if there are multiple terminals.
lisp.h (get_frame_size): Removed superflous declaration.
xterm.c (Xtread_socket): Removed first parameter.
macterm.h (XTread_socket): Ditto.
w32inevt.c (w32_console_read_socket): Ditto.
w32term.c (w32_read_socket): Ditto.
sysdep.c (input_fd): Removed.
(change_input_fd): Removed.
(discard_tty_input): Discard pending input on _all_ input descriptors.
(stuff_char, tabs_safe_p): Use current terminal instead of input_fd.
(init_baud_rate, request_sigio, unrequest_sigio): Ditto.
(init_sys_modes, reset_sys_modes): Ditto.
(narrow_foreground_group, widen_foreground_group): Use stdin.
(init_sys_modes, reset_sys_modes): otty parameter renamed to tty_out.
(get_frame_size): Renamed to get_tty_size, added tty_out parameter.
term.c (read_socket_hook): Removed first parameter.
(clear_end_of_line): Use updating_frame, if possible.
(write_glyphs, insert_glyphs, ins_del_lines): Ditto.
(term_init): Renamed get_frame_size to get_tty_size.
termchar.h (struct tty_output): New entries: top_frame,
previous_terminal_frame.
termhooks.h (read_socket_hook): Removed first parameter.
window.c (init_window_once): Removed reference to Vterminal_frame.
xdisp.c (previous_terminal_frame): Moved to struct tty_output.
(redisplay_internal): Updated to use previous_terminal_frame in tty_output.
Allow for simultaneous refresh of multiple ttys.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-5
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 71 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/frame.c | 34 | ||||
| -rw-r--r-- | src/frame.h | 13 | ||||
| -rw-r--r-- | src/keyboard.c | 170 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/macterm.c | 2 | ||||
| -rw-r--r-- | src/scroll.c | 2 | ||||
| -rw-r--r-- | src/sysdep.c | 174 | ||||
| -rw-r--r-- | src/term.c | 45 | ||||
| -rw-r--r-- | src/termchar.h | 10 | ||||
| -rw-r--r-- | src/termhooks.h | 2 | ||||
| -rw-r--r-- | src/w32inevt.c | 2 | ||||
| -rw-r--r-- | src/w32term.c | 3 | ||||
| -rw-r--r-- | src/window.c | 1 | ||||
| -rw-r--r-- | src/xdisp.c | 30 | ||||
| -rw-r--r-- | src/xterm.c | 3 |
18 files changed, 311 insertions, 256 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 2538460dee2..0d127ba778d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2555,7 +2555,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | |||
| 2555 | 2555 | ||
| 2556 | /* Defined in sysdep.c */ | 2556 | /* Defined in sysdep.c */ |
| 2557 | 2557 | ||
| 2558 | void get_frame_size P_ ((int *, int *)); | 2558 | void get_tty_size P_ ((struct tty_output *, int *, int *)); |
| 2559 | void request_sigio P_ ((void)); | 2559 | void request_sigio P_ ((void)); |
| 2560 | void unrequest_sigio P_ ((void)); | 2560 | void unrequest_sigio P_ ((void)); |
| 2561 | int tabs_safe_p P_ ((void)); | 2561 | int tabs_safe_p P_ ((void)); |
diff --git a/src/dispnew.c b/src/dispnew.c index cf335cfeed6..3558934d83a 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3321,7 +3321,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, | |||
| 3321 | clear_frame (); | 3321 | clear_frame (); |
| 3322 | clear_current_matrices (f); | 3322 | clear_current_matrices (f); |
| 3323 | update_end (f); | 3323 | update_end (f); |
| 3324 | fflush (stdout); | 3324 | fflush (TTY_OUTPUT (FRAME_TTY (f))); |
| 3325 | windows_or_buffers_changed++; | 3325 | windows_or_buffers_changed++; |
| 3326 | /* Mark all windows as inaccurate, so that every window will have | 3326 | /* Mark all windows as inaccurate, so that every window will have |
| 3327 | its redisplay done. */ | 3327 | its redisplay done. */ |
| @@ -3461,7 +3461,7 @@ direct_output_for_insert (g) | |||
| 3461 | 3461 | ||
| 3462 | /* If we can't insert glyphs, we can use this method only | 3462 | /* If we can't insert glyphs, we can use this method only |
| 3463 | at the end of a line. */ | 3463 | at the end of a line. */ |
| 3464 | if (!TTY_CHAR_INS_DEL_OK (CURTTY ())) | 3464 | if (!TTY_CHAR_INS_DEL_OK (FRAME_TTY (f))) |
| 3465 | if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n') | 3465 | if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n') |
| 3466 | return 0; | 3466 | return 0; |
| 3467 | 3467 | ||
| @@ -3658,7 +3658,7 @@ direct_output_for_insert (g) | |||
| 3658 | rif->update_window_end_hook (w, 1, 0); | 3658 | rif->update_window_end_hook (w, 1, 0); |
| 3659 | update_end (f); | 3659 | update_end (f); |
| 3660 | updated_row = NULL; | 3660 | updated_row = NULL; |
| 3661 | fflush (stdout); | 3661 | fflush (TTY_OUTPUT (CURTTY ()); |
| 3662 | 3662 | ||
| 3663 | TRACE ((stderr, "direct output for insert\n")); | 3663 | TRACE ((stderr, "direct output for insert\n")); |
| 3664 | mark_window_display_accurate (it.window, 1); | 3664 | mark_window_display_accurate (it.window, 1); |
| @@ -3749,7 +3749,7 @@ direct_output_forward_char (n) | |||
| 3749 | cursor_to (y, x); | 3749 | cursor_to (y, x); |
| 3750 | } | 3750 | } |
| 3751 | 3751 | ||
| 3752 | fflush (stdout); | 3752 | fflush (TTY_OUTPUT (CURTTY ())); |
| 3753 | redisplay_performed_directly_p = 1; | 3753 | redisplay_performed_directly_p = 1; |
| 3754 | return 1; | 3754 | return 1; |
| 3755 | } | 3755 | } |
| @@ -5102,18 +5102,18 @@ update_frame_1 (f, force_p, inhibit_id_p) | |||
| 5102 | Also flush out if likely to have more than 1k buffered | 5102 | Also flush out if likely to have more than 1k buffered |
| 5103 | otherwise. I'm told that some telnet connections get | 5103 | otherwise. I'm told that some telnet connections get |
| 5104 | really screwed by more than 1k output at once. */ | 5104 | really screwed by more than 1k output at once. */ |
| 5105 | int outq = PENDING_OUTPUT_COUNT (stdout); | 5105 | int outq = PENDING_OUTPUT_COUNT (TTY_OUTPUT (FRAME_TTY (f))); |
| 5106 | if (outq > 900 | 5106 | if (outq > 900 |
| 5107 | || (outq > 20 && ((i - 1) % preempt_count == 0))) | 5107 | || (outq > 20 && ((i - 1) % preempt_count == 0))) |
| 5108 | { | 5108 | { |
| 5109 | fflush (stdout); | 5109 | fflush (TTY_OUTPUT (FRAME_TTY (f))); |
| 5110 | if (preempt_count == 1) | 5110 | if (preempt_count == 1) |
| 5111 | { | 5111 | { |
| 5112 | #ifdef EMACS_OUTQSIZE | 5112 | #ifdef EMACS_OUTQSIZE |
| 5113 | if (EMACS_OUTQSIZE (0, &outq) < 0) | 5113 | if (EMACS_OUTQSIZE (0, &outq) < 0) |
| 5114 | /* Probably not a tty. Ignore the error and reset | 5114 | /* Probably not a tty. Ignore the error and reset |
| 5115 | the outq count. */ | 5115 | the outq count. */ |
| 5116 | outq = PENDING_OUTPUT_COUNT (stdout); | 5116 | outq = PENDING_OUTPUT_COUNT (TTY_OUTPUT (FRAME_TTY (f))); |
| 5117 | #endif | 5117 | #endif |
| 5118 | outq *= 10; | 5118 | outq *= 10; |
| 5119 | if (baud_rate <= outq && baud_rate > 0) | 5119 | if (baud_rate <= outq && baud_rate > 0) |
| @@ -5893,28 +5893,34 @@ window_change_signal (signalnum) /* If we don't have an argument, */ | |||
| 5893 | #endif | 5893 | #endif |
| 5894 | int old_errno = errno; | 5894 | int old_errno = errno; |
| 5895 | 5895 | ||
| 5896 | get_frame_size (&width, &height); | 5896 | struct tty_output *tty; |
| 5897 | |||
| 5898 | /* The frame size change obviously applies to a single | ||
| 5899 | termcap-controlled terminal, but we can't decide which. | ||
| 5900 | Therefore, we resize the frames corresponding to each tty. | ||
| 5901 | |||
| 5902 | XXX In fact we only get the signal for the initial terminal. | ||
| 5903 | */ | ||
| 5904 | for (tty = tty_list; tty; tty = tty->next) { | ||
| 5897 | 5905 | ||
| 5898 | /* The frame size change obviously applies to a termcap-controlled | 5906 | get_tty_size (tty, &width, &height); |
| 5899 | frame. Find such a frame in the list, and assume it's the only | 5907 | |
| 5900 | one (since the redisplay code always writes to stdout, not a | 5908 | { |
| 5901 | FILE * specified in the frame structure). Record the new size, | 5909 | Lisp_Object tail, frame; |
| 5902 | but don't reallocate the data structures now. Let that be done | 5910 | |
| 5903 | later outside of the signal handler. */ | 5911 | FOR_EACH_FRAME (tail, frame) |
| 5904 | 5912 | { | |
| 5905 | { | 5913 | if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty) |
| 5906 | Lisp_Object tail, frame; | 5914 | { |
| 5907 | 5915 | /* Record the new sizes, but don't reallocate the data structures | |
| 5908 | FOR_EACH_FRAME (tail, frame) | 5916 | now. Let that be done later outside of the signal handler. */ |
| 5909 | { | 5917 | change_frame_size (XFRAME (frame), height, width, 0, 1, 0); |
| 5910 | if (FRAME_TERMCAP_P (XFRAME (frame))) | 5918 | break; |
| 5911 | { | 5919 | } |
| 5912 | change_frame_size (XFRAME (frame), height, width, 0, 1, 0); | 5920 | } |
| 5913 | break; | 5921 | } |
| 5914 | } | ||
| 5915 | } | ||
| 5916 | } | 5922 | } |
| 5917 | 5923 | ||
| 5918 | signal (SIGWINCH, window_change_signal); | 5924 | signal (SIGWINCH, window_change_signal); |
| 5919 | errno = old_errno; | 5925 | errno = old_errno; |
| 5920 | } | 5926 | } |
| @@ -5969,10 +5975,11 @@ change_frame_size (f, newheight, newwidth, pretend, delay, safe) | |||
| 5969 | { | 5975 | { |
| 5970 | Lisp_Object tail, frame; | 5976 | Lisp_Object tail, frame; |
| 5971 | 5977 | ||
| 5972 | if (! FRAME_WINDOW_P (f)) | 5978 | if (FRAME_MSDOS_P (f)) |
| 5973 | { | 5979 | { |
| 5974 | /* When using termcap, or on MS-DOS, all frames use | 5980 | /* On MS-DOS, all frames use the same screen, so a change in |
| 5975 | the same screen, so a change in size affects all frames. */ | 5981 | size affects all frames. Termcap now supports multiple |
| 5982 | ttys. */ | ||
| 5976 | FOR_EACH_FRAME (tail, frame) | 5983 | FOR_EACH_FRAME (tail, frame) |
| 5977 | if (! FRAME_WINDOW_P (XFRAME (frame))) | 5984 | if (! FRAME_WINDOW_P (XFRAME (frame))) |
| 5978 | change_frame_size_1 (XFRAME (frame), newheight, newwidth, | 5985 | change_frame_size_1 (XFRAME (frame), newheight, newwidth, |
| @@ -6162,7 +6169,7 @@ terminate any keyboard macro currently executing. */) | |||
| 6162 | putchar (07); | 6169 | putchar (07); |
| 6163 | else | 6170 | else |
| 6164 | ring_bell (); | 6171 | ring_bell (); |
| 6165 | fflush (stdout); | 6172 | fflush (TTY_OUTPUT (CURTTY ())); |
| 6166 | } | 6173 | } |
| 6167 | else | 6174 | else |
| 6168 | bitch_at_user (); | 6175 | bitch_at_user (); |
| @@ -6179,7 +6186,7 @@ bitch_at_user () | |||
| 6179 | error ("Keyboard macro terminated by a command ringing the bell"); | 6186 | error ("Keyboard macro terminated by a command ringing the bell"); |
| 6180 | else | 6187 | else |
| 6181 | ring_bell (); | 6188 | ring_bell (); |
| 6182 | fflush (stdout); | 6189 | fflush (TTY_OUTPUT (CURTTY ())); |
| 6183 | } | 6190 | } |
| 6184 | 6191 | ||
| 6185 | 6192 | ||
diff --git a/src/emacs.c b/src/emacs.c index 9b07b5a17b2..4f6d5168c6d 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1564,7 +1564,7 @@ main (argc, argv | |||
| 1564 | if (!noninteractive) | 1564 | if (!noninteractive) |
| 1565 | { | 1565 | { |
| 1566 | #ifdef VMS | 1566 | #ifdef VMS |
| 1567 | init_vms_input ();/* init_display calls get_frame_size, that needs this. */ | 1567 | init_vms_input ();/* init_display calls get_tty_size, that needs this. */ |
| 1568 | #endif /* VMS */ | 1568 | #endif /* VMS */ |
| 1569 | init_display (); /* Determine terminal type. Calls init_sys_modes. */ | 1569 | init_display (); /* Determine terminal type. Calls init_sys_modes. */ |
| 1570 | } | 1570 | } |
diff --git a/src/frame.c b/src/frame.c index 4a97befaf0e..7945ba0454b 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -114,8 +114,6 @@ Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; | |||
| 114 | 114 | ||
| 115 | Lisp_Object Qface_set_after_frame_default; | 115 | Lisp_Object Qface_set_after_frame_default; |
| 116 | 116 | ||
| 117 | |||
| 118 | Lisp_Object Vterminal_frame; | ||
| 119 | Lisp_Object Vdefault_frame_alist; | 117 | Lisp_Object Vdefault_frame_alist; |
| 120 | Lisp_Object Vdefault_frame_scroll_bars; | 118 | Lisp_Object Vdefault_frame_scroll_bars; |
| 121 | Lisp_Object Vmouse_position_function; | 119 | Lisp_Object Vmouse_position_function; |
| @@ -550,6 +548,7 @@ make_terminal_frame (tty, tty_type) | |||
| 550 | f->output_data.tty = term_init (tty, tty_type); | 548 | f->output_data.tty = term_init (tty, tty_type); |
| 551 | else | 549 | else |
| 552 | f->output_data.tty = term_dummy_init (); | 550 | f->output_data.tty = term_dummy_init (); |
| 551 | f->output_data.tty->top_frame = frame; | ||
| 553 | #ifdef CANNOT_DUMP | 552 | #ifdef CANNOT_DUMP |
| 554 | FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR; | 553 | FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR; |
| 555 | FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR; | 554 | FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR; |
| @@ -637,12 +636,15 @@ Note that changing the size of one terminal frame automatically affects all. */ | |||
| 637 | type[SBYTES (tty_type)] = 0; | 636 | type[SBYTES (tty_type)] = 0; |
| 638 | } | 637 | } |
| 639 | 638 | ||
| 640 | |||
| 641 | f = make_terminal_frame (name, type); | 639 | f = make_terminal_frame (name, type); |
| 642 | } | 640 | } |
| 643 | 641 | ||
| 644 | change_frame_size (f, FRAME_LINES (sf), | 642 | { |
| 645 | FRAME_COLS (sf), 0, 0, 0); | 643 | int width, height; |
| 644 | get_tty_size (FRAME_TTY (f), &width, &height); | ||
| 645 | change_frame_size (f, height, width, 0, 0, 0); | ||
| 646 | } | ||
| 647 | |||
| 646 | adjust_glyphs (f); | 648 | adjust_glyphs (f); |
| 647 | calculate_costs (f); | 649 | calculate_costs (f); |
| 648 | XSETFRAME (frame, f); | 650 | XSETFRAME (frame, f); |
| @@ -746,6 +748,15 @@ do_switch_frame (frame, track, for_deletion) | |||
| 746 | if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) | 748 | if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) |
| 747 | resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); | 749 | resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); |
| 748 | 750 | ||
| 751 | if (FRAME_TERMCAP_P (XFRAME (selected_frame)) | ||
| 752 | && FRAME_TERMCAP_P (XFRAME (frame)) | ||
| 753 | && FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame))) | ||
| 754 | { | ||
| 755 | XFRAME (selected_frame)->async_visible = 0; | ||
| 756 | XFRAME (frame)->async_visible = 1; | ||
| 757 | FRAME_TTY (XFRAME (frame))->top_frame = frame; | ||
| 758 | } | ||
| 759 | |||
| 749 | selected_frame = frame; | 760 | selected_frame = frame; |
| 750 | if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) | 761 | if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) |
| 751 | last_nonminibuf_frame = XFRAME (selected_frame); | 762 | last_nonminibuf_frame = XFRAME (selected_frame); |
| @@ -979,7 +990,10 @@ next_frame (frame, minibuf) | |||
| 979 | f = XCAR (tail); | 990 | f = XCAR (tail); |
| 980 | 991 | ||
| 981 | if (passed | 992 | if (passed |
| 982 | && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) | 993 | && ((!FRAME_TERMCAP_P (XFRAME (f)) && !FRAME_TERMCAP_P (XFRAME (frame)) |
| 994 | && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) | ||
| 995 | || (FRAME_TERMCAP_P (XFRAME (f)) && FRAME_TERMCAP_P (XFRAME (frame)) | ||
| 996 | && FRAME_TTY (XFRAME (f)) == FRAME_TTY (XFRAME (frame))))) | ||
| 983 | { | 997 | { |
| 984 | /* Decide whether this frame is eligible to be returned. */ | 998 | /* Decide whether this frame is eligible to be returned. */ |
| 985 | 999 | ||
| @@ -1056,7 +1070,10 @@ prev_frame (frame, minibuf) | |||
| 1056 | if (EQ (frame, f) && !NILP (prev)) | 1070 | if (EQ (frame, f) && !NILP (prev)) |
| 1057 | return prev; | 1071 | return prev; |
| 1058 | 1072 | ||
| 1059 | if (FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) | 1073 | if ((!FRAME_TERMCAP_P (XFRAME (f)) && !FRAME_TERMCAP_P (XFRAME (frame)) |
| 1074 | && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) | ||
| 1075 | || (FRAME_TERMCAP_P (XFRAME (f)) && FRAME_TERMCAP_P (XFRAME (frame)) | ||
| 1076 | && FRAME_TTY (XFRAME (f)) == FRAME_TTY (XFRAME (frame)))) | ||
| 1060 | { | 1077 | { |
| 1061 | /* Decide whether this frame is eligible to be returned, | 1078 | /* Decide whether this frame is eligible to be returned, |
| 1062 | according to minibuf. */ | 1079 | according to minibuf. */ |
| @@ -4081,9 +4098,6 @@ Setting this variable does not affect existing frames, only new ones. */); | |||
| 4081 | = intern ("inhibit-default-face-x-resources"); | 4098 | = intern ("inhibit-default-face-x-resources"); |
| 4082 | staticpro (&Qinhibit_default_face_x_resources); | 4099 | staticpro (&Qinhibit_default_face_x_resources); |
| 4083 | 4100 | ||
| 4084 | DEFVAR_LISP ("terminal-frame", &Vterminal_frame, | ||
| 4085 | doc: /* The initial frame-object, which represents Emacs's stdout. */); | ||
| 4086 | |||
| 4087 | DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified, | 4101 | DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified, |
| 4088 | doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */); | 4102 | doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */); |
| 4089 | Vemacs_iconified = Qnil; | 4103 | Vemacs_iconified = Qnil; |
diff --git a/src/frame.h b/src/frame.h index 6d7f1fffa80..8b081e881a9 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -28,9 +28,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 28 | 28 | ||
| 29 | /* Miscellanea. */ | 29 | /* Miscellanea. */ |
| 30 | 30 | ||
| 31 | /* Nonzero means don't assume anything about current contents of | 31 | /* Nonzero means there is at least one garbaged frame. */ |
| 32 | actual terminal frame */ | ||
| 33 | |||
| 34 | extern int frame_garbaged; | 32 | extern int frame_garbaged; |
| 35 | 33 | ||
| 36 | /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by | 34 | /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by |
| @@ -71,7 +69,7 @@ enum text_cursor_kinds | |||
| 71 | 69 | ||
| 72 | #if !defined(HAVE_X_WINDOWS) | 70 | #if !defined(HAVE_X_WINDOWS) |
| 73 | 71 | ||
| 74 | #define PIX_TYPE int | 72 | #define PIX_TYPE unsigned long |
| 75 | 73 | ||
| 76 | /* A (mostly empty) x_output structure definition for building Emacs | 74 | /* A (mostly empty) x_output structure definition for building Emacs |
| 77 | on Unix and GNU/Linux without X support. */ | 75 | on Unix and GNU/Linux without X support. */ |
| @@ -743,7 +741,10 @@ typedef struct frame *FRAME_PTR; | |||
| 743 | 741 | ||
| 744 | Also, if a frame used to be invisible, but has just become visible, | 742 | Also, if a frame used to be invisible, but has just become visible, |
| 745 | it must be marked as garbaged, since redisplay hasn't been keeping | 743 | it must be marked as garbaged, since redisplay hasn't been keeping |
| 746 | up its contents. */ | 744 | up its contents. |
| 745 | |||
| 746 | Note that a tty frame is visible if and only if it is the topmost | ||
| 747 | frame. */ | ||
| 747 | 748 | ||
| 748 | #define FRAME_SAMPLE_VISIBILITY(f) \ | 749 | #define FRAME_SAMPLE_VISIBILITY(f) \ |
| 749 | (((f)->async_visible && (f)->visible != (f)->async_visible) ? \ | 750 | (((f)->async_visible && (f)->visible != (f)->async_visible) ? \ |
| @@ -799,8 +800,6 @@ extern int other_visible_frames P_ ((struct frame *)); | |||
| 799 | extern Lisp_Object Vframe_list; | 800 | extern Lisp_Object Vframe_list; |
| 800 | extern Lisp_Object Vdefault_frame_alist; | 801 | extern Lisp_Object Vdefault_frame_alist; |
| 801 | 802 | ||
| 802 | extern Lisp_Object Vterminal_frame; | ||
| 803 | |||
| 804 | extern Lisp_Object Vmouse_highlight; | 803 | extern Lisp_Object Vmouse_highlight; |
| 805 | 804 | ||
| 806 | /* The currently selected frame. */ | 805 | /* The currently selected frame. */ |
diff --git a/src/keyboard.c b/src/keyboard.c index dd4619d7967..069c605dc6a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -22,10 +22,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <signal.h> | 23 | #include <signal.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include "lisp.h" | ||
| 25 | #include "systty.h" /* This must be included befor termchar.h. */ | 26 | #include "systty.h" /* This must be included befor termchar.h. */ |
| 26 | #include "termchar.h" | 27 | #include "termchar.h" |
| 27 | #include "termopts.h" | 28 | #include "termopts.h" |
| 28 | #include "lisp.h" | ||
| 29 | #include "termhooks.h" | 29 | #include "termhooks.h" |
| 30 | #include "macros.h" | 30 | #include "macros.h" |
| 31 | #include "keyboard.h" | 31 | #include "keyboard.h" |
| @@ -89,9 +89,6 @@ int interrupt_input_blocked; | |||
| 89 | int interrupt_input_pending; | 89 | int interrupt_input_pending; |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | /* File descriptor to use for input. */ | ||
| 93 | extern int input_fd; | ||
| 94 | |||
| 95 | #ifdef HAVE_WINDOW_SYSTEM | 92 | #ifdef HAVE_WINDOW_SYSTEM |
| 96 | /* Make all keyboard buffers much bigger when using X windows. */ | 93 | /* Make all keyboard buffers much bigger when using X windows. */ |
| 97 | #ifdef MAC_OS8 | 94 | #ifdef MAC_OS8 |
| @@ -6588,7 +6585,7 @@ read_avail_input (expected) | |||
| 6588 | 6585 | ||
| 6589 | if (read_socket_hook) | 6586 | if (read_socket_hook) |
| 6590 | /* No need for FIONREAD or fcntl; just say don't wait. */ | 6587 | /* No need for FIONREAD or fcntl; just say don't wait. */ |
| 6591 | nread = (*read_socket_hook) (input_fd, buf, KBD_BUFFER_SIZE, expected); | 6588 | nread = (*read_socket_hook) (buf, KBD_BUFFER_SIZE, expected); |
| 6592 | else | 6589 | else |
| 6593 | { | 6590 | { |
| 6594 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than | 6591 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than |
| @@ -6597,7 +6594,6 @@ read_avail_input (expected) | |||
| 6597 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; | 6594 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; |
| 6598 | int n_to_read; | 6595 | int n_to_read; |
| 6599 | 6596 | ||
| 6600 | /* Determine how many characters we should *try* to read. */ | ||
| 6601 | #ifdef WINDOWSNT | 6597 | #ifdef WINDOWSNT |
| 6602 | return 0; | 6598 | return 0; |
| 6603 | #else /* not WINDOWSNT */ | 6599 | #else /* not WINDOWSNT */ |
| @@ -6605,88 +6601,121 @@ read_avail_input (expected) | |||
| 6605 | n_to_read = dos_keysns (); | 6601 | n_to_read = dos_keysns (); |
| 6606 | if (n_to_read == 0) | 6602 | if (n_to_read == 0) |
| 6607 | return 0; | 6603 | return 0; |
| 6604 | |||
| 6605 | cbuf[0] = dos_keyread (); | ||
| 6606 | nread = 1; | ||
| 6607 | |||
| 6608 | #else /* not MSDOS */ | 6608 | #else /* not MSDOS */ |
| 6609 | |||
| 6610 | struct tty_output *tty; | ||
| 6611 | nread = 0; | ||
| 6612 | |||
| 6613 | /* Try to read from each available tty, until one succeeds. */ | ||
| 6614 | for (tty = tty_list; tty && !nread; tty = tty->next) { | ||
| 6615 | |||
| 6616 | /* Determine how many characters we should *try* to read. */ | ||
| 6609 | #ifdef FIONREAD | 6617 | #ifdef FIONREAD |
| 6610 | /* Find out how much input is available. */ | 6618 | /* Find out how much input is available. */ |
| 6611 | if (ioctl (input_fd, FIONREAD, &n_to_read) < 0) | 6619 | if (ioctl (fileno (TTY_INPUT (tty)), FIONREAD, &n_to_read) < 0) |
| 6612 | /* Formerly simply reported no input, but that sometimes led to | 6620 | { |
| 6613 | a failure of Emacs to terminate. | 6621 | /* Formerly simply reported no input, but that sometimes led to |
| 6614 | SIGHUP seems appropriate if we can't reach the terminal. */ | 6622 | a failure of Emacs to terminate. |
| 6615 | /* ??? Is it really right to send the signal just to this process | 6623 | SIGHUP seems appropriate if we can't reach the terminal. */ |
| 6616 | rather than to the whole process group? | 6624 | /* ??? Is it really right to send the signal just to this process |
| 6617 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ | 6625 | rather than to the whole process group? |
| 6618 | { | 6626 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ |
| 6619 | if (! noninteractive) | 6627 | if (! noninteractive) |
| 6620 | kill (getpid (), SIGHUP); | 6628 | { |
| 6621 | else | 6629 | if (! tty_list->next) |
| 6622 | n_to_read = 0; | 6630 | kill (getpid (), SIGHUP); /* This was the last terminal. */ |
| 6623 | } | 6631 | else |
| 6624 | if (n_to_read == 0) | 6632 | n_to_read = 0; /* XXX tty should be closed here. */ |
| 6625 | return 0; | 6633 | } |
| 6626 | if (n_to_read > sizeof cbuf) | 6634 | else |
| 6627 | n_to_read = sizeof cbuf; | 6635 | { |
| 6636 | n_to_read = 0; | ||
| 6637 | } | ||
| 6638 | } | ||
| 6639 | if (n_to_read == 0) | ||
| 6640 | continue; | ||
| 6641 | if (n_to_read > sizeof cbuf) | ||
| 6642 | n_to_read = sizeof cbuf; | ||
| 6628 | #else /* no FIONREAD */ | 6643 | #else /* no FIONREAD */ |
| 6629 | #if defined (USG) || defined (DGUX) || defined(CYGWIN) | 6644 | #if defined (USG) || defined (DGUX) || defined(CYGWIN) |
| 6630 | /* Read some input if available, but don't wait. */ | 6645 | /* Read some input if available, but don't wait. */ |
| 6631 | n_to_read = sizeof cbuf; | 6646 | n_to_read = sizeof cbuf; |
| 6632 | fcntl (input_fd, F_SETFL, O_NDELAY); | 6647 | fcntl (fileno (TTY_INPUT (tty)), F_SETFL, O_NDELAY); |
| 6633 | #else | 6648 | #else |
| 6634 | you lose; | 6649 | you lose; |
| 6635 | #endif | 6650 | #endif |
| 6636 | #endif | 6651 | #endif |
| 6637 | #endif /* not MSDOS */ | ||
| 6638 | #endif /* not WINDOWSNT */ | ||
| 6639 | 6652 | ||
| 6640 | /* Now read; for one reason or another, this will not block. | 6653 | /* Now read; for one reason or another, this will not block. |
| 6641 | NREAD is set to the number of chars read. */ | 6654 | NREAD is set to the number of chars read. */ |
| 6642 | do | 6655 | do |
| 6643 | { | 6656 | { |
| 6644 | #ifdef MSDOS | 6657 | nread = emacs_read (fileno (TTY_INPUT (tty)), cbuf, n_to_read); |
| 6645 | cbuf[0] = dos_keyread (); | 6658 | /* POSIX infers that processes which are not in the session leader's |
| 6646 | nread = 1; | 6659 | process group won't get SIGHUP's at logout time. BSDI adheres to |
| 6647 | #else | 6660 | this part standard and returns -1 from read (0) with errno==EIO |
| 6648 | nread = emacs_read (input_fd, cbuf, n_to_read); | 6661 | when the control tty is taken away. |
| 6649 | #endif | 6662 | Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ |
| 6650 | /* POSIX infers that processes which are not in the session leader's | 6663 | if (nread == -1 && errno == EIO) |
| 6651 | process group won't get SIGHUP's at logout time. BSDI adheres to | 6664 | { |
| 6652 | this part standard and returns -1 from read (0) with errno==EIO | 6665 | if (! tty_list->next) |
| 6653 | when the control tty is taken away. | 6666 | kill (0, SIGHUP); /* This was the last terminal. */ |
| 6654 | Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ | 6667 | else |
| 6655 | if (nread == -1 && errno == EIO) | 6668 | ; /* XXX tty should be closed here. */ |
| 6656 | kill (0, SIGHUP); | 6669 | } |
| 6657 | #if defined (AIX) && (! defined (aix386) && defined (_BSD)) | 6670 | #if defined (AIX) && (! defined (aix386) && defined (_BSD)) |
| 6658 | /* The kernel sometimes fails to deliver SIGHUP for ptys. | 6671 | /* The kernel sometimes fails to deliver SIGHUP for ptys. |
| 6659 | This looks incorrect, but it isn't, because _BSD causes | 6672 | This looks incorrect, but it isn't, because _BSD causes |
| 6660 | O_NDELAY to be defined in fcntl.h as O_NONBLOCK, | 6673 | O_NDELAY to be defined in fcntl.h as O_NONBLOCK, |
| 6661 | and that causes a value other than 0 when there is no input. */ | 6674 | and that causes a value other than 0 when there is no input. */ |
| 6662 | if (nread == 0) | 6675 | if (nread == 0) |
| 6663 | kill (0, SIGHUP); | 6676 | { |
| 6677 | if (! tty_list->next) | ||
| 6678 | kill (0, SIGHUP); /* This was the last terminal. */ | ||
| 6679 | else | ||
| 6680 | ; /* XXX tty should be closed here. */ | ||
| 6681 | } | ||
| 6664 | #endif | 6682 | #endif |
| 6665 | } | 6683 | } |
| 6666 | while ( | 6684 | while ( |
| 6667 | /* We used to retry the read if it was interrupted. | 6685 | /* We used to retry the read if it was interrupted. |
| 6668 | But this does the wrong thing when O_NDELAY causes | 6686 | But this does the wrong thing when O_NDELAY causes |
| 6669 | an EAGAIN error. Does anybody know of a situation | 6687 | an EAGAIN error. Does anybody know of a situation |
| 6670 | where a retry is actually needed? */ | 6688 | where a retry is actually needed? */ |
| 6671 | #if 0 | 6689 | #if 0 |
| 6672 | nread < 0 && (errno == EAGAIN | 6690 | nread < 0 && (errno == EAGAIN |
| 6673 | #ifdef EFAULT | 6691 | #ifdef EFAULT |
| 6674 | || errno == EFAULT | 6692 | || errno == EFAULT |
| 6675 | #endif | 6693 | #endif |
| 6676 | #ifdef EBADSLT | 6694 | #ifdef EBADSLT |
| 6677 | || errno == EBADSLT | 6695 | || errno == EBADSLT |
| 6678 | #endif | 6696 | #endif |
| 6679 | ) | 6697 | ) |
| 6680 | #else | 6698 | #else |
| 6681 | 0 | 6699 | 0 |
| 6682 | #endif | 6700 | #endif |
| 6683 | ); | 6701 | ); |
| 6684 | 6702 | ||
| 6685 | #ifndef FIONREAD | 6703 | #ifndef FIONREAD |
| 6686 | #if defined (USG) || defined (DGUX) || defined (CYGWIN) | 6704 | #if defined (USG) || defined (DGUX) || defined (CYGWIN) |
| 6687 | fcntl (input_fd, F_SETFL, 0); | 6705 | fcntl (fileno (TTY_INPUT (tty)), F_SETFL, 0); |
| 6688 | #endif /* USG or DGUX or CYGWIN */ | 6706 | #endif /* USG or DGUX or CYGWIN */ |
| 6689 | #endif /* no FIONREAD */ | 6707 | #endif /* no FIONREAD */ |
| 6708 | |||
| 6709 | } /* for each tty */ | ||
| 6710 | |||
| 6711 | if (! nread) | ||
| 6712 | return 0; | ||
| 6713 | |||
| 6714 | #endif /* not MSDOS */ | ||
| 6715 | #endif /* not WINDOWSNT */ | ||
| 6716 | |||
| 6717 | /* XXX Select frame corresponding to the tty. */ | ||
| 6718 | |||
| 6690 | for (i = 0; i < nread; i++) | 6719 | for (i = 0; i < nread; i++) |
| 6691 | { | 6720 | { |
| 6692 | buf[i].kind = ASCII_KEYSTROKE_EVENT; | 6721 | buf[i].kind = ASCII_KEYSTROKE_EVENT; |
| @@ -10058,6 +10087,9 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10058 | int width, height; | 10087 | int width, height; |
| 10059 | struct gcpro gcpro1; | 10088 | struct gcpro gcpro1; |
| 10060 | 10089 | ||
| 10090 | if (tty_list && tty_list->next) | ||
| 10091 | error ("Suspend is not supported with multiple ttys"); | ||
| 10092 | |||
| 10061 | if (!NILP (stuffstring)) | 10093 | if (!NILP (stuffstring)) |
| 10062 | CHECK_STRING (stuffstring); | 10094 | CHECK_STRING (stuffstring); |
| 10063 | 10095 | ||
| @@ -10066,7 +10098,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10066 | call1 (Vrun_hooks, intern ("suspend-hook")); | 10098 | call1 (Vrun_hooks, intern ("suspend-hook")); |
| 10067 | 10099 | ||
| 10068 | GCPRO1 (stuffstring); | 10100 | GCPRO1 (stuffstring); |
| 10069 | get_frame_size (&old_width, &old_height); | 10101 | get_tty_size (CURTTY (), &old_width, &old_height); |
| 10070 | reset_all_sys_modes (); | 10102 | reset_all_sys_modes (); |
| 10071 | /* sys_suspend can get an error if it tries to fork a subshell | 10103 | /* sys_suspend can get an error if it tries to fork a subshell |
| 10072 | and the system resources aren't available for that. */ | 10104 | and the system resources aren't available for that. */ |
| @@ -10082,7 +10114,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10082 | /* Check if terminal/window size has changed. | 10114 | /* Check if terminal/window size has changed. |
| 10083 | Note that this is not useful when we are running directly | 10115 | Note that this is not useful when we are running directly |
| 10084 | with a window system; but suspend should be disabled in that case. */ | 10116 | with a window system; but suspend should be disabled in that case. */ |
| 10085 | get_frame_size (&width, &height); | 10117 | get_tty_size (CURTTY (), &width, &height); |
| 10086 | if (width != old_width || height != old_height) | 10118 | if (width != old_width || height != old_height) |
| 10087 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); | 10119 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); |
| 10088 | 10120 | ||
diff --git a/src/lisp.h b/src/lisp.h index 2c30549d53b..c2df96fe82d 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2946,7 +2946,6 @@ extern void init_sys_modes P_ ((struct tty_output *)); | |||
| 2946 | extern void reset_sys_modes P_ ((struct tty_output *)); | 2946 | extern void reset_sys_modes P_ ((struct tty_output *)); |
| 2947 | extern void init_all_sys_modes P_ ((void)); | 2947 | extern void init_all_sys_modes P_ ((void)); |
| 2948 | extern void reset_all_sys_modes P_ ((void)); | 2948 | extern void reset_all_sys_modes P_ ((void)); |
| 2949 | extern void get_frame_size P_ ((int *, int *)); | ||
| 2950 | extern void wait_for_termination P_ ((int)); | 2949 | extern void wait_for_termination P_ ((int)); |
| 2951 | extern void flush_pending_output P_ ((int)); | 2950 | extern void flush_pending_output P_ ((int)); |
| 2952 | extern void child_setup_tty P_ ((int)); | 2951 | extern void child_setup_tty P_ ((int)); |
diff --git a/src/macterm.c b/src/macterm.c index dd031919a1f..39dfb8cb9a7 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -7598,7 +7598,7 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 7598 | /* Emacs calls this whenever it wants to read an input event from the | 7598 | /* Emacs calls this whenever it wants to read an input event from the |
| 7599 | user. */ | 7599 | user. */ |
| 7600 | int | 7600 | int |
| 7601 | XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | 7601 | XTread_socket (struct input_event *bufp, int numchars, int expected) |
| 7602 | { | 7602 | { |
| 7603 | int count = 0; | 7603 | int count = 0; |
| 7604 | #if USE_CARBON_EVENTS | 7604 | #if USE_CARBON_EVENTS |
diff --git a/src/scroll.c b/src/scroll.c index f4faca2fad8..c4371377e03 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -22,9 +22,9 @@ Boston, MA 02111-1307, USA. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | #include "lisp.h" | ||
| 25 | #include "systty.h" /* For emacs_tty in termchar.h */ | 26 | #include "systty.h" /* For emacs_tty in termchar.h */ |
| 26 | #include "termchar.h" | 27 | #include "termchar.h" |
| 27 | #include "lisp.h" | ||
| 28 | #include "dispextern.h" | 28 | #include "dispextern.h" |
| 29 | #include "keyboard.h" | 29 | #include "keyboard.h" |
| 30 | #include "frame.h" | 30 | #include "frame.h" |
diff --git a/src/sysdep.c b/src/sysdep.c index 7573cc4b9de..43a7d7c25da 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -246,11 +246,6 @@ static int baud_convert[] = | |||
| 246 | 246 | ||
| 247 | int emacs_ospeed; | 247 | int emacs_ospeed; |
| 248 | 248 | ||
| 249 | /* The file descriptor for Emacs's input terminal. | ||
| 250 | Under Unix, this is normally zero except when using X; | ||
| 251 | under VMS, we place the input channel number here. */ | ||
| 252 | int input_fd; | ||
| 253 | |||
| 254 | void croak P_ ((char *)); | 249 | void croak P_ ((char *)); |
| 255 | 250 | ||
| 256 | #ifdef AIXHFT | 251 | #ifdef AIXHFT |
| @@ -263,16 +258,7 @@ void hft_reset (); | |||
| 263 | SIGMASKTYPE sigprocmask_set; | 258 | SIGMASKTYPE sigprocmask_set; |
| 264 | 259 | ||
| 265 | 260 | ||
| 266 | /* Specify a different file descriptor for further input operations. */ | 261 | /* Discard pending input on all input descriptors. */ |
| 267 | |||
| 268 | void | ||
| 269 | change_input_fd (fd) | ||
| 270 | int fd; | ||
| 271 | { | ||
| 272 | input_fd = fd; | ||
| 273 | } | ||
| 274 | |||
| 275 | /* Discard pending input on descriptor input_fd. */ | ||
| 276 | 262 | ||
| 277 | void | 263 | void |
| 278 | discard_tty_input () | 264 | discard_tty_input () |
| @@ -290,22 +276,28 @@ discard_tty_input () | |||
| 290 | 276 | ||
| 291 | #ifdef VMS | 277 | #ifdef VMS |
| 292 | end_kbd_input (); | 278 | end_kbd_input (); |
| 293 | SYS$QIOW (0, input_fd, IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0, | 279 | SYS$QIOW (0, fileno (TTY_INPUT (CURTTY())), IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0, |
| 294 | &buf.main, 0, 0, terminator_mask, 0, 0); | 280 | &buf.main, 0, 0, terminator_mask, 0, 0); |
| 295 | queue_kbd_input (); | 281 | queue_kbd_input (); |
| 296 | #else /* not VMS */ | 282 | #else /* not VMS */ |
| 297 | #ifdef APOLLO | 283 | #ifdef APOLLO |
| 298 | { | 284 | { |
| 299 | int zero = 0; | 285 | int zero = 0; |
| 300 | ioctl (input_fd, TIOCFLUSH, &zero); | 286 | ioctl (fileno (TTY_INPUT (CURTTY())), TIOCFLUSH, &zero); |
| 301 | } | 287 | } |
| 302 | #else /* not Apollo */ | 288 | #else /* not Apollo */ |
| 303 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 289 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
| 304 | while (dos_keyread () != -1) | 290 | while (dos_keyread () != -1) |
| 305 | ; | 291 | ; |
| 306 | #else /* not MSDOS */ | 292 | #else /* not MSDOS */ |
| 307 | EMACS_GET_TTY (input_fd, &buf); | 293 | { |
| 308 | EMACS_SET_TTY (input_fd, &buf, 0); | 294 | struct tty_output tty; |
| 295 | for (tty = tty_list; tty; tty = tty->next) | ||
| 296 | { | ||
| 297 | EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &buf); | ||
| 298 | EMACS_SET_TTY (fileno (TTY_INPUT (tty)), &buf, 0); | ||
| 299 | } | ||
| 300 | } | ||
| 309 | #endif /* not MSDOS */ | 301 | #endif /* not MSDOS */ |
| 310 | #endif /* not Apollo */ | 302 | #endif /* not Apollo */ |
| 311 | #endif /* not VMS */ | 303 | #endif /* not VMS */ |
| @@ -330,7 +322,7 @@ stuff_char (c) | |||
| 330 | 322 | ||
| 331 | /* Should perhaps error if in batch mode */ | 323 | /* Should perhaps error if in batch mode */ |
| 332 | #ifdef TIOCSTI | 324 | #ifdef TIOCSTI |
| 333 | ioctl (input_fd, TIOCSTI, &c); | 325 | ioctl (fileno (TTY_INPUT (CURTTY())), TIOCSTI, &c); |
| 334 | #else /* no TIOCSTI */ | 326 | #else /* no TIOCSTI */ |
| 335 | error ("Cannot stuff terminal input characters in this version of Unix"); | 327 | error ("Cannot stuff terminal input characters in this version of Unix"); |
| 336 | #endif /* no TIOCSTI */ | 328 | #endif /* no TIOCSTI */ |
| @@ -354,7 +346,7 @@ init_baud_rate () | |||
| 354 | #ifdef VMS | 346 | #ifdef VMS |
| 355 | struct sensemode sg; | 347 | struct sensemode sg; |
| 356 | 348 | ||
| 357 | SYS$QIOW (0, input_fd, IO$_SENSEMODE, &sg, 0, 0, | 349 | SYS$QIOW (0, fileno (TTY_INPUT (CURTTY())), IO$_SENSEMODE, &sg, 0, 0, |
| 358 | &sg.class, 12, 0, 0, 0, 0 ); | 350 | &sg.class, 12, 0, 0, 0, 0 ); |
| 359 | emacs_ospeed = sg.xmit_baud; | 351 | emacs_ospeed = sg.xmit_baud; |
| 360 | #else /* not VMS */ | 352 | #else /* not VMS */ |
| @@ -362,7 +354,7 @@ init_baud_rate () | |||
| 362 | struct termios sg; | 354 | struct termios sg; |
| 363 | 355 | ||
| 364 | sg.c_cflag = B9600; | 356 | sg.c_cflag = B9600; |
| 365 | tcgetattr (input_fd, &sg); | 357 | tcgetattr (fileno (TTY_INPUT (CURTTY())), &sg); |
| 366 | emacs_ospeed = cfgetospeed (&sg); | 358 | emacs_ospeed = cfgetospeed (&sg); |
| 367 | #if defined (USE_GETOBAUD) && defined (getobaud) | 359 | #if defined (USE_GETOBAUD) && defined (getobaud) |
| 368 | /* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */ | 360 | /* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */ |
| @@ -375,16 +367,16 @@ init_baud_rate () | |||
| 375 | 367 | ||
| 376 | sg.c_cflag = B9600; | 368 | sg.c_cflag = B9600; |
| 377 | #ifdef HAVE_TCATTR | 369 | #ifdef HAVE_TCATTR |
| 378 | tcgetattr (input_fd, &sg); | 370 | tcgetattr (fileno (TTY_INPUT (CURTTY())), &sg); |
| 379 | #else | 371 | #else |
| 380 | ioctl (input_fd, TCGETA, &sg); | 372 | ioctl (fileno (TTY_INPUT (CURTTY())), TCGETA, &sg); |
| 381 | #endif | 373 | #endif |
| 382 | emacs_ospeed = sg.c_cflag & CBAUD; | 374 | emacs_ospeed = sg.c_cflag & CBAUD; |
| 383 | #else /* neither VMS nor TERMIOS nor TERMIO */ | 375 | #else /* neither VMS nor TERMIOS nor TERMIO */ |
| 384 | struct sgttyb sg; | 376 | struct sgttyb sg; |
| 385 | 377 | ||
| 386 | sg.sg_ospeed = B9600; | 378 | sg.sg_ospeed = B9600; |
| 387 | if (ioctl (input_fd, TIOCGETP, &sg) < 0) | 379 | if (ioctl (fileno (TTY_INPUT (CURTTY())), TIOCGETP, &sg) < 0) |
| 388 | abort (); | 380 | abort (); |
| 389 | emacs_ospeed = sg.sg_ospeed; | 381 | emacs_ospeed = sg.sg_ospeed; |
| 390 | #endif /* not HAVE_TERMIO */ | 382 | #endif /* not HAVE_TERMIO */ |
| @@ -947,7 +939,7 @@ request_sigio () | |||
| 947 | #ifdef SIGWINCH | 939 | #ifdef SIGWINCH |
| 948 | sigunblock (sigmask (SIGWINCH)); | 940 | sigunblock (sigmask (SIGWINCH)); |
| 949 | #endif | 941 | #endif |
| 950 | fcntl (input_fd, F_SETFL, old_fcntl_flags | FASYNC); | 942 | fcntl (fileno (TTY_INPUT (CURTTY())), F_SETFL, old_fcntl_flags | FASYNC); |
| 951 | 943 | ||
| 952 | interrupts_deferred = 0; | 944 | interrupts_deferred = 0; |
| 953 | } | 945 | } |
| @@ -961,7 +953,7 @@ unrequest_sigio () | |||
| 961 | #ifdef SIGWINCH | 953 | #ifdef SIGWINCH |
| 962 | sigblock (sigmask (SIGWINCH)); | 954 | sigblock (sigmask (SIGWINCH)); |
| 963 | #endif | 955 | #endif |
| 964 | fcntl (input_fd, F_SETFL, old_fcntl_flags); | 956 | fcntl (fileno (TTY_INPUT (CURTTY())), F_SETFL, old_fcntl_flags); |
| 965 | interrupts_deferred = 1; | 957 | interrupts_deferred = 1; |
| 966 | } | 958 | } |
| 967 | 959 | ||
| @@ -976,7 +968,7 @@ request_sigio () | |||
| 976 | if (read_socket_hook) | 968 | if (read_socket_hook) |
| 977 | return; | 969 | return; |
| 978 | 970 | ||
| 979 | ioctl (input_fd, FIOASYNC, &on); | 971 | ioctl (fileno (TTY_INPUT (CURTTY())), FIOASYNC, &on); |
| 980 | interrupts_deferred = 0; | 972 | interrupts_deferred = 0; |
| 981 | } | 973 | } |
| 982 | 974 | ||
| @@ -988,7 +980,7 @@ unrequest_sigio () | |||
| 988 | if (read_socket_hook) | 980 | if (read_socket_hook) |
| 989 | return; | 981 | return; |
| 990 | 982 | ||
| 991 | ioctl (input_fd, FIOASYNC, &off); | 983 | ioctl (fileno (TTY_INPUT (CURTTY())), FIOASYNC, &off); |
| 992 | interrupts_deferred = 1; | 984 | interrupts_deferred = 1; |
| 993 | } | 985 | } |
| 994 | 986 | ||
| @@ -1009,7 +1001,7 @@ request_sigio () | |||
| 1009 | 1001 | ||
| 1010 | sigemptyset (&st); | 1002 | sigemptyset (&st); |
| 1011 | sigaddset (&st, SIGIO); | 1003 | sigaddset (&st, SIGIO); |
| 1012 | ioctl (input_fd, FIOASYNC, &on); | 1004 | ioctl (fileno (TTY_INPUT (CURTTY())), FIOASYNC, &on); |
| 1013 | interrupts_deferred = 0; | 1005 | interrupts_deferred = 0; |
| 1014 | sigprocmask (SIG_UNBLOCK, &st, (sigset_t *)0); | 1006 | sigprocmask (SIG_UNBLOCK, &st, (sigset_t *)0); |
| 1015 | } | 1007 | } |
| @@ -1022,7 +1014,7 @@ unrequest_sigio () | |||
| 1022 | if (read_socket_hook) | 1014 | if (read_socket_hook) |
| 1023 | return; | 1015 | return; |
| 1024 | 1016 | ||
| 1025 | ioctl (input_fd, FIOASYNC, &off); | 1017 | ioctl (fileno (TTY_INPUT (CURTTY())), FIOASYNC, &off); |
| 1026 | interrupts_deferred = 1; | 1018 | interrupts_deferred = 1; |
| 1027 | } | 1019 | } |
| 1028 | 1020 | ||
| @@ -1088,7 +1080,7 @@ narrow_foreground_group () | |||
| 1088 | 1080 | ||
| 1089 | setpgrp (0, inherited_pgroup); | 1081 | setpgrp (0, inherited_pgroup); |
| 1090 | if (inherited_pgroup != me) | 1082 | if (inherited_pgroup != me) |
| 1091 | EMACS_SET_TTY_PGRP (input_fd, &me); | 1083 | EMACS_SET_TTY_PGRP (fileno (stdin), &me); /* stdin is intentional here */ |
| 1092 | setpgrp (0, me); | 1084 | setpgrp (0, me); |
| 1093 | } | 1085 | } |
| 1094 | 1086 | ||
| @@ -1097,7 +1089,7 @@ void | |||
| 1097 | widen_foreground_group () | 1089 | widen_foreground_group () |
| 1098 | { | 1090 | { |
| 1099 | if (inherited_pgroup != getpid ()) | 1091 | if (inherited_pgroup != getpid ()) |
| 1100 | EMACS_SET_TTY_PGRP (input_fd, &inherited_pgroup); | 1092 | EMACS_SET_TTY_PGRP (fileno (stdin), &inherited_pgroup); /* stdin is intentional here */ |
| 1101 | setpgrp (0, inherited_pgroup); | 1093 | setpgrp (0, inherited_pgroup); |
| 1102 | } | 1094 | } |
| 1103 | 1095 | ||
| @@ -1300,8 +1292,8 @@ init_all_sys_modes (void) | |||
| 1300 | } | 1292 | } |
| 1301 | 1293 | ||
| 1302 | void | 1294 | void |
| 1303 | init_sys_modes (otty) | 1295 | init_sys_modes (tty_out) |
| 1304 | struct tty_output *otty; | 1296 | struct tty_output *tty_out; |
| 1305 | { | 1297 | { |
| 1306 | struct emacs_tty tty; | 1298 | struct emacs_tty tty; |
| 1307 | 1299 | ||
| @@ -1357,7 +1349,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1357 | #ifndef VMS4_4 | 1349 | #ifndef VMS4_4 |
| 1358 | sys_access_reinit (); | 1350 | sys_access_reinit (); |
| 1359 | #endif | 1351 | #endif |
| 1360 | #endif /* not VMS */ | 1352 | #endif /* VMS */ |
| 1361 | 1353 | ||
| 1362 | #ifdef BSD_PGRPS | 1354 | #ifdef BSD_PGRPS |
| 1363 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1355 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) |
| @@ -1370,14 +1362,14 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1370 | if (!read_socket_hook && EQ (Vwindow_system, Qnil)) | 1362 | if (!read_socket_hook && EQ (Vwindow_system, Qnil)) |
| 1371 | #endif | 1363 | #endif |
| 1372 | { | 1364 | { |
| 1373 | EMACS_GET_TTY (input_fd, &otty->old_tty); | 1365 | EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), &tty_out->old_tty); |
| 1374 | 1366 | ||
| 1375 | otty->old_tty_valid = 1; | 1367 | tty_out->old_tty_valid = 1; |
| 1376 | 1368 | ||
| 1377 | tty = otty->old_tty; | 1369 | tty = tty_out->old_tty; |
| 1378 | 1370 | ||
| 1379 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1371 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
| 1380 | XSETINT (Vtty_erase_char, otty->old_tty.main.c_cc[VERASE]); | 1372 | XSETINT (Vtty_erase_char, tty_out->old_tty.main.c_cc[VERASE]); |
| 1381 | 1373 | ||
| 1382 | #ifdef DGUX | 1374 | #ifdef DGUX |
| 1383 | /* This allows meta to be sent on 8th bit. */ | 1375 | /* This allows meta to be sent on 8th bit. */ |
| @@ -1542,7 +1534,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1542 | tty.tchars.t_stopc = '\023'; | 1534 | tty.tchars.t_stopc = '\023'; |
| 1543 | } | 1535 | } |
| 1544 | 1536 | ||
| 1545 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | otty->old_tty.lmode; | 1537 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; |
| 1546 | #ifdef ultrix | 1538 | #ifdef ultrix |
| 1547 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt | 1539 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt |
| 1548 | anything, and leaving it in breaks the meta key. Go figure. */ | 1540 | anything, and leaving it in breaks the meta key. Go figure. */ |
| @@ -1560,28 +1552,28 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1560 | tty.ltchars = new_ltchars; | 1552 | tty.ltchars = new_ltchars; |
| 1561 | #endif /* HAVE_LTCHARS */ | 1553 | #endif /* HAVE_LTCHARS */ |
| 1562 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ | 1554 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ |
| 1563 | if (!otty->term_initted) | 1555 | if (!tty_out->term_initted) |
| 1564 | internal_terminal_init (); | 1556 | internal_terminal_init (); |
| 1565 | dos_ttraw (); | 1557 | dos_ttraw (); |
| 1566 | #endif | 1558 | #endif |
| 1567 | 1559 | ||
| 1568 | EMACS_SET_TTY (input_fd, &tty, 0); | 1560 | EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); |
| 1569 | 1561 | ||
| 1570 | /* This code added to insure that, if flow-control is not to be used, | 1562 | /* This code added to insure that, if flow-control is not to be used, |
| 1571 | we have an unlocked terminal at the start. */ | 1563 | we have an unlocked terminal at the start. */ |
| 1572 | 1564 | ||
| 1573 | #ifdef TCXONC | 1565 | #ifdef TCXONC |
| 1574 | if (!flow_control) ioctl (input_fd, TCXONC, 1); | 1566 | if (!flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); |
| 1575 | #endif | 1567 | #endif |
| 1576 | #ifndef APOLLO | 1568 | #ifndef APOLLO |
| 1577 | #ifdef TIOCSTART | 1569 | #ifdef TIOCSTART |
| 1578 | if (!flow_control) ioctl (input_fd, TIOCSTART, 0); | 1570 | if (!flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); |
| 1579 | #endif | 1571 | #endif |
| 1580 | #endif | 1572 | #endif |
| 1581 | 1573 | ||
| 1582 | #if defined (HAVE_TERMIOS) || defined (HPUX9) | 1574 | #if defined (HAVE_TERMIOS) || defined (HPUX9) |
| 1583 | #ifdef TCOON | 1575 | #ifdef TCOON |
| 1584 | if (!flow_control) tcflow (input_fd, TCOON); | 1576 | if (!flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); |
| 1585 | #endif | 1577 | #endif |
| 1586 | #endif | 1578 | #endif |
| 1587 | 1579 | ||
| @@ -1601,7 +1593,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1601 | 1593 | ||
| 1602 | #ifdef VMS | 1594 | #ifdef VMS |
| 1603 | /* Appears to do nothing when in PASTHRU mode. | 1595 | /* Appears to do nothing when in PASTHRU mode. |
| 1604 | SYS$QIOW (0, input_fd, IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, | 1596 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, |
| 1605 | interrupt_signal, oob_chars, 0, 0, 0, 0); | 1597 | interrupt_signal, oob_chars, 0, 0, 0, 0); |
| 1606 | */ | 1598 | */ |
| 1607 | queue_kbd_input (0); | 1599 | queue_kbd_input (0); |
| @@ -1614,9 +1606,9 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1614 | if (interrupt_input | 1606 | if (interrupt_input |
| 1615 | && ! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1607 | && ! read_socket_hook && EQ (Vwindow_system, Qnil)) |
| 1616 | { | 1608 | { |
| 1617 | old_fcntl_owner = fcntl (input_fd, F_GETOWN, 0); | 1609 | old_fcntl_owner = fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); |
| 1618 | fcntl (input_fd, F_SETOWN, getpid ()); | 1610 | fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, getpid ()); |
| 1619 | init_sigio (input_fd); | 1611 | init_sigio (fileno (TTY_INPUT (tty_out))); |
| 1620 | } | 1612 | } |
| 1621 | #endif /* F_GETOWN */ | 1613 | #endif /* F_GETOWN */ |
| 1622 | #endif /* F_SETOWN_BUG */ | 1614 | #endif /* F_SETOWN_BUG */ |
| @@ -1624,7 +1616,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1624 | 1616 | ||
| 1625 | #ifdef BSD4_1 | 1617 | #ifdef BSD4_1 |
| 1626 | if (interrupt_input) | 1618 | if (interrupt_input) |
| 1627 | init_sigio (input_fd); | 1619 | init_sigio (fileno (TTY_INPUT (tty_out))); |
| 1628 | #endif | 1620 | #endif |
| 1629 | 1621 | ||
| 1630 | #ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */ | 1622 | #ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */ |
| @@ -1634,9 +1626,9 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1634 | /* This symbol is defined on recent USG systems. | 1626 | /* This symbol is defined on recent USG systems. |
| 1635 | Someone says without this call USG won't really buffer the file | 1627 | Someone says without this call USG won't really buffer the file |
| 1636 | even with a call to setbuf. */ | 1628 | even with a call to setbuf. */ |
| 1637 | setvbuf (stdout, (char *) _sobuf, _IOFBF, sizeof _sobuf); | 1629 | setvbuf (TTY_OUTPUT (tty_out), (char *) _sobuf, _IOFBF, sizeof _sobuf); |
| 1638 | #else | 1630 | #else |
| 1639 | setbuf (stdout, (char *) _sobuf); | 1631 | setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); |
| 1640 | #endif | 1632 | #endif |
| 1641 | #ifdef HAVE_WINDOW_SYSTEM | 1633 | #ifdef HAVE_WINDOW_SYSTEM |
| 1642 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1634 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
| @@ -1649,26 +1641,37 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1649 | #endif | 1641 | #endif |
| 1650 | ) | 1642 | ) |
| 1651 | #endif | 1643 | #endif |
| 1652 | set_terminal_modes (otty); | 1644 | set_terminal_modes (tty_out); |
| 1653 | 1645 | ||
| 1654 | if (!otty->term_initted | 1646 | if (!tty_out->term_initted) |
| 1655 | && FRAMEP (Vterminal_frame) | 1647 | { |
| 1656 | && FRAME_TERMCAP_P (XFRAME (Vterminal_frame))) | 1648 | Lisp_Object tail, frame; |
| 1657 | init_frame_faces (XFRAME (Vterminal_frame)); | 1649 | FOR_EACH_FRAME (tail, frame) |
| 1650 | { | ||
| 1651 | if (FRAME_TERMCAP_P (XFRAME (frame)) | ||
| 1652 | && FRAME_TTY (XFRAME (frame)) == tty_out) | ||
| 1653 | init_frame_faces (XFRAME (frame)); | ||
| 1654 | } | ||
| 1655 | } | ||
| 1658 | 1656 | ||
| 1659 | if (otty->term_initted && no_redraw_on_reenter) | 1657 | if (tty_out->term_initted && no_redraw_on_reenter) |
| 1660 | { | 1658 | { |
| 1661 | if (display_completed) | 1659 | if (display_completed) |
| 1662 | direct_output_forward_char (0); | 1660 | direct_output_forward_char (0); |
| 1663 | } | 1661 | } |
| 1664 | else | 1662 | else |
| 1665 | { | 1663 | { |
| 1664 | Lisp_Object tail, frame; | ||
| 1666 | frame_garbaged = 1; | 1665 | frame_garbaged = 1; |
| 1667 | if (FRAMEP (Vterminal_frame)) | 1666 | FOR_EACH_FRAME (tail, frame) |
| 1668 | FRAME_GARBAGED_P (XFRAME (Vterminal_frame)) = 1; | 1667 | { |
| 1668 | if (FRAME_TERMCAP_P (XFRAME (frame)) | ||
| 1669 | && FRAME_TTY (XFRAME (frame)) == tty_out) | ||
| 1670 | FRAME_GARBAGED_P (XFRAME (frame)) = 1; | ||
| 1671 | } | ||
| 1669 | } | 1672 | } |
| 1670 | 1673 | ||
| 1671 | otty->term_initted = 1; | 1674 | tty_out->term_initted = 1; |
| 1672 | } | 1675 | } |
| 1673 | 1676 | ||
| 1674 | /* Return nonzero if safe to use tabs in output. | 1677 | /* Return nonzero if safe to use tabs in output. |
| @@ -1679,7 +1682,7 @@ tabs_safe_p () | |||
| 1679 | { | 1682 | { |
| 1680 | struct emacs_tty tty; | 1683 | struct emacs_tty tty; |
| 1681 | 1684 | ||
| 1682 | EMACS_GET_TTY (input_fd, &tty); | 1685 | EMACS_GET_TTY (fileno (TTY_INPUT (CURTTY())), &tty); |
| 1683 | return EMACS_TTY_TABS_OK (&tty); | 1686 | return EMACS_TTY_TABS_OK (&tty); |
| 1684 | } | 1687 | } |
| 1685 | 1688 | ||
| @@ -1688,7 +1691,8 @@ tabs_safe_p () | |||
| 1688 | We store 0 if there's no valid information. */ | 1691 | We store 0 if there's no valid information. */ |
| 1689 | 1692 | ||
| 1690 | void | 1693 | void |
| 1691 | get_frame_size (widthp, heightp) | 1694 | get_tty_size (tty_out, widthp, heightp) |
| 1695 | struct tty_output *tty_out; | ||
| 1692 | int *widthp, *heightp; | 1696 | int *widthp, *heightp; |
| 1693 | { | 1697 | { |
| 1694 | 1698 | ||
| @@ -1697,7 +1701,7 @@ get_frame_size (widthp, heightp) | |||
| 1697 | /* BSD-style. */ | 1701 | /* BSD-style. */ |
| 1698 | struct winsize size; | 1702 | struct winsize size; |
| 1699 | 1703 | ||
| 1700 | if (ioctl (input_fd, TIOCGWINSZ, &size) == -1) | 1704 | if (ioctl (fileno (TTY_INPUT (tty_out)), TIOCGWINSZ, &size) == -1) |
| 1701 | *widthp = *heightp = 0; | 1705 | *widthp = *heightp = 0; |
| 1702 | else | 1706 | else |
| 1703 | { | 1707 | { |
| @@ -1711,7 +1715,7 @@ get_frame_size (widthp, heightp) | |||
| 1711 | /* SunOS - style. */ | 1715 | /* SunOS - style. */ |
| 1712 | struct ttysize size; | 1716 | struct ttysize size; |
| 1713 | 1717 | ||
| 1714 | if (ioctl (input_fd, TIOCGSIZE, &size) == -1) | 1718 | if (ioctl (fileno (TTY_INPUT (tty_out)), TIOCGSIZE, &size) == -1) |
| 1715 | *widthp = *heightp = 0; | 1719 | *widthp = *heightp = 0; |
| 1716 | else | 1720 | else |
| 1717 | { | 1721 | { |
| @@ -1724,7 +1728,7 @@ get_frame_size (widthp, heightp) | |||
| 1724 | 1728 | ||
| 1725 | struct sensemode tty; | 1729 | struct sensemode tty; |
| 1726 | 1730 | ||
| 1727 | SYS$QIOW (0, input_fd, IO$_SENSEMODE, &tty, 0, 0, | 1731 | SYS$QIOW (0, fileno (TTY_INPUT (CURTTY())), IO$_SENSEMODE, &tty, 0, 0, |
| 1728 | &tty.class, 12, 0, 0, 0, 0); | 1732 | &tty.class, 12, 0, 0, 0, 0); |
| 1729 | *widthp = tty.scr_wid; | 1733 | *widthp = tty.scr_wid; |
| 1730 | *heightp = tty.scr_len; | 1734 | *heightp = tty.scr_len; |
| @@ -1794,8 +1798,8 @@ reset_all_sys_modes (void) | |||
| 1794 | /* Prepare the terminal for exiting Emacs; move the cursor to the | 1798 | /* Prepare the terminal for exiting Emacs; move the cursor to the |
| 1795 | bottom of the frame, turn off interrupt-driven I/O, etc. */ | 1799 | bottom of the frame, turn off interrupt-driven I/O, etc. */ |
| 1796 | void | 1800 | void |
| 1797 | reset_sys_modes (otty) | 1801 | reset_sys_modes (tty_out) |
| 1798 | struct tty_output *otty; | 1802 | struct tty_output *tty_out; |
| 1799 | { | 1803 | { |
| 1800 | struct frame *sf; | 1804 | struct frame *sf; |
| 1801 | 1805 | ||
| @@ -1804,7 +1808,7 @@ reset_sys_modes (otty) | |||
| 1804 | fflush (stdout); | 1808 | fflush (stdout); |
| 1805 | return; | 1809 | return; |
| 1806 | } | 1810 | } |
| 1807 | if (!otty->term_initted) | 1811 | if (!tty_out->term_initted) |
| 1808 | return; | 1812 | return; |
| 1809 | #ifdef HAVE_WINDOW_SYSTEM | 1813 | #ifdef HAVE_WINDOW_SYSTEM |
| 1810 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1814 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
| @@ -1834,12 +1838,12 @@ reset_sys_modes (otty) | |||
| 1834 | } | 1838 | } |
| 1835 | #endif | 1839 | #endif |
| 1836 | 1840 | ||
| 1837 | reset_terminal_modes (otty); | 1841 | reset_terminal_modes (tty_out); |
| 1838 | fflush (stdout); | 1842 | fflush (TTY_OUTPUT (tty_out)); |
| 1839 | #ifdef BSD_SYSTEM | 1843 | #ifdef BSD_SYSTEM |
| 1840 | #ifndef BSD4_1 | 1844 | #ifndef BSD4_1 |
| 1841 | /* Avoid possible loss of output when changing terminal modes. */ | 1845 | /* Avoid possible loss of output when changing terminal modes. */ |
| 1842 | fsync (fileno (stdout)); | 1846 | fsync (TTY_OUTPUT (tty_out)); |
| 1843 | #endif | 1847 | #endif |
| 1844 | #endif | 1848 | #endif |
| 1845 | 1849 | ||
| @@ -1849,12 +1853,13 @@ reset_sys_modes (otty) | |||
| 1849 | if (interrupt_input) | 1853 | if (interrupt_input) |
| 1850 | { | 1854 | { |
| 1851 | reset_sigio (); | 1855 | reset_sigio (); |
| 1852 | fcntl (input_fd, F_SETOWN, old_fcntl_owner); | 1856 | fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, old_fcntl_owner); |
| 1853 | } | 1857 | } |
| 1854 | #endif /* F_SETOWN */ | 1858 | #endif /* F_SETOWN */ |
| 1855 | #endif /* F_SETOWN_BUG */ | 1859 | #endif /* F_SETOWN_BUG */ |
| 1856 | #ifdef O_NDELAY | 1860 | #ifdef O_NDELAY |
| 1857 | fcntl (input_fd, F_SETFL, fcntl (input_fd, F_GETFL, 0) & ~O_NDELAY); | 1861 | fcntl (fileno (TTY_INPUT (tty_out)), F_SETFL, |
| 1862 | fcntl (fileno (TTY_INPUT (tty_out)), F_GETFL, 0) & ~O_NDELAY); | ||
| 1858 | #endif | 1863 | #endif |
| 1859 | #endif /* F_SETFL */ | 1864 | #endif /* F_SETFL */ |
| 1860 | #ifdef BSD4_1 | 1865 | #ifdef BSD4_1 |
| @@ -1862,8 +1867,9 @@ reset_sys_modes (otty) | |||
| 1862 | reset_sigio (); | 1867 | reset_sigio (); |
| 1863 | #endif /* BSD4_1 */ | 1868 | #endif /* BSD4_1 */ |
| 1864 | 1869 | ||
| 1865 | if (otty->old_tty_valid) | 1870 | if (tty_out->old_tty_valid) |
| 1866 | while (EMACS_SET_TTY (input_fd, &otty->old_tty, 0) < 0 && errno == EINTR) | 1871 | while (EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), |
| 1872 | &tty_out->old_tty, 0) < 0 && errno == EINTR) | ||
| 1867 | ; | 1873 | ; |
| 1868 | 1874 | ||
| 1869 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ | 1875 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ |
| @@ -1874,7 +1880,7 @@ reset_sys_modes (otty) | |||
| 1874 | /* Ultrix's termios *ignores* any line discipline except TERMIODISC. | 1880 | /* Ultrix's termios *ignores* any line discipline except TERMIODISC. |
| 1875 | A different old line discipline is therefore not restored, yet. | 1881 | A different old line discipline is therefore not restored, yet. |
| 1876 | Restore the old line discipline by hand. */ | 1882 | Restore the old line discipline by hand. */ |
| 1877 | ioctl (0, TIOCSETD, &otty->old_tty.main.c_line); | 1883 | ioctl (0, TIOCSETD, &tty_out->old_tty.main.c_line); |
| 1878 | #endif | 1884 | #endif |
| 1879 | 1885 | ||
| 1880 | #ifdef AIXHFT | 1886 | #ifdef AIXHFT |
| @@ -1947,9 +1953,9 @@ init_vms_input () | |||
| 1947 | { | 1953 | { |
| 1948 | int status; | 1954 | int status; |
| 1949 | 1955 | ||
| 1950 | if (input_fd == 0) | 1956 | if (fileno (TTY_INPUT (CURTTY())) == 0) |
| 1951 | { | 1957 | { |
| 1952 | status = SYS$ASSIGN (&input_dsc, &input_fd, 0, 0); | 1958 | status = SYS$ASSIGN (&input_dsc, &fileno (TTY_INPUT (CURTTY())), 0, 0); |
| 1953 | if (! (status & 1)) | 1959 | if (! (status & 1)) |
| 1954 | LIB$STOP (status); | 1960 | LIB$STOP (status); |
| 1955 | } | 1961 | } |
| @@ -1960,7 +1966,7 @@ init_vms_input () | |||
| 1960 | void | 1966 | void |
| 1961 | stop_vms_input () | 1967 | stop_vms_input () |
| 1962 | { | 1968 | { |
| 1963 | return SYS$DASSGN (input_fd); | 1969 | return SYS$DASSGN (fileno (TTY_INPUT (CURTTY()))); |
| 1964 | } | 1970 | } |
| 1965 | 1971 | ||
| 1966 | short input_buffer; | 1972 | short input_buffer; |
| @@ -1976,7 +1982,7 @@ queue_kbd_input () | |||
| 1976 | 1982 | ||
| 1977 | waiting_for_ast = 0; | 1983 | waiting_for_ast = 0; |
| 1978 | stop_input = 0; | 1984 | stop_input = 0; |
| 1979 | status = SYS$QIO (0, input_fd, IO$_READVBLK, | 1985 | status = SYS$QIO (0, fileno (TTY_INPUT (CURTTY())), IO$_READVBLK, |
| 1980 | &input_iosb, kbd_input_ast, 1, | 1986 | &input_iosb, kbd_input_ast, 1, |
| 1981 | &input_buffer, 1, 0, terminator_mask, 0, 0); | 1987 | &input_buffer, 1, 0, terminator_mask, 0, 0); |
| 1982 | } | 1988 | } |
| @@ -2093,7 +2099,7 @@ end_kbd_input () | |||
| 2093 | #endif | 2099 | #endif |
| 2094 | if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */ | 2100 | if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */ |
| 2095 | { | 2101 | { |
| 2096 | SYS$CANCEL (input_fd); | 2102 | SYS$CANCEL (fileno (TTY_INPUT (CURTTY()))); |
| 2097 | return; | 2103 | return; |
| 2098 | } | 2104 | } |
| 2099 | 2105 | ||
| @@ -2102,7 +2108,7 @@ end_kbd_input () | |||
| 2102 | SYS$CLREF (input_ef); | 2108 | SYS$CLREF (input_ef); |
| 2103 | waiting_for_ast = 1; | 2109 | waiting_for_ast = 1; |
| 2104 | stop_input = 1; | 2110 | stop_input = 1; |
| 2105 | SYS$CANCEL (input_fd); | 2111 | SYS$CANCEL (fileno (TTY_INPUT (CURTTY()))); |
| 2106 | SYS$SETAST (1); | 2112 | SYS$SETAST (1); |
| 2107 | SYS$WAITFR (input_ef); | 2113 | SYS$WAITFR (input_ef); |
| 2108 | waiting_for_ast = 0; | 2114 | waiting_for_ast = 0; |
diff --git a/src/term.c b/src/term.c index 4ecca5770a9..1df6e67a353 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -28,10 +28,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 28 | 28 | ||
| 29 | #include <sys/file.h> | 29 | #include <sys/file.h> |
| 30 | 30 | ||
| 31 | #include "lisp.h" | ||
| 31 | #include "systty.h" /* For emacs_tty in termchar.h */ | 32 | #include "systty.h" /* For emacs_tty in termchar.h */ |
| 32 | #include "termchar.h" | 33 | #include "termchar.h" |
| 33 | #include "termopts.h" | 34 | #include "termopts.h" |
| 34 | #include "lisp.h" | ||
| 35 | #include "charset.h" | 35 | #include "charset.h" |
| 36 | #include "coding.h" | 36 | #include "coding.h" |
| 37 | #include "keyboard.h" | 37 | #include "keyboard.h" |
| @@ -123,7 +123,7 @@ void (*insert_glyphs_hook) P_ ((struct glyph *, int)); | |||
| 123 | void (*write_glyphs_hook) P_ ((struct glyph *, int)); | 123 | void (*write_glyphs_hook) P_ ((struct glyph *, int)); |
| 124 | void (*delete_glyphs_hook) P_ ((int)); | 124 | void (*delete_glyphs_hook) P_ ((int)); |
| 125 | 125 | ||
| 126 | int (*read_socket_hook) P_ ((int, struct input_event *, int, int)); | 126 | int (*read_socket_hook) P_ ((struct input_event *, int, int)); |
| 127 | 127 | ||
| 128 | void (*frame_up_to_date_hook) P_ ((struct frame *)); | 128 | void (*frame_up_to_date_hook) P_ ((struct frame *)); |
| 129 | 129 | ||
| @@ -792,12 +792,11 @@ clear_end_of_line (first_unused_hpos) | |||
| 792 | } | 792 | } |
| 793 | else | 793 | else |
| 794 | { /* have to do it the hard way */ | 794 | { /* have to do it the hard way */ |
| 795 | struct frame *sf = XFRAME (selected_frame); | ||
| 796 | turn_off_insert (); | 795 | turn_off_insert (); |
| 797 | 796 | ||
| 798 | /* Do not write in last row last col with Auto-wrap on. */ | 797 | /* Do not write in last row last col with Auto-wrap on. */ |
| 799 | if (AutoWrap && curY == FRAME_LINES (sf) - 1 | 798 | if (AutoWrap && curY == FRAME_LINES (f) - 1 |
| 800 | && first_unused_hpos == FRAME_COLS (sf)) | 799 | && first_unused_hpos == FRAME_COLS (f)) |
| 801 | first_unused_hpos--; | 800 | first_unused_hpos--; |
| 802 | 801 | ||
| 803 | for (i = curX; i < first_unused_hpos; i++) | 802 | for (i = curX; i < first_unused_hpos; i++) |
| @@ -925,8 +924,7 @@ write_glyphs (string, len) | |||
| 925 | register int len; | 924 | register int len; |
| 926 | { | 925 | { |
| 927 | int produced, consumed; | 926 | int produced, consumed; |
| 928 | struct frame *sf = XFRAME (selected_frame); | 927 | struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); |
| 929 | struct frame *f = updating_frame ? updating_frame : sf; | ||
| 930 | unsigned char conversion_buffer[1024]; | 928 | unsigned char conversion_buffer[1024]; |
| 931 | int conversion_buffer_size = sizeof conversion_buffer; | 929 | int conversion_buffer_size = sizeof conversion_buffer; |
| 932 | 930 | ||
| @@ -944,8 +942,8 @@ write_glyphs (string, len) | |||
| 944 | since that would scroll the whole frame on some terminals. */ | 942 | since that would scroll the whole frame on some terminals. */ |
| 945 | 943 | ||
| 946 | if (AutoWrap | 944 | if (AutoWrap |
| 947 | && curY + 1 == FRAME_LINES (sf) | 945 | && curY + 1 == FRAME_LINES (f) |
| 948 | && (curX + len) == FRAME_COLS (sf)) | 946 | && (curX + len) == FRAME_COLS (f)) |
| 949 | len --; | 947 | len --; |
| 950 | if (len <= 0) | 948 | if (len <= 0) |
| 951 | return; | 949 | return; |
| @@ -1028,7 +1026,7 @@ insert_glyphs (start, len) | |||
| 1028 | { | 1026 | { |
| 1029 | char *buf; | 1027 | char *buf; |
| 1030 | struct glyph *glyph = NULL; | 1028 | struct glyph *glyph = NULL; |
| 1031 | struct frame *f, *sf; | 1029 | struct frame *f; |
| 1032 | 1030 | ||
| 1033 | if (len <= 0) | 1031 | if (len <= 0) |
| 1034 | return; | 1032 | return; |
| @@ -1039,8 +1037,7 @@ insert_glyphs (start, len) | |||
| 1039 | return; | 1037 | return; |
| 1040 | } | 1038 | } |
| 1041 | 1039 | ||
| 1042 | sf = XFRAME (selected_frame); | 1040 | f = updating_frame ? updating_frame : XFRAME (selected_frame); |
| 1043 | f = updating_frame ? updating_frame : sf; | ||
| 1044 | 1041 | ||
| 1045 | if (TS_ins_multi_chars) | 1042 | if (TS_ins_multi_chars) |
| 1046 | { | 1043 | { |
| @@ -1159,7 +1156,7 @@ ins_del_lines (vpos, n) | |||
| 1159 | char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines; | 1156 | char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines; |
| 1160 | char *single = n > 0 ? TS_ins_line : TS_del_line; | 1157 | char *single = n > 0 ? TS_ins_line : TS_del_line; |
| 1161 | char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll; | 1158 | char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll; |
| 1162 | struct frame *sf; | 1159 | struct frame *f; |
| 1163 | 1160 | ||
| 1164 | register int i = n > 0 ? n : -n; | 1161 | register int i = n > 0 ? n : -n; |
| 1165 | register char *buf; | 1162 | register char *buf; |
| @@ -1170,7 +1167,7 @@ ins_del_lines (vpos, n) | |||
| 1170 | return; | 1167 | return; |
| 1171 | } | 1168 | } |
| 1172 | 1169 | ||
| 1173 | sf = XFRAME (selected_frame); | 1170 | f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 1174 | 1171 | ||
| 1175 | /* If the lines below the insertion are being pushed | 1172 | /* If the lines below the insertion are being pushed |
| 1176 | into the end of the window, this is the same as clearing; | 1173 | into the end of the window, this is the same as clearing; |
| @@ -1179,11 +1176,11 @@ ins_del_lines (vpos, n) | |||
| 1179 | /* If the lines below the deletion are blank lines coming | 1176 | /* If the lines below the deletion are blank lines coming |
| 1180 | out of the end of the window, don't bother, | 1177 | out of the end of the window, don't bother, |
| 1181 | as there will be a matching inslines later that will flush them. */ | 1178 | as there will be a matching inslines later that will flush them. */ |
| 1182 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (sf)) | 1179 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (f)) |
| 1183 | && vpos + i >= specified_window) | 1180 | && vpos + i >= specified_window) |
| 1184 | return; | 1181 | return; |
| 1185 | if (!TTY_MEMORY_BELOW_FRAME (FRAME_TTY (sf)) | 1182 | if (!TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f)) |
| 1186 | && vpos + i >= FRAME_LINES (sf)) | 1183 | && vpos + i >= FRAME_LINES (f)) |
| 1187 | return; | 1184 | return; |
| 1188 | 1185 | ||
| 1189 | if (multi) | 1186 | if (multi) |
| @@ -1191,7 +1188,7 @@ ins_del_lines (vpos, n) | |||
| 1191 | raw_cursor_to (vpos, 0); | 1188 | raw_cursor_to (vpos, 0); |
| 1192 | background_highlight (); | 1189 | background_highlight (); |
| 1193 | buf = tparam (multi, 0, 0, i); | 1190 | buf = tparam (multi, 0, 0, i); |
| 1194 | OUTPUT (FRAME_TTY (sf), buf); | 1191 | OUTPUT (FRAME_TTY (f), buf); |
| 1195 | xfree (buf); | 1192 | xfree (buf); |
| 1196 | } | 1193 | } |
| 1197 | else if (single) | 1194 | else if (single) |
| @@ -1199,7 +1196,7 @@ ins_del_lines (vpos, n) | |||
| 1199 | raw_cursor_to (vpos, 0); | 1196 | raw_cursor_to (vpos, 0); |
| 1200 | background_highlight (); | 1197 | background_highlight (); |
| 1201 | while (--i >= 0) | 1198 | while (--i >= 0) |
| 1202 | OUTPUT (FRAME_TTY (sf), single); | 1199 | OUTPUT (FRAME_TTY (f), single); |
| 1203 | if (TF_teleray) | 1200 | if (TF_teleray) |
| 1204 | curX = 0; | 1201 | curX = 0; |
| 1205 | } | 1202 | } |
| @@ -1212,15 +1209,15 @@ ins_del_lines (vpos, n) | |||
| 1212 | raw_cursor_to (vpos, 0); | 1209 | raw_cursor_to (vpos, 0); |
| 1213 | background_highlight (); | 1210 | background_highlight (); |
| 1214 | while (--i >= 0) | 1211 | while (--i >= 0) |
| 1215 | OUTPUTL (FRAME_TTY (sf), scroll, specified_window - vpos); | 1212 | OUTPUTL (FRAME_TTY (f), scroll, specified_window - vpos); |
| 1216 | set_scroll_region (0, specified_window); | 1213 | set_scroll_region (0, specified_window); |
| 1217 | } | 1214 | } |
| 1218 | 1215 | ||
| 1219 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (sf)) | 1216 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f)) |
| 1220 | && TTY_MEMORY_BELOW_FRAME (FRAME_TTY (sf)) | 1217 | && TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f)) |
| 1221 | && n < 0) | 1218 | && n < 0) |
| 1222 | { | 1219 | { |
| 1223 | cursor_to (FRAME_LINES (sf) + n, 0); | 1220 | cursor_to (FRAME_LINES (f) + n, 0); |
| 1224 | clear_to_end (); | 1221 | clear_to_end (); |
| 1225 | } | 1222 | } |
| 1226 | } | 1223 | } |
| @@ -2475,7 +2472,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2475 | /* Get frame size from system, or else from termcap. */ | 2472 | /* Get frame size from system, or else from termcap. */ |
| 2476 | { | 2473 | { |
| 2477 | int height, width; | 2474 | int height, width; |
| 2478 | get_frame_size (&width, &height); | 2475 | get_tty_size (tty, &width, &height); |
| 2479 | FRAME_COLS (sf) = width; | 2476 | FRAME_COLS (sf) = width; |
| 2480 | FRAME_LINES (sf) = height; | 2477 | FRAME_LINES (sf) = height; |
| 2481 | } | 2478 | } |
diff --git a/src/termchar.h b/src/termchar.h index 9d7399e80d9..a58dbc62125 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -39,8 +39,16 @@ struct tty_output | |||
| 39 | 39 | ||
| 40 | int term_initted; /* 1 if we have been through init_sys_modes. */ | 40 | int term_initted; /* 1 if we have been through init_sys_modes. */ |
| 41 | int old_tty_valid; /* 1 if outer tty status has been recorded. */ | 41 | int old_tty_valid; /* 1 if outer tty status has been recorded. */ |
| 42 | |||
| 43 | |||
| 44 | /* Redisplay. */ | ||
| 45 | |||
| 46 | /* XXX This may cause problems with GC. */ | ||
| 47 | Lisp_Object top_frame; /* The topmost frame on this tty. */ | ||
| 42 | 48 | ||
| 43 | 49 | /* The previous terminal frame we displayed on this tty. */ | |
| 50 | struct frame *previous_terminal_frame; | ||
| 51 | |||
| 44 | /* Pixel values. | 52 | /* Pixel values. |
| 45 | XXX What are these used for? */ | 53 | XXX What are these used for? */ |
| 46 | 54 | ||
diff --git a/src/termhooks.h b/src/termhooks.h index c1ada7b851f..0fc48a883e8 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -371,7 +371,7 @@ struct input_event | |||
| 371 | #define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event)) | 371 | #define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event)) |
| 372 | 372 | ||
| 373 | /* Called to read input events. */ | 373 | /* Called to read input events. */ |
| 374 | extern int (*read_socket_hook) P_ ((int, struct input_event *, int, int)); | 374 | extern int (*read_socket_hook) P_ ((struct input_event *, int, int)); |
| 375 | 375 | ||
| 376 | /* Called when a frame's display becomes entirely up to date. */ | 376 | /* Called when a frame's display becomes entirely up to date. */ |
| 377 | extern void (*frame_up_to_date_hook) P_ ((struct frame *)); | 377 | extern void (*frame_up_to_date_hook) P_ ((struct frame *)); |
diff --git a/src/w32inevt.c b/src/w32inevt.c index b3f8e3ff737..24295e122d0 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -642,7 +642,7 @@ maybe_generate_resize_event () | |||
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | int | 644 | int |
| 645 | w32_console_read_socket (int sd, struct input_event *bufp, int numchars, | 645 | w32_console_read_socket (struct input_event *bufp, int numchars, |
| 646 | int expected) | 646 | int expected) |
| 647 | { | 647 | { |
| 648 | BOOL no_events = TRUE; | 648 | BOOL no_events = TRUE; |
diff --git a/src/w32term.c b/src/w32term.c index 06d82a7bee3..7f29cfe0869 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4078,8 +4078,7 @@ static short temp_buffer[100]; | |||
| 4078 | */ | 4078 | */ |
| 4079 | 4079 | ||
| 4080 | int | 4080 | int |
| 4081 | w32_read_socket (sd, bufp, numchars, expected) | 4081 | w32_read_socket (bufp, numchars, expected) |
| 4082 | register int sd; | ||
| 4083 | /* register */ struct input_event *bufp; | 4082 | /* register */ struct input_event *bufp; |
| 4084 | /* register */ int numchars; | 4083 | /* register */ int numchars; |
| 4085 | int expected; | 4084 | int expected; |
diff --git a/src/window.c b/src/window.c index 48e517a68f7..4efc43bb9ce 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6384,7 +6384,6 @@ init_window_once () | |||
| 6384 | { | 6384 | { |
| 6385 | struct frame *f = make_terminal_frame (0, 0); | 6385 | struct frame *f = make_terminal_frame (0, 0); |
| 6386 | XSETFRAME (selected_frame, f); | 6386 | XSETFRAME (selected_frame, f); |
| 6387 | Vterminal_frame = selected_frame; | ||
| 6388 | minibuf_window = f->minibuffer_window; | 6387 | minibuf_window = f->minibuffer_window; |
| 6389 | selected_window = f->selected_window; | 6388 | selected_window = f->selected_window; |
| 6390 | last_nonminibuf_frame = f; | 6389 | last_nonminibuf_frame = f; |
diff --git a/src/xdisp.c b/src/xdisp.c index cedfa9a72d5..79630ebab22 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -736,10 +736,6 @@ enum move_it_result | |||
| 736 | #define CLEAR_FACE_CACHE_COUNT 500 | 736 | #define CLEAR_FACE_CACHE_COUNT 500 |
| 737 | static int clear_face_cache_count; | 737 | static int clear_face_cache_count; |
| 738 | 738 | ||
| 739 | /* Record the previous terminal frame we displayed. */ | ||
| 740 | |||
| 741 | static struct frame *previous_terminal_frame; | ||
| 742 | |||
| 743 | /* Non-zero while redisplay_internal is in progress. */ | 739 | /* Non-zero while redisplay_internal is in progress. */ |
| 744 | 740 | ||
| 745 | int redisplaying_p; | 741 | int redisplaying_p; |
| @@ -2012,7 +2008,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2012 | 2008 | ||
| 2013 | /* If realized faces have been removed, e.g. because of face | 2009 | /* If realized faces have been removed, e.g. because of face |
| 2014 | attribute changes of named faces, recompute them. When running | 2010 | attribute changes of named faces, recompute them. When running |
| 2015 | in batch mode, the face cache of Vterminal_frame is null. If | 2011 | in batch mode, the face cache of the initial frame is null. If |
| 2016 | we happen to get called, make a dummy face cache. */ | 2012 | we happen to get called, make a dummy face cache. */ |
| 2017 | if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL) | 2013 | if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL) |
| 2018 | init_frame_faces (it->f); | 2014 | init_frame_faces (it->f); |
| @@ -7559,11 +7555,11 @@ clear_garbaged_frames () | |||
| 7559 | { | 7555 | { |
| 7560 | Lisp_Object tail, frame; | 7556 | Lisp_Object tail, frame; |
| 7561 | int changed_count = 0; | 7557 | int changed_count = 0; |
| 7562 | 7558 | ||
| 7563 | FOR_EACH_FRAME (tail, frame) | 7559 | FOR_EACH_FRAME (tail, frame) |
| 7564 | { | 7560 | { |
| 7565 | struct frame *f = XFRAME (frame); | 7561 | struct frame *f = XFRAME (frame); |
| 7566 | 7562 | ||
| 7567 | if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) | 7563 | if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) |
| 7568 | { | 7564 | { |
| 7569 | if (f->resized_p) | 7565 | if (f->resized_p) |
| @@ -7574,7 +7570,7 @@ clear_garbaged_frames () | |||
| 7574 | f->resized_p = 0; | 7570 | f->resized_p = 0; |
| 7575 | } | 7571 | } |
| 7576 | } | 7572 | } |
| 7577 | 7573 | ||
| 7578 | frame_garbaged = 0; | 7574 | frame_garbaged = 0; |
| 7579 | if (changed_count) | 7575 | if (changed_count) |
| 7580 | ++windows_or_buffers_changed; | 7576 | ++windows_or_buffers_changed; |
| @@ -7610,7 +7606,7 @@ echo_area_display (update_frame_p) | |||
| 7610 | /* When Emacs starts, selected_frame may be a visible terminal | 7606 | /* When Emacs starts, selected_frame may be a visible terminal |
| 7611 | frame, even if we run under a window system. If we let this | 7607 | frame, even if we run under a window system. If we let this |
| 7612 | through, a message would be displayed on the terminal. */ | 7608 | through, a message would be displayed on the terminal. */ |
| 7613 | if (EQ (selected_frame, Vterminal_frame) | 7609 | if (!FRAME_WINDOW_P (XFRAME (selected_frame)) |
| 7614 | && !NILP (Vwindow_system)) | 7610 | && !NILP (Vwindow_system)) |
| 7615 | return 0; | 7611 | return 0; |
| 7616 | #endif /* HAVE_WINDOW_SYSTEM */ | 7612 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -9687,17 +9683,16 @@ redisplay_internal (preserve_echo_area) | |||
| 9687 | if (face_change_count) | 9683 | if (face_change_count) |
| 9688 | ++windows_or_buffers_changed; | 9684 | ++windows_or_buffers_changed; |
| 9689 | 9685 | ||
| 9690 | if (! FRAME_WINDOW_P (sf) | 9686 | if (FRAME_TERMCAP_P (sf) |
| 9691 | && previous_terminal_frame != sf) | 9687 | && FRAME_TTY (sf)->previous_terminal_frame != sf) |
| 9692 | { | 9688 | { |
| 9693 | /* Since frames on an ASCII terminal share the same display | 9689 | /* Since frames on a single ASCII terminal share the same |
| 9694 | area, displaying a different frame means redisplay the whole | 9690 | display area, displaying a different frame means redisplay |
| 9695 | thing. */ | 9691 | the whole thing. */ |
| 9696 | windows_or_buffers_changed++; | 9692 | windows_or_buffers_changed++; |
| 9697 | SET_FRAME_GARBAGED (sf); | 9693 | SET_FRAME_GARBAGED (sf); |
| 9698 | XSETFRAME (Vterminal_frame, sf); | 9694 | FRAME_TTY (sf)->previous_terminal_frame = sf; |
| 9699 | } | 9695 | } |
| 9700 | previous_terminal_frame = sf; | ||
| 9701 | 9696 | ||
| 9702 | /* Set the visible flags for all frames. Do this before checking | 9697 | /* Set the visible flags for all frames. Do this before checking |
| 9703 | for resized or garbaged frames; they want to know if their frames | 9698 | for resized or garbaged frames; they want to know if their frames |
| @@ -9719,6 +9714,7 @@ redisplay_internal (preserve_echo_area) | |||
| 9719 | } | 9714 | } |
| 9720 | } | 9715 | } |
| 9721 | 9716 | ||
| 9717 | |||
| 9722 | /* Notice any pending interrupt request to change frame size. */ | 9718 | /* Notice any pending interrupt request to change frame size. */ |
| 9723 | do_pending_window_change (1); | 9719 | do_pending_window_change (1); |
| 9724 | 9720 | ||
| @@ -10076,7 +10072,7 @@ redisplay_internal (preserve_echo_area) | |||
| 10076 | { | 10072 | { |
| 10077 | struct frame *f = XFRAME (frame); | 10073 | struct frame *f = XFRAME (frame); |
| 10078 | 10074 | ||
| 10079 | if (FRAME_WINDOW_P (f) || f == sf) | 10075 | if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) |
| 10080 | { | 10076 | { |
| 10081 | if (! EQ (frame, selected_frame)) | 10077 | if (! EQ (frame, selected_frame)) |
| 10082 | /* Select the frame, for the sake of frame-local | 10078 | /* Select the frame, for the sake of frame-local |
diff --git a/src/xterm.c b/src/xterm.c index 8718d76bc31..30de48aa5e7 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7057,8 +7057,7 @@ x_dispatch_event (event, display) | |||
| 7057 | EXPECTED is nonzero if the caller knows input is available. */ | 7057 | EXPECTED is nonzero if the caller knows input is available. */ |
| 7058 | 7058 | ||
| 7059 | static int | 7059 | static int |
| 7060 | XTread_socket (sd, bufp, numchars, expected) | 7060 | XTread_socket (bufp, numchars, expected) |
| 7061 | register int sd; | ||
| 7062 | /* register */ struct input_event *bufp; | 7061 | /* register */ struct input_event *bufp; |
| 7063 | /* register */ int numchars; | 7062 | /* register */ int numchars; |
| 7064 | int expected; | 7063 | int expected; |