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/term.c | |
| 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/term.c')
| -rw-r--r-- | src/term.c | 45 |
1 files changed, 21 insertions, 24 deletions
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 | } |