diff options
| author | Karoly Lorentey | 2004-01-02 01:15:26 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-02 01:15:26 +0000 |
| commit | daf0170133e658c41f3ae2fc8558c5ab74227c1d (patch) | |
| tree | fa6577e49c4c63a6ad6e672f9e3bd1a018cb61d0 /src | |
| parent | 28d7d09f841801cd052bb4ba0df92016b9245870 (diff) | |
| download | emacs-daf0170133e658c41f3ae2fc8558c5ab74227c1d.tar.gz emacs-daf0170133e658c41f3ae2fc8558c5ab74227c1d.zip | |
Fixed X support, preliminary support for X-tty combo sessions.
lib-src/emacsclient.c (copy_from_to, pty_conversation): Re-added SIGIO
hack. (Sigh.)
lisp/frame.el (make-frame-on-tty): Use make-terminal-frame, not
make-frame.
src/dispnew.c (line_hash_code, line_draw_cost): Updated to use
the new display_method parameters.
(Fredraw_frame): fflush the tty only if f is a termcap frame.
(direct_output_for_insert): Updated to use the new display_method
parameters. fflush the tty only if f is a termcap frame.
(direct_output_forward_char, update_frame_1, scrolling): Ditto.
(update_frame_line, Fding, bitch_at_user): Ditto.
(Fsend_string_to_terminal): Fail if current frame is not on a tty.
(init_display): Frame size change is safe here.
src/frame.c (Vterminal_frame): Restored previously deleted variable.
(syms_of_frame): Initialize it.
(make_terminal_frame): Copy the frame's display_method from tty_display_info.
(Fmake_terminal_frame): Enable simultaneous X and tty frames (buggy).
(Fredirect_frame_focus): Don't call frame_rehighlight_hook if frame
is on a termcap device.
src/frame.h (struct frame): Renamed display to display_method.
(Vterminal_frame): Re-added declaration.
src/keyboard.c (flow_control): Moved to struct tty_display_info.
(read_avail_input): Check ttys even if there is a read_socket_hook.
(Fset_input_mode): Call reset_sys_modes/init_sys_modes and set
flow_control or meta_key only when the frame is a termcap frame.
(Fcurrent_input_mode): Handle flow_control and meta_key right on
non-termcap frames.
src/scroll.c (calculate_scrolling, calculate_direct_scrolling): Update
to use the new display_method parameters.
(scrolling_1, scroll_cost): Ditto.
src/sysdep.c (init_sys_modes, reset_sys_modes): Always set the
terminal parameters if tty_out->input is not stdin. Updated to the
new location of flow_control.
(hft_init): Moved HFT init code to term_init, as it needs the frame.
src/term.c (tty_display_method_template): New variable.
(update_begin): Added rif hack.
(set_terminal_window, ins_del_lines, term_init): Updated to use the
new display_method parameters.
(insert_glyphs, ins_del_lines): Only call insert_glyphs_hook if the
current frame is not on a tty.
(calculate_costs): Don't calculate costs if not on a tty.
(term_dummy_init): Fixed tty->output initialization. Preallocate Wcm
and display_method.
(term_init): Allocate & initialize display_method. Blindly fixed
WINDOWSNT-specific parts. Added HFT-specific initialization
exception from hft_init.
(delete_tty): Only delete termcap frames. Free() the display_method.
src/termchar.h (struct tty_display_info): Moved high-level terminal
characteristics to struct display_method. Added flow_control and
display_method members.
src/termhooks.h (struct display_method): New struct (renamed from
struct device). Added accessor macros.
src/window.c (init_window_once): Initialize Vterminal_frame.
src/xdisp.c (init_iterator, expose_frame): Added rif hack.
(try_window_id): Updated to use the new display_method parameters.
src/xfaces.c (realize_basic_faces): Don't call
x_update_menu_appearance if the frame is a tty frame.
src/xfns.c (Fx_create_frame): Added rif hack. Initialize
display_method.
(x_create_tip_frame): Initialize display_method.
src/xterm.c (x_display_method): New variable.
(x_flush, x_frame_of_widget, XTmouse_position): Ignore non-X frames.
(x_window_to_scroll_bar, x_window_to_menu_bar): Ditto.
(xim_destroy_callback, xim_instantiate_callback): Ditto.
(frame_highlight, frame_unhighlight): Added rif hack.
(x_initialize): Don't initialize rif. Do initialize x_display_method.
src/xterm.h (x_display_method): New declaration.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-30
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 50 | ||||
| -rw-r--r-- | src/frame.c | 13 | ||||
| -rw-r--r-- | src/frame.h | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 50 | ||||
| -rw-r--r-- | src/scroll.c | 9 | ||||
| -rw-r--r-- | src/sysdep.c | 28 | ||||
| -rw-r--r-- | src/term.c | 239 | ||||
| -rw-r--r-- | src/termchar.h | 38 | ||||
| -rw-r--r-- | src/termhooks.h | 39 | ||||
| -rw-r--r-- | src/window.c | 1 | ||||
| -rw-r--r-- | src/xdisp.c | 12 | ||||
| -rw-r--r-- | src/xfaces.c | 3 | ||||
| -rw-r--r-- | src/xfns.c | 6 | ||||
| -rw-r--r-- | src/xterm.c | 111 | ||||
| -rw-r--r-- | src/xterm.h | 3 |
16 files changed, 359 insertions, 249 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index e42c5099830..8a19441c53a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -1111,7 +1111,7 @@ process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \ | |||
| 1111 | regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h charset.h | 1111 | regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h charset.h |
| 1112 | region-cache.o: region-cache.c buffer.h region-cache.h | 1112 | region-cache.o: region-cache.c buffer.h region-cache.h |
| 1113 | scroll.o: scroll.c systty.h termchar.h dispextern.h frame.h msdos.h keyboard.h \ | 1113 | scroll.o: scroll.c systty.h termchar.h dispextern.h frame.h msdos.h keyboard.h \ |
| 1114 | $(config_h) | 1114 | termhooks.h $(config_h) |
| 1115 | search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \ | 1115 | search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \ |
| 1116 | blockinput.h atimer.h systime.h category.h charset.h composite.h $(config_h) | 1116 | blockinput.h atimer.h systime.h category.h charset.h composite.h $(config_h) |
| 1117 | strftime.o: strftime.c $(config_h) | 1117 | strftime.o: strftime.c $(config_h) |
diff --git a/src/dispnew.c b/src/dispnew.c index 4401e2d2d56..9ccc87a6020 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -297,8 +297,10 @@ int glyph_pool_count; | |||
| 297 | 297 | ||
| 298 | static struct frame *frame_matrix_frame; | 298 | static struct frame *frame_matrix_frame; |
| 299 | 299 | ||
| 300 | /* Current interface for window-based redisplay. Set from init_xterm. | 300 | /* Current interface for window-based redisplay. Set from |
| 301 | A null value means we are not using window-based redisplay. */ | 301 | update_begin. A null value means we are not using window-based |
| 302 | redisplay. */ | ||
| 303 | /* XXX this variable causes frequent coredumps */ | ||
| 302 | 304 | ||
| 303 | struct redisplay_interface *rif; | 305 | struct redisplay_interface *rif; |
| 304 | 306 | ||
| @@ -1390,7 +1392,7 @@ line_hash_code (row) | |||
| 1390 | { | 1392 | { |
| 1391 | int c = glyph->u.ch; | 1393 | int c = glyph->u.ch; |
| 1392 | int face_id = glyph->face_id; | 1394 | int face_id = glyph->face_id; |
| 1393 | if (TTY_MUST_WRITE_SPACES (CURTTY ())) | 1395 | if (FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */ |
| 1394 | c -= SPACEGLYPH; | 1396 | c -= SPACEGLYPH; |
| 1395 | hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c; | 1397 | hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c; |
| 1396 | hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id; | 1398 | hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id; |
| @@ -1422,7 +1424,7 @@ line_draw_cost (matrix, vpos) | |||
| 1422 | int glyph_table_len = GLYPH_TABLE_LENGTH; | 1424 | int glyph_table_len = GLYPH_TABLE_LENGTH; |
| 1423 | 1425 | ||
| 1424 | /* Ignore trailing and leading spaces if we can. */ | 1426 | /* Ignore trailing and leading spaces if we can. */ |
| 1425 | if (!TTY_MUST_WRITE_SPACES (CURTTY ())) | 1427 | if (!FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */ |
| 1426 | { | 1428 | { |
| 1427 | /* Skip from the end over trailing spaces. */ | 1429 | /* Skip from the end over trailing spaces. */ |
| 1428 | while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1))) | 1430 | while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1))) |
| @@ -3317,7 +3319,8 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, | |||
| 3317 | clear_frame (); | 3319 | clear_frame (); |
| 3318 | clear_current_matrices (f); | 3320 | clear_current_matrices (f); |
| 3319 | update_end (f); | 3321 | update_end (f); |
| 3320 | fflush (TTY_OUTPUT (FRAME_TTY (f))); | 3322 | if (FRAME_TERMCAP_P (f)) |
| 3323 | fflush (TTY_OUTPUT (FRAME_TTY (f))); | ||
| 3321 | windows_or_buffers_changed++; | 3324 | windows_or_buffers_changed++; |
| 3322 | /* Mark all windows as inaccurate, so that every window will have | 3325 | /* Mark all windows as inaccurate, so that every window will have |
| 3323 | its redisplay done. */ | 3326 | its redisplay done. */ |
| @@ -3457,7 +3460,7 @@ direct_output_for_insert (g) | |||
| 3457 | 3460 | ||
| 3458 | /* If we can't insert glyphs, we can use this method only | 3461 | /* If we can't insert glyphs, we can use this method only |
| 3459 | at the end of a line. */ | 3462 | at the end of a line. */ |
| 3460 | if (!TTY_CHAR_INS_DEL_OK (FRAME_TTY (f))) | 3463 | if (!FRAME_CHAR_INS_DEL_OK (f)) |
| 3461 | if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n') | 3464 | if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n') |
| 3462 | return 0; | 3465 | return 0; |
| 3463 | 3466 | ||
| @@ -3654,7 +3657,8 @@ direct_output_for_insert (g) | |||
| 3654 | rif->update_window_end_hook (w, 1, 0); | 3657 | rif->update_window_end_hook (w, 1, 0); |
| 3655 | update_end (f); | 3658 | update_end (f); |
| 3656 | updated_row = NULL; | 3659 | updated_row = NULL; |
| 3657 | fflush (TTY_OUTPUT (CURTTY ())); | 3660 | if (FRAME_TERMCAP_P (f)) |
| 3661 | fflush (TTY_OUTPUT (FRAME_TTY (f))); | ||
| 3658 | 3662 | ||
| 3659 | TRACE ((stderr, "direct output for insert\n")); | 3663 | TRACE ((stderr, "direct output for insert\n")); |
| 3660 | mark_window_display_accurate (it.window, 1); | 3664 | mark_window_display_accurate (it.window, 1); |
| @@ -3745,7 +3749,8 @@ direct_output_forward_char (n) | |||
| 3745 | cursor_to (y, x); | 3749 | cursor_to (y, x); |
| 3746 | } | 3750 | } |
| 3747 | 3751 | ||
| 3748 | fflush (TTY_OUTPUT (CURTTY ())); | 3752 | if (FRAME_TERMCAP_P (f)) |
| 3753 | fflush (TTY_OUTPUT (FRAME_TTY (f))); | ||
| 3749 | redisplay_performed_directly_p = 1; | 3754 | redisplay_performed_directly_p = 1; |
| 3750 | return 1; | 3755 | return 1; |
| 3751 | } | 3756 | } |
| @@ -5070,7 +5075,7 @@ update_frame_1 (f, force_p, inhibit_id_p) | |||
| 5070 | } | 5075 | } |
| 5071 | 5076 | ||
| 5072 | /* If we cannot insert/delete lines, it's no use trying it. */ | 5077 | /* If we cannot insert/delete lines, it's no use trying it. */ |
| 5073 | if (!TTY_LINE_INS_DEL_OK (FRAME_TTY (f))) | 5078 | if (!FRAME_LINE_INS_DEL_OK (f)) |
| 5074 | inhibit_id_p = 1; | 5079 | inhibit_id_p = 1; |
| 5075 | 5080 | ||
| 5076 | /* See if any of the desired lines are enabled; don't compute for | 5081 | /* See if any of the desired lines are enabled; don't compute for |
| @@ -5288,7 +5293,7 @@ scrolling (frame) | |||
| 5288 | } | 5293 | } |
| 5289 | 5294 | ||
| 5290 | /* If changed lines are few, don't allow preemption, don't scroll. */ | 5295 | /* If changed lines are few, don't allow preemption, don't scroll. */ |
| 5291 | if ((!TTY_SCROLL_REGION_OK (FRAME_TTY (frame)) | 5296 | if ((!FRAME_SCROLL_REGION_OK (frame) |
| 5292 | && changed_lines < baud_rate / 2400) | 5297 | && changed_lines < baud_rate / 2400) |
| 5293 | || unchanged_at_bottom == FRAME_LINES (frame)) | 5298 | || unchanged_at_bottom == FRAME_LINES (frame)) |
| 5294 | return 1; | 5299 | return 1; |
| @@ -5296,14 +5301,14 @@ scrolling (frame) | |||
| 5296 | window_size = (FRAME_LINES (frame) - unchanged_at_top | 5301 | window_size = (FRAME_LINES (frame) - unchanged_at_top |
| 5297 | - unchanged_at_bottom); | 5302 | - unchanged_at_bottom); |
| 5298 | 5303 | ||
| 5299 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (frame))) | 5304 | if (FRAME_SCROLL_REGION_OK (frame)) |
| 5300 | free_at_end_vpos -= unchanged_at_bottom; | 5305 | free_at_end_vpos -= unchanged_at_bottom; |
| 5301 | else if (TTY_MEMORY_BELOW_FRAME (FRAME_TTY (frame))) | 5306 | else if (FRAME_MEMORY_BELOW_FRAME (frame)) |
| 5302 | free_at_end_vpos = -1; | 5307 | free_at_end_vpos = -1; |
| 5303 | 5308 | ||
| 5304 | /* If large window, fast terminal and few lines in common between | 5309 | /* If large window, fast terminal and few lines in common between |
| 5305 | current frame and desired frame, don't bother with i/d calc. */ | 5310 | current frame and desired frame, don't bother with i/d calc. */ |
| 5306 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (frame)) | 5311 | if (!FRAME_SCROLL_REGION_OK (frame) |
| 5307 | && window_size >= 18 && baud_rate > 2400 | 5312 | && window_size >= 18 && baud_rate > 2400 |
| 5308 | && (window_size >= | 5313 | && (window_size >= |
| 5309 | 10 * scrolling_max_lines_saved (unchanged_at_top, | 5314 | 10 * scrolling_max_lines_saved (unchanged_at_top, |
| @@ -5384,7 +5389,7 @@ update_frame_line (f, vpos) | |||
| 5384 | struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos); | 5389 | struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos); |
| 5385 | struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos); | 5390 | struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos); |
| 5386 | int must_write_whole_line_p; | 5391 | int must_write_whole_line_p; |
| 5387 | int write_spaces_p = TTY_MUST_WRITE_SPACES (FRAME_TTY (f)); | 5392 | int write_spaces_p = FRAME_MUST_WRITE_SPACES (f); |
| 5388 | int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background | 5393 | int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background |
| 5389 | != FACE_TTY_DEFAULT_BG_COLOR); | 5394 | != FACE_TTY_DEFAULT_BG_COLOR); |
| 5390 | 5395 | ||
| @@ -5463,7 +5468,7 @@ update_frame_line (f, vpos) | |||
| 5463 | nlen--; | 5468 | nlen--; |
| 5464 | 5469 | ||
| 5465 | /* If there's no i/d char, quickly do the best we can without it. */ | 5470 | /* If there's no i/d char, quickly do the best we can without it. */ |
| 5466 | if (!TTY_CHAR_INS_DEL_OK (FRAME_TTY (f))) | 5471 | if (!FRAME_CHAR_INS_DEL_OK (f)) |
| 5467 | { | 5472 | { |
| 5468 | int i, j; | 5473 | int i, j; |
| 5469 | 5474 | ||
| @@ -5566,7 +5571,7 @@ update_frame_line (f, vpos) | |||
| 5566 | 5571 | ||
| 5567 | tem = (nlen - nsp) - (olen - osp); | 5572 | tem = (nlen - nsp) - (olen - osp); |
| 5568 | if (endmatch && tem | 5573 | if (endmatch && tem |
| 5569 | && (!TTY_CHAR_INS_DEL_OK (FRAME_TTY (f)) | 5574 | && (!FRAME_CHAR_INS_DEL_OK (f) |
| 5570 | || endmatch <= char_ins_del_cost (f)[tem])) | 5575 | || endmatch <= char_ins_del_cost (f)[tem])) |
| 5571 | endmatch = 0; | 5576 | endmatch = 0; |
| 5572 | 5577 | ||
| @@ -5576,7 +5581,7 @@ update_frame_line (f, vpos) | |||
| 5576 | Is it worth it? */ | 5581 | Is it worth it? */ |
| 5577 | 5582 | ||
| 5578 | if (nsp != osp | 5583 | if (nsp != osp |
| 5579 | && (!TTY_CHAR_INS_DEL_OK (FRAME_TTY (f)) | 5584 | && (!FRAME_CHAR_INS_DEL_OK (f) |
| 5580 | || begmatch + endmatch <= char_ins_del_cost (f)[nsp - osp])) | 5585 | || begmatch + endmatch <= char_ins_del_cost (f)[nsp - osp])) |
| 5581 | { | 5586 | { |
| 5582 | begmatch = 0; | 5587 | begmatch = 0; |
| @@ -6167,6 +6172,9 @@ Control characters in STRING will have terminal-dependent effects. */) | |||
| 6167 | { | 6172 | { |
| 6168 | /* ??? Perhaps we should do something special for multibyte strings here. */ | 6173 | /* ??? Perhaps we should do something special for multibyte strings here. */ |
| 6169 | CHECK_STRING (string); | 6174 | CHECK_STRING (string); |
| 6175 | if (! FRAME_TERMCAP_P (SELECTED_FRAME ())) | ||
| 6176 | error ("Current frame is not on a tty device"); | ||
| 6177 | |||
| 6170 | if (TTY_TERMSCRIPT (CURTTY ())) | 6178 | if (TTY_TERMSCRIPT (CURTTY ())) |
| 6171 | { | 6179 | { |
| 6172 | fwrite (SDATA (string), 1, SBYTES (string), | 6180 | fwrite (SDATA (string), 1, SBYTES (string), |
| @@ -6193,7 +6201,8 @@ terminate any keyboard macro currently executing. */) | |||
| 6193 | putchar (07); | 6201 | putchar (07); |
| 6194 | else | 6202 | else |
| 6195 | ring_bell (); | 6203 | ring_bell (); |
| 6196 | fflush (TTY_OUTPUT (CURTTY ())); | 6204 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) |
| 6205 | fflush (TTY_OUTPUT (CURTTY ())); | ||
| 6197 | } | 6206 | } |
| 6198 | else | 6207 | else |
| 6199 | bitch_at_user (); | 6208 | bitch_at_user (); |
| @@ -6210,7 +6219,8 @@ bitch_at_user () | |||
| 6210 | error ("Keyboard macro terminated by a command ringing the bell"); | 6219 | error ("Keyboard macro terminated by a command ringing the bell"); |
| 6211 | else | 6220 | else |
| 6212 | ring_bell (); | 6221 | ring_bell (); |
| 6213 | fflush (TTY_OUTPUT (CURTTY ())); | 6222 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) |
| 6223 | fflush (TTY_OUTPUT (CURTTY ())); | ||
| 6214 | } | 6224 | } |
| 6215 | 6225 | ||
| 6216 | 6226 | ||
| @@ -6628,7 +6638,7 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\ | |||
| 6628 | struct tty_display_info *tty; | 6638 | struct tty_display_info *tty; |
| 6629 | 6639 | ||
| 6630 | tty = term_init (selected_frame, 0, terminal_type); | 6640 | tty = term_init (selected_frame, 0, terminal_type); |
| 6631 | change_frame_size (XFRAME (selected_frame), FrameRows (tty), FrameCols (tty), 0, 0, 0); | 6641 | change_frame_size (XFRAME (selected_frame), FrameRows (tty), FrameCols (tty), 0, 0, 1); |
| 6632 | } | 6642 | } |
| 6633 | 6643 | ||
| 6634 | { | 6644 | { |
diff --git a/src/frame.c b/src/frame.c index af2cd20c514..0b407181a6b 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -114,6 +114,7 @@ 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 | Lisp_Object Vterminal_frame; | ||
| 117 | Lisp_Object Vdefault_frame_alist; | 118 | Lisp_Object Vdefault_frame_alist; |
| 118 | Lisp_Object Vdefault_frame_scroll_bars; | 119 | Lisp_Object Vdefault_frame_scroll_bars; |
| 119 | Lisp_Object Vmouse_position_function; | 120 | Lisp_Object Vmouse_position_function; |
| @@ -122,8 +123,8 @@ Lisp_Object Vdelete_frame_functions; | |||
| 122 | 123 | ||
| 123 | static void | 124 | static void |
| 124 | set_menu_bar_lines_1 (window, n) | 125 | set_menu_bar_lines_1 (window, n) |
| 125 | Lisp_Object window; | 126 | Lisp_Object window; |
| 126 | int n; | 127 | int n; |
| 127 | { | 128 | { |
| 128 | struct window *w = XWINDOW (window); | 129 | struct window *w = XWINDOW (window); |
| 129 | 130 | ||
| @@ -565,6 +566,7 @@ make_terminal_frame (tty_name, tty_type) | |||
| 565 | f->output_data.tty->display_info = term_dummy_init (); | 566 | f->output_data.tty->display_info = term_dummy_init (); |
| 566 | } | 567 | } |
| 567 | FRAME_TTY (f)->reference_count++; | 568 | FRAME_TTY (f)->reference_count++; |
| 569 | f->display_method = FRAME_TTY (f)->display_method; | ||
| 568 | } | 570 | } |
| 569 | 571 | ||
| 570 | #ifdef CANNOT_DUMP | 572 | #ifdef CANNOT_DUMP |
| @@ -614,9 +616,11 @@ Note that changing the size of one terminal frame automatically affects all. */ | |||
| 614 | if (sf->output_method != output_mac) | 616 | if (sf->output_method != output_mac) |
| 615 | error ("Not running on a Macintosh screen; cannot make a new Macintosh frame"); | 617 | error ("Not running on a Macintosh screen; cannot make a new Macintosh frame"); |
| 616 | #else | 618 | #else |
| 619 | #if 0 /* This should work now! */ | ||
| 617 | if (sf->output_method != output_termcap) | 620 | if (sf->output_method != output_termcap) |
| 618 | error ("Not using an ASCII terminal now; cannot make a new ASCII frame"); | 621 | error ("Not using an ASCII terminal now; cannot make a new ASCII frame"); |
| 619 | #endif | 622 | #endif |
| 623 | #endif | ||
| 620 | #endif /* not MSDOS */ | 624 | #endif /* not MSDOS */ |
| 621 | 625 | ||
| 622 | { | 626 | { |
| @@ -1909,7 +1913,7 @@ The redirection lasts until `redirect-frame-focus' is called to change it. */) | |||
| 1909 | 1913 | ||
| 1910 | XFRAME (frame)->focus_frame = focus_frame; | 1914 | XFRAME (frame)->focus_frame = focus_frame; |
| 1911 | 1915 | ||
| 1912 | if (frame_rehighlight_hook) | 1916 | if (!FRAME_TERMCAP_P (XFRAME (frame)) && frame_rehighlight_hook) |
| 1913 | (*frame_rehighlight_hook) (XFRAME (frame)); | 1917 | (*frame_rehighlight_hook) (XFRAME (frame)); |
| 1914 | 1918 | ||
| 1915 | return Qnil; | 1919 | return Qnil; |
| @@ -4137,6 +4141,9 @@ Setting this variable does not affect existing frames, only new ones. */); | |||
| 4137 | = intern ("inhibit-default-face-x-resources"); | 4141 | = intern ("inhibit-default-face-x-resources"); |
| 4138 | staticpro (&Qinhibit_default_face_x_resources); | 4142 | staticpro (&Qinhibit_default_face_x_resources); |
| 4139 | 4143 | ||
| 4144 | DEFVAR_LISP ("terminal-frame", &Vterminal_frame, | ||
| 4145 | doc: /* The initial frame-object, which represents Emacs's stdout. */); | ||
| 4146 | |||
| 4140 | DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified, | 4147 | DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified, |
| 4141 | doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */); | 4148 | doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */); |
| 4142 | Vemacs_iconified = Qnil; | 4149 | Vemacs_iconified = Qnil; |
diff --git a/src/frame.h b/src/frame.h index 5c4654632e1..4a67744edaa 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -257,7 +257,7 @@ struct frame | |||
| 257 | int line_height; | 257 | int line_height; |
| 258 | 258 | ||
| 259 | /* The display hooks to use with this frame. */ | 259 | /* The display hooks to use with this frame. */ |
| 260 | struct display *display; | 260 | struct display_method *display_method; |
| 261 | 261 | ||
| 262 | /* The output method says how the contents of this frame | 262 | /* The output method says how the contents of this frame |
| 263 | are displayed. It could be using termcap, or using an X window. */ | 263 | are displayed. It could be using termcap, or using an X window. */ |
| @@ -783,6 +783,8 @@ extern int other_visible_frames P_ ((struct frame *)); | |||
| 783 | extern Lisp_Object Vframe_list; | 783 | extern Lisp_Object Vframe_list; |
| 784 | extern Lisp_Object Vdefault_frame_alist; | 784 | extern Lisp_Object Vdefault_frame_alist; |
| 785 | 785 | ||
| 786 | extern Lisp_Object Vterminal_frame; | ||
| 787 | |||
| 786 | extern Lisp_Object Vmouse_highlight; | 788 | extern Lisp_Object Vmouse_highlight; |
| 787 | 789 | ||
| 788 | /* The currently selected frame. */ | 790 | /* The currently selected frame. */ |
diff --git a/src/keyboard.c b/src/keyboard.c index 1751df6a735..532257e797f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -617,9 +617,6 @@ int interrupt_input; | |||
| 617 | /* Nonzero while interrupts are temporarily deferred during redisplay. */ | 617 | /* Nonzero while interrupts are temporarily deferred during redisplay. */ |
| 618 | int interrupts_deferred; | 618 | int interrupts_deferred; |
| 619 | 619 | ||
| 620 | /* Nonzero means use ^S/^Q for flow control. */ | ||
| 621 | int flow_control; | ||
| 622 | |||
| 623 | /* Allow m- file to inhibit use of FIONREAD. */ | 620 | /* Allow m- file to inhibit use of FIONREAD. */ |
| 624 | #ifdef BROKEN_FIONREAD | 621 | #ifdef BROKEN_FIONREAD |
| 625 | #undef FIONREAD | 622 | #undef FIONREAD |
| @@ -6605,7 +6602,8 @@ read_avail_input (expected) | |||
| 6605 | if (read_socket_hook) | 6602 | if (read_socket_hook) |
| 6606 | /* No need for FIONREAD or fcntl; just say don't wait. */ | 6603 | /* No need for FIONREAD or fcntl; just say don't wait. */ |
| 6607 | nread = (*read_socket_hook) (buf, KBD_BUFFER_SIZE, expected); | 6604 | nread = (*read_socket_hook) (buf, KBD_BUFFER_SIZE, expected); |
| 6608 | else | 6605 | |
| 6606 | if (!nread && tty_list) | ||
| 6609 | { | 6607 | { |
| 6610 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than | 6608 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than |
| 6611 | the kbd_buffer can really hold. That may prevent loss | 6609 | the kbd_buffer can really hold. That may prevent loss |
| @@ -10433,7 +10431,8 @@ See also `current-input-mode'. */) | |||
| 10433 | 10431 | ||
| 10434 | #ifndef DOS_NT | 10432 | #ifndef DOS_NT |
| 10435 | /* this causes startup screen to be restored and messes with the mouse */ | 10433 | /* this causes startup screen to be restored and messes with the mouse */ |
| 10436 | reset_sys_modes (CURTTY ()); | 10434 | if (FRAME_TERMCAP_P (SELECTED_FRAME ())) |
| 10435 | reset_sys_modes (CURTTY ()); | ||
| 10437 | #endif | 10436 | #endif |
| 10438 | 10437 | ||
| 10439 | #ifdef SIGIO | 10438 | #ifdef SIGIO |
| @@ -10459,19 +10458,25 @@ See also `current-input-mode'. */) | |||
| 10459 | interrupt_input = 1; | 10458 | interrupt_input = 1; |
| 10460 | #endif | 10459 | #endif |
| 10461 | 10460 | ||
| 10462 | flow_control = !NILP (flow); | 10461 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) |
| 10463 | if (NILP (meta)) | 10462 | { |
| 10464 | CURTTY ()->meta_key = 0; | 10463 | struct tty_display_info *tty = CURTTY (); |
| 10465 | else if (EQ (meta, Qt)) | 10464 | tty->flow_control = !NILP (flow); |
| 10466 | CURTTY ()->meta_key = 1; | 10465 | if (NILP (meta)) |
| 10467 | else | 10466 | tty->meta_key = 0; |
| 10468 | CURTTY ()->meta_key = 2; | 10467 | else if (EQ (meta, Qt)) |
| 10468 | tty->meta_key = 1; | ||
| 10469 | else | ||
| 10470 | tty->meta_key = 2; | ||
| 10471 | } | ||
| 10472 | |||
| 10469 | if (!NILP (quit)) | 10473 | if (!NILP (quit)) |
| 10470 | /* Don't let this value be out of range. */ | 10474 | /* Don't let this value be out of range. */ |
| 10471 | quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177); | 10475 | quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177); |
| 10472 | 10476 | ||
| 10473 | #ifndef DOS_NT | 10477 | #ifndef DOS_NT |
| 10474 | init_sys_modes (CURTTY ()); | 10478 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) |
| 10479 | init_sys_modes (CURTTY ()); | ||
| 10475 | #endif | 10480 | #endif |
| 10476 | 10481 | ||
| 10477 | #ifdef POLL_FOR_INPUT | 10482 | #ifdef POLL_FOR_INPUT |
| @@ -10498,12 +10503,21 @@ The elements of this list correspond to the arguments of | |||
| 10498 | () | 10503 | () |
| 10499 | { | 10504 | { |
| 10500 | Lisp_Object val[4]; | 10505 | Lisp_Object val[4]; |
| 10501 | 10506 | struct frame *sf = XFRAME (selected_frame); | |
| 10507 | |||
| 10502 | val[0] = interrupt_input ? Qt : Qnil; | 10508 | val[0] = interrupt_input ? Qt : Qnil; |
| 10503 | val[1] = flow_control ? Qt : Qnil; | 10509 | if (FRAME_TERMCAP_P (sf)) |
| 10504 | val[2] = FRAME_TTY (SELECTED_FRAME ())->meta_key == 2 | 10510 | { |
| 10505 | ? make_number (0) | 10511 | val[1] = FRAME_TTY (sf)->flow_control ? Qt : Qnil; |
| 10506 | : FRAME_TTY (SELECTED_FRAME ())->meta_key == 1 ? Qt : Qnil; | 10512 | val[2] = FRAME_TTY (sf)->meta_key == 2 |
| 10513 | ? make_number (0) | ||
| 10514 | : CURTTY ()->meta_key == 1 ? Qt : Qnil; | ||
| 10515 | } | ||
| 10516 | else | ||
| 10517 | { | ||
| 10518 | val[1] = Qnil; | ||
| 10519 | val[2] = Qt; | ||
| 10520 | } | ||
| 10507 | XSETFASTINT (val[3], quit_char); | 10521 | XSETFASTINT (val[3], quit_char); |
| 10508 | 10522 | ||
| 10509 | return Flist (sizeof (val) / sizeof (val[0]), val); | 10523 | return Flist (sizeof (val) / sizeof (val[0]), val); |
diff --git a/src/scroll.c b/src/scroll.c index c4371377e03..915b60ab4c5 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 29 | #include "keyboard.h" | 29 | #include "keyboard.h" |
| 30 | #include "frame.h" | 30 | #include "frame.h" |
| 31 | #include "window.h" | 31 | #include "window.h" |
| 32 | #include "termhooks.h" | ||
| 32 | 33 | ||
| 33 | /* All costs measured in characters. | 34 | /* All costs measured in characters. |
| 34 | So no cost can exceed the area of a frame, measured in characters. | 35 | So no cost can exceed the area of a frame, measured in characters. |
| @@ -102,7 +103,7 @@ calculate_scrolling (frame, matrix, window_size, lines_below, | |||
| 102 | register int cost, cost1; | 103 | register int cost, cost1; |
| 103 | 104 | ||
| 104 | int lines_moved = window_size | 105 | int lines_moved = window_size |
| 105 | + (TTY_SCROLL_REGION_OK (FRAME_TTY (frame)) ? 0 : lines_below); | 106 | + (FRAME_SCROLL_REGION_OK (frame) ? 0 : lines_below); |
| 106 | /* first_insert_cost[I] is the cost of doing the first insert-line | 107 | /* first_insert_cost[I] is the cost of doing the first insert-line |
| 107 | at the i'th line of the lines we are considering, | 108 | at the i'th line of the lines we are considering, |
| 108 | where I is origin 1 (as it is below). */ | 109 | where I is origin 1 (as it is below). */ |
| @@ -469,7 +470,7 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below, | |||
| 469 | cost of scrolling by a distance of one. The extra cost is | 470 | cost of scrolling by a distance of one. The extra cost is |
| 470 | added once for consistency with the cost vectors */ | 471 | added once for consistency with the cost vectors */ |
| 471 | scroll_overhead | 472 | scroll_overhead |
| 472 | = TTY_SCROLL_REGION_COST (FRAME_TTY (frame)) + extra_cost; | 473 | = FRAME_SCROLL_REGION_COST (frame) + extra_cost; |
| 473 | 474 | ||
| 474 | /* initialize the top left corner of the matrix */ | 475 | /* initialize the top left corner of the matrix */ |
| 475 | matrix->writecost = 0; | 476 | matrix->writecost = 0; |
| @@ -821,7 +822,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, | |||
| 821 | matrix = ((struct matrix_elt *) | 822 | matrix = ((struct matrix_elt *) |
| 822 | alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix)); | 823 | alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix)); |
| 823 | 824 | ||
| 824 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (frame))) | 825 | if (FRAME_SCROLL_REGION_OK (frame)) |
| 825 | { | 826 | { |
| 826 | calculate_direct_scrolling (frame, matrix, window_size, | 827 | calculate_direct_scrolling (frame, matrix, window_size, |
| 827 | unchanged_at_bottom, | 828 | unchanged_at_bottom, |
| @@ -917,7 +918,7 @@ scroll_cost (frame, from, to, amount) | |||
| 917 | if (amount == 0) | 918 | if (amount == 0) |
| 918 | return 0; | 919 | return 0; |
| 919 | 920 | ||
| 920 | if (! TTY_SCROLL_REGION_OK (FRAME_TTY (frame))) | 921 | if (! FRAME_SCROLL_REGION_OK (frame)) |
| 921 | limit = height; | 922 | limit = height; |
| 922 | else if (amount > 0) | 923 | else if (amount > 0) |
| 923 | limit += amount; | 924 | limit += amount; |
diff --git a/src/sysdep.c b/src/sysdep.c index 7710c2ad8ce..502671ba0f6 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1368,7 +1368,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1368 | #ifdef HAVE_WINDOW_SYSTEM | 1368 | #ifdef HAVE_WINDOW_SYSTEM |
| 1369 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1369 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
| 1370 | needs the initialization code below. */ | 1370 | needs the initialization code below. */ |
| 1371 | if (!read_socket_hook && EQ (Vwindow_system, Qnil)) | 1371 | if (tty_out->input != stdin || (!read_socket_hook && EQ (Vwindow_system, Qnil))) |
| 1372 | #endif | 1372 | #endif |
| 1373 | { | 1373 | { |
| 1374 | if (! tty_out->old_tty) | 1374 | if (! tty_out->old_tty) |
| @@ -1400,7 +1400,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1400 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ | 1400 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ |
| 1401 | #endif | 1401 | #endif |
| 1402 | tty.main.c_lflag |= ISIG; /* Enable signals */ | 1402 | tty.main.c_lflag |= ISIG; /* Enable signals */ |
| 1403 | if (flow_control) | 1403 | if (tty_out->flow_control) |
| 1404 | { | 1404 | { |
| 1405 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ | 1405 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ |
| 1406 | #ifdef IXANY | 1406 | #ifdef IXANY |
| @@ -1454,7 +1454,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1454 | tty.main.c_cc[VDISCARD] = CDISABLE; | 1454 | tty.main.c_cc[VDISCARD] = CDISABLE; |
| 1455 | #endif /* VDISCARD */ | 1455 | #endif /* VDISCARD */ |
| 1456 | 1456 | ||
| 1457 | if (flow_control) | 1457 | if (tty_out->flow_control) |
| 1458 | { | 1458 | { |
| 1459 | #ifdef VSTART | 1459 | #ifdef VSTART |
| 1460 | tty.main.c_cc[VSTART] = '\021'; | 1460 | tty.main.c_cc[VSTART] = '\021'; |
| @@ -1490,7 +1490,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1490 | tty.main.c_cc[VSUSP] = 255; | 1490 | tty.main.c_cc[VSUSP] = 255; |
| 1491 | tty.main.c_cc[VDSUSP] = 255; | 1491 | tty.main.c_cc[VDSUSP] = 255; |
| 1492 | #endif /* IBMR2AIX */ | 1492 | #endif /* IBMR2AIX */ |
| 1493 | if (flow_control) | 1493 | if (tty_out->flow_control) |
| 1494 | { | 1494 | { |
| 1495 | #ifdef VSTART | 1495 | #ifdef VSTART |
| 1496 | tty.main.c_cc[VSTART] = '\021'; | 1496 | tty.main.c_cc[VSTART] = '\021'; |
| @@ -1511,7 +1511,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1511 | tty.main.tt_char |= TT$M_NOECHO; | 1511 | tty.main.tt_char |= TT$M_NOECHO; |
| 1512 | if (meta_key) | 1512 | if (meta_key) |
| 1513 | tty.main.tt_char |= TT$M_EIGHTBIT; | 1513 | tty.main.tt_char |= TT$M_EIGHTBIT; |
| 1514 | if (flow_control) | 1514 | if (tty_out->flow_control) |
| 1515 | tty.main.tt_char |= TT$M_TTSYNC; | 1515 | tty.main.tt_char |= TT$M_TTSYNC; |
| 1516 | else | 1516 | else |
| 1517 | tty.main.tt_char &= ~TT$M_TTSYNC; | 1517 | tty.main.tt_char &= ~TT$M_TTSYNC; |
| @@ -1538,7 +1538,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1538 | set this */ | 1538 | set this */ |
| 1539 | tty.tchars = new_tchars; | 1539 | tty.tchars = new_tchars; |
| 1540 | tty.tchars.t_intrc = quit_char; | 1540 | tty.tchars.t_intrc = quit_char; |
| 1541 | if (flow_control) | 1541 | if (tty_out->flow_control) |
| 1542 | { | 1542 | { |
| 1543 | tty.tchars.t_startc = '\021'; | 1543 | tty.tchars.t_startc = '\021'; |
| 1544 | tty.tchars.t_stopc = '\023'; | 1544 | tty.tchars.t_stopc = '\023'; |
| @@ -1573,17 +1573,17 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1573 | we have an unlocked terminal at the start. */ | 1573 | we have an unlocked terminal at the start. */ |
| 1574 | 1574 | ||
| 1575 | #ifdef TCXONC | 1575 | #ifdef TCXONC |
| 1576 | if (!flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); | 1576 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); |
| 1577 | #endif | 1577 | #endif |
| 1578 | #ifndef APOLLO | 1578 | #ifndef APOLLO |
| 1579 | #ifdef TIOCSTART | 1579 | #ifdef TIOCSTART |
| 1580 | if (!flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); | 1580 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); |
| 1581 | #endif | 1581 | #endif |
| 1582 | #endif | 1582 | #endif |
| 1583 | 1583 | ||
| 1584 | #if defined (HAVE_TERMIOS) || defined (HPUX9) | 1584 | #if defined (HAVE_TERMIOS) || defined (HPUX9) |
| 1585 | #ifdef TCOON | 1585 | #ifdef TCOON |
| 1586 | if (!flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); | 1586 | if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); |
| 1587 | #endif | 1587 | #endif |
| 1588 | #endif | 1588 | #endif |
| 1589 | 1589 | ||
| @@ -1658,6 +1658,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1658 | Lisp_Object tail, frame; | 1658 | Lisp_Object tail, frame; |
| 1659 | FOR_EACH_FRAME (tail, frame) | 1659 | FOR_EACH_FRAME (tail, frame) |
| 1660 | { | 1660 | { |
| 1661 | /* XXX This needs to be revised. */ | ||
| 1661 | if (FRAME_TERMCAP_P (XFRAME (frame)) | 1662 | if (FRAME_TERMCAP_P (XFRAME (frame)) |
| 1662 | && FRAME_TTY (XFRAME (frame)) == tty_out) | 1663 | && FRAME_TTY (XFRAME (frame)) == tty_out) |
| 1663 | init_frame_faces (XFRAME (frame)); | 1664 | init_frame_faces (XFRAME (frame)); |
| @@ -1817,13 +1818,14 @@ reset_sys_modes (tty_out) | |||
| 1817 | #ifdef HAVE_WINDOW_SYSTEM | 1818 | #ifdef HAVE_WINDOW_SYSTEM |
| 1818 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1819 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
| 1819 | needs the clean-up code below. */ | 1820 | needs the clean-up code below. */ |
| 1820 | if (!EQ (Vwindow_system, Qnil) | 1821 | if (tty_out->input != stdin |
| 1822 | || (!EQ (Vwindow_system, Qnil) | ||
| 1821 | #ifndef WINDOWSNT | 1823 | #ifndef WINDOWSNT |
| 1822 | /* When running in tty mode on NT/Win95, we have a read_socket | 1824 | /* When running in tty mode on NT/Win95, we have a read_socket |
| 1823 | hook, but still need the rest of the clean-up code below. */ | 1825 | hook, but still need the rest of the clean-up code below. */ |
| 1824 | || read_socket_hook | 1826 | || read_socket_hook |
| 1825 | #endif | 1827 | #endif |
| 1826 | ) | 1828 | )) |
| 1827 | return; | 1829 | return; |
| 1828 | #endif | 1830 | #endif |
| 1829 | 1831 | ||
| @@ -5156,10 +5158,6 @@ hft_init (struct tty_display_info *tty_out) | |||
| 5156 | keymap.hfkey[1].hf_char = 127; | 5158 | keymap.hfkey[1].hf_char = 127; |
| 5157 | hftctl (0, HFSKBD, &buf); | 5159 | hftctl (0, HFSKBD, &buf); |
| 5158 | } | 5160 | } |
| 5159 | /* The HFT system on AIX doesn't optimize for scrolling, so it's really ugly | ||
| 5160 | at times. */ | ||
| 5161 | TTY_LINE_INS_DEL_OK (tty_out) = 0; | ||
| 5162 | TTY_CHAR_INS_DEL_OK (tty_out) = 0; | ||
| 5163 | } | 5161 | } |
| 5164 | 5162 | ||
| 5165 | /* Reset the rubout key to backspace. */ | 5163 | /* Reset the rubout key to backspace. */ |
diff --git a/src/term.c b/src/term.c index cce411debe7..c8310b5b85b 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -267,6 +267,10 @@ int max_frame_cols; | |||
| 267 | 267 | ||
| 268 | int max_frame_lines; | 268 | int max_frame_lines; |
| 269 | 269 | ||
| 270 | /* A template for tty display methods, with common values | ||
| 271 | preinitialized. */ | ||
| 272 | static struct display_method tty_display_method_template; | ||
| 273 | |||
| 270 | /* Frame currently being redisplayed; 0 if not currently redisplaying. | 274 | /* Frame currently being redisplayed; 0 if not currently redisplaying. |
| 271 | (Direct output does not count). */ | 275 | (Direct output does not count). */ |
| 272 | 276 | ||
| @@ -370,6 +374,8 @@ update_begin (f) | |||
| 370 | struct frame *f; | 374 | struct frame *f; |
| 371 | { | 375 | { |
| 372 | updating_frame = f; | 376 | updating_frame = f; |
| 377 | /* XXX rif hack */ | ||
| 378 | rif = f->display_method->rif; | ||
| 373 | if (!FRAME_TERMCAP_P (f)) | 379 | if (!FRAME_TERMCAP_P (f)) |
| 374 | update_begin_hook (f); | 380 | update_begin_hook (f); |
| 375 | } | 381 | } |
| @@ -401,7 +407,7 @@ set_terminal_window (size) | |||
| 401 | { | 407 | { |
| 402 | struct tty_display_info *tty = FRAME_TTY (f); | 408 | struct tty_display_info *tty = FRAME_TTY (f); |
| 403 | tty->specified_window = size ? size : FRAME_LINES (f); | 409 | tty->specified_window = size ? size : FRAME_LINES (f); |
| 404 | if (TTY_SCROLL_REGION_OK (tty)) | 410 | if (FRAME_SCROLL_REGION_OK (f)) |
| 405 | set_scroll_region (0, tty->specified_window); | 411 | set_scroll_region (0, tty->specified_window); |
| 406 | } | 412 | } |
| 407 | else | 413 | else |
| @@ -537,7 +543,7 @@ cursor_to (vpos, hpos) | |||
| 537 | { | 543 | { |
| 538 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | 544 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 539 | struct tty_display_info *tty; | 545 | struct tty_display_info *tty; |
| 540 | 546 | ||
| 541 | if (! FRAME_TERMCAP_P (f) && cursor_to_hook) | 547 | if (! FRAME_TERMCAP_P (f) && cursor_to_hook) |
| 542 | { | 548 | { |
| 543 | (*cursor_to_hook) (vpos, hpos); | 549 | (*cursor_to_hook) (vpos, hpos); |
| @@ -595,7 +601,7 @@ clear_to_end () | |||
| 595 | 601 | ||
| 596 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | 602 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 597 | struct tty_display_info *tty; | 603 | struct tty_display_info *tty; |
| 598 | 604 | ||
| 599 | if (clear_to_end_hook && ! FRAME_TERMCAP_P (f)) | 605 | if (clear_to_end_hook && ! FRAME_TERMCAP_P (f)) |
| 600 | { | 606 | { |
| 601 | (*clear_to_end_hook) (); | 607 | (*clear_to_end_hook) (); |
| @@ -624,7 +630,7 @@ clear_frame () | |||
| 624 | { | 630 | { |
| 625 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | 631 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 626 | struct tty_display_info *tty; | 632 | struct tty_display_info *tty; |
| 627 | 633 | ||
| 628 | if (clear_frame_hook && ! FRAME_TERMCAP_P (f)) | 634 | if (clear_frame_hook && ! FRAME_TERMCAP_P (f)) |
| 629 | { | 635 | { |
| 630 | (*clear_frame_hook) (); | 636 | (*clear_frame_hook) (); |
| @@ -655,9 +661,8 @@ clear_end_of_line (first_unused_hpos) | |||
| 655 | { | 661 | { |
| 656 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | 662 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 657 | struct tty_display_info *tty; | 663 | struct tty_display_info *tty; |
| 658 | 664 | ||
| 659 | if (clear_end_of_line_hook | 665 | if (clear_end_of_line_hook && ! FRAME_TERMCAP_P (f)) |
| 660 | && ! FRAME_TERMCAP_P (f)) | ||
| 661 | { | 666 | { |
| 662 | (*clear_end_of_line_hook) (first_unused_hpos); | 667 | (*clear_end_of_line_hook) (first_unused_hpos); |
| 663 | return; | 668 | return; |
| @@ -822,8 +827,7 @@ write_glyphs (string, len) | |||
| 822 | unsigned char conversion_buffer[1024]; | 827 | unsigned char conversion_buffer[1024]; |
| 823 | int conversion_buffer_size = sizeof conversion_buffer; | 828 | int conversion_buffer_size = sizeof conversion_buffer; |
| 824 | 829 | ||
| 825 | if (write_glyphs_hook | 830 | if (write_glyphs_hook && ! FRAME_TERMCAP_P (f)) |
| 826 | && ! FRAME_TERMCAP_P (f)) | ||
| 827 | { | 831 | { |
| 828 | (*write_glyphs_hook) (string, len); | 832 | (*write_glyphs_hook) (string, len); |
| 829 | return; | 833 | return; |
| @@ -924,17 +928,18 @@ insert_glyphs (start, len) | |||
| 924 | struct glyph *glyph = NULL; | 928 | struct glyph *glyph = NULL; |
| 925 | struct frame *f; | 929 | struct frame *f; |
| 926 | struct tty_display_info *tty; | 930 | struct tty_display_info *tty; |
| 927 | 931 | ||
| 928 | if (len <= 0) | 932 | if (len <= 0) |
| 929 | return; | 933 | return; |
| 930 | 934 | ||
| 931 | if (insert_glyphs_hook) | 935 | f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 936 | |||
| 937 | if (insert_glyphs_hook && ! FRAME_TERMCAP_P (f)) | ||
| 932 | { | 938 | { |
| 933 | (*insert_glyphs_hook) (start, len); | 939 | (*insert_glyphs_hook) (start, len); |
| 934 | return; | 940 | return; |
| 935 | } | 941 | } |
| 936 | 942 | ||
| 937 | f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | ||
| 938 | tty = FRAME_TTY (f); | 943 | tty = FRAME_TTY (f); |
| 939 | 944 | ||
| 940 | if (tty->TS_ins_multi_chars) | 945 | if (tty->TS_ins_multi_chars) |
| @@ -1034,7 +1039,7 @@ delete_glyphs (n) | |||
| 1034 | turn_off_insert (tty); | 1039 | turn_off_insert (tty); |
| 1035 | OUTPUT_IF (tty, tty->TS_delete_mode); | 1040 | OUTPUT_IF (tty, tty->TS_delete_mode); |
| 1036 | } | 1041 | } |
| 1037 | 1042 | ||
| 1038 | if (tty->TS_del_multi_chars) | 1043 | if (tty->TS_del_multi_chars) |
| 1039 | { | 1044 | { |
| 1040 | buf = tparam (tty->TS_del_multi_chars, 0, 0, n); | 1045 | buf = tparam (tty->TS_del_multi_chars, 0, 0, n); |
| @@ -1066,10 +1071,10 @@ ins_del_lines (vpos, n) | |||
| 1066 | char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; | 1071 | char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; |
| 1067 | char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; | 1072 | char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; |
| 1068 | char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; | 1073 | char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; |
| 1069 | 1074 | ||
| 1070 | register int i = n > 0 ? n : -n; | 1075 | register int i = n > 0 ? n : -n; |
| 1071 | register char *buf; | 1076 | register char *buf; |
| 1072 | 1077 | ||
| 1073 | /* If the lines below the insertion are being pushed | 1078 | /* If the lines below the insertion are being pushed |
| 1074 | into the end of the window, this is the same as clearing; | 1079 | into the end of the window, this is the same as clearing; |
| 1075 | and we know the lines are already clear, since the matching | 1080 | and we know the lines are already clear, since the matching |
| @@ -1077,13 +1082,13 @@ ins_del_lines (vpos, n) | |||
| 1077 | /* If the lines below the deletion are blank lines coming | 1082 | /* If the lines below the deletion are blank lines coming |
| 1078 | out of the end of the window, don't bother, | 1083 | out of the end of the window, don't bother, |
| 1079 | as there will be a matching inslines later that will flush them. */ | 1084 | as there will be a matching inslines later that will flush them. */ |
| 1080 | if (TTY_SCROLL_REGION_OK (tty) | 1085 | if (FRAME_SCROLL_REGION_OK (f) |
| 1081 | && vpos + i >= tty->specified_window) | 1086 | && vpos + i >= tty->specified_window) |
| 1082 | return; | 1087 | return; |
| 1083 | if (!TTY_MEMORY_BELOW_FRAME (tty) | 1088 | if (!FRAME_MEMORY_BELOW_FRAME (f) |
| 1084 | && vpos + i >= FRAME_LINES (f)) | 1089 | && vpos + i >= FRAME_LINES (f)) |
| 1085 | return; | 1090 | return; |
| 1086 | 1091 | ||
| 1087 | if (multi) | 1092 | if (multi) |
| 1088 | { | 1093 | { |
| 1089 | raw_cursor_to (vpos, 0); | 1094 | raw_cursor_to (vpos, 0); |
| @@ -1113,9 +1118,9 @@ ins_del_lines (vpos, n) | |||
| 1113 | OUTPUTL (tty, scroll, tty->specified_window - vpos); | 1118 | OUTPUTL (tty, scroll, tty->specified_window - vpos); |
| 1114 | set_scroll_region (0, tty->specified_window); | 1119 | set_scroll_region (0, tty->specified_window); |
| 1115 | } | 1120 | } |
| 1116 | 1121 | ||
| 1117 | if (!TTY_SCROLL_REGION_OK (tty) | 1122 | if (!FRAME_SCROLL_REGION_OK (f) |
| 1118 | && TTY_MEMORY_BELOW_FRAME (tty) | 1123 | && FRAME_MEMORY_BELOW_FRAME (f) |
| 1119 | && n < 0) | 1124 | && n < 0) |
| 1120 | { | 1125 | { |
| 1121 | cursor_to (FRAME_LINES (f) + n, 0); | 1126 | cursor_to (FRAME_LINES (f) + n, 0); |
| @@ -1243,60 +1248,64 @@ void | |||
| 1243 | calculate_costs (frame) | 1248 | calculate_costs (frame) |
| 1244 | FRAME_PTR frame; | 1249 | FRAME_PTR frame; |
| 1245 | { | 1250 | { |
| 1246 | struct tty_display_info *tty = FRAME_TTY (frame); | ||
| 1247 | register char *f = (tty->TS_set_scroll_region | ||
| 1248 | ? tty->TS_set_scroll_region | ||
| 1249 | : tty->TS_set_scroll_region_1); | ||
| 1250 | |||
| 1251 | FRAME_COST_BAUD_RATE (frame) = baud_rate; | 1251 | FRAME_COST_BAUD_RATE (frame) = baud_rate; |
| 1252 | 1252 | ||
| 1253 | if (FRAME_TERMCAP_P (frame)) | 1253 | if (FRAME_TERMCAP_P (frame)) |
| 1254 | TTY_SCROLL_REGION_COST (FRAME_TTY (frame)) = string_cost (f); | 1254 | { |
| 1255 | struct tty_display_info *tty = FRAME_TTY (frame); | ||
| 1256 | register char *f = (tty->TS_set_scroll_region | ||
| 1257 | ? tty->TS_set_scroll_region | ||
| 1258 | : tty->TS_set_scroll_region_1); | ||
| 1255 | 1259 | ||
| 1256 | /* These variables are only used for terminal stuff. They are allocated | 1260 | FRAME_SCROLL_REGION_COST (frame) = string_cost (f); |
| 1257 | once for the terminal frame of X-windows emacs, but not used afterwards. | ||
| 1258 | 1261 | ||
| 1259 | char_ins_del_vector (i.e., char_ins_del_cost) isn't used because | 1262 | tty->costs_set = 1; |
| 1260 | X turns off char_ins_del_ok. */ | ||
| 1261 | 1263 | ||
| 1262 | max_frame_lines = max (max_frame_lines, FRAME_LINES (frame)); | 1264 | /* These variables are only used for terminal stuff. They are |
| 1263 | max_frame_cols = max (max_frame_cols, FRAME_COLS (frame)); | 1265 | allocated once for the terminal frame of X-windows emacs, but not |
| 1266 | used afterwards. | ||
| 1264 | 1267 | ||
| 1265 | tty->costs_set = 1; | 1268 | char_ins_del_vector (i.e., char_ins_del_cost) isn't used because |
| 1269 | X turns off char_ins_del_ok. */ | ||
| 1266 | 1270 | ||
| 1267 | if (char_ins_del_vector != 0) | 1271 | max_frame_lines = max (max_frame_lines, FRAME_LINES (frame)); |
| 1268 | char_ins_del_vector | 1272 | max_frame_cols = max (max_frame_cols, FRAME_COLS (frame)); |
| 1269 | = (int *) xrealloc (char_ins_del_vector, | ||
| 1270 | (sizeof (int) | ||
| 1271 | + 2 * max_frame_cols * sizeof (int))); | ||
| 1272 | else | ||
| 1273 | char_ins_del_vector | ||
| 1274 | = (int *) xmalloc (sizeof (int) | ||
| 1275 | + 2 * max_frame_cols * sizeof (int)); | ||
| 1276 | |||
| 1277 | bzero (char_ins_del_vector, (sizeof (int) | ||
| 1278 | + 2 * max_frame_cols * sizeof (int))); | ||
| 1279 | |||
| 1280 | if (f && (!tty->TS_ins_line && !tty->TS_del_line)) | ||
| 1281 | do_line_insertion_deletion_costs (frame, | ||
| 1282 | tty->TS_rev_scroll, tty->TS_ins_multi_lines, | ||
| 1283 | tty->TS_fwd_scroll, tty->TS_del_multi_lines, | ||
| 1284 | f, f, 1); | ||
| 1285 | else | ||
| 1286 | do_line_insertion_deletion_costs (frame, | ||
| 1287 | tty->TS_ins_line, tty->TS_ins_multi_lines, | ||
| 1288 | tty->TS_del_line, tty->TS_del_multi_lines, | ||
| 1289 | 0, 0, 1); | ||
| 1290 | 1273 | ||
| 1291 | calculate_ins_del_char_costs (frame); | 1274 | if (char_ins_del_vector != 0) |
| 1275 | char_ins_del_vector | ||
| 1276 | = (int *) xrealloc (char_ins_del_vector, | ||
| 1277 | (sizeof (int) | ||
| 1278 | + 2 * max_frame_cols * sizeof (int))); | ||
| 1279 | else | ||
| 1280 | char_ins_del_vector | ||
| 1281 | = (int *) xmalloc (sizeof (int) | ||
| 1282 | + 2 * max_frame_cols * sizeof (int)); | ||
| 1292 | 1283 | ||
| 1293 | /* Don't use TS_repeat if its padding is worse than sending the chars */ | 1284 | bzero (char_ins_del_vector, (sizeof (int) |
| 1294 | if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000) | 1285 | + 2 * max_frame_cols * sizeof (int))); |
| 1295 | tty->RPov = string_cost (tty->TS_repeat); | 1286 | |
| 1296 | else | 1287 | |
| 1297 | tty->RPov = FRAME_COLS (frame) * 2; | 1288 | if (f && (!tty->TS_ins_line && !tty->TS_del_line)) |
| 1289 | do_line_insertion_deletion_costs (frame, | ||
| 1290 | tty->TS_rev_scroll, tty->TS_ins_multi_lines, | ||
| 1291 | tty->TS_fwd_scroll, tty->TS_del_multi_lines, | ||
| 1292 | f, f, 1); | ||
| 1293 | else | ||
| 1294 | do_line_insertion_deletion_costs (frame, | ||
| 1295 | tty->TS_ins_line, tty->TS_ins_multi_lines, | ||
| 1296 | tty->TS_del_line, tty->TS_del_multi_lines, | ||
| 1297 | 0, 0, 1); | ||
| 1298 | |||
| 1299 | calculate_ins_del_char_costs (frame); | ||
| 1300 | |||
| 1301 | /* Don't use TS_repeat if its padding is worse than sending the chars */ | ||
| 1302 | if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000) | ||
| 1303 | tty->RPov = string_cost (tty->TS_repeat); | ||
| 1304 | else | ||
| 1305 | tty->RPov = FRAME_COLS (frame) * 2; | ||
| 1298 | 1306 | ||
| 1299 | cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */ | 1307 | cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */ |
| 1308 | } | ||
| 1300 | } | 1309 | } |
| 1301 | 1310 | ||
| 1302 | struct fkey_table { | 1311 | struct fkey_table { |
| @@ -2142,7 +2151,7 @@ DEFUN ("frame-tty-type", Fframe_tty_type, Sframe_tty_type, 0, 1, 0, | |||
| 2142 | Lisp_Object frame; | 2151 | Lisp_Object frame; |
| 2143 | { | 2152 | { |
| 2144 | struct frame *f; | 2153 | struct frame *f; |
| 2145 | 2154 | ||
| 2146 | if (NILP (frame)) | 2155 | if (NILP (frame)) |
| 2147 | { | 2156 | { |
| 2148 | f = XFRAME (selected_frame); | 2157 | f = XFRAME (selected_frame); |
| @@ -2177,7 +2186,9 @@ term_dummy_init (void) | |||
| 2177 | bzero (tty_list, sizeof (struct tty_display_info)); | 2186 | bzero (tty_list, sizeof (struct tty_display_info)); |
| 2178 | tty_list->name = 0; | 2187 | tty_list->name = 0; |
| 2179 | tty_list->input = stdin; | 2188 | tty_list->input = stdin; |
| 2180 | tty_list->input = stdout; | 2189 | tty_list->output = stdout; |
| 2190 | tty_list->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | ||
| 2191 | tty_list->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); | ||
| 2181 | return tty_list; | 2192 | return tty_list; |
| 2182 | } | 2193 | } |
| 2183 | 2194 | ||
| @@ -2211,7 +2222,18 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2211 | } | 2222 | } |
| 2212 | 2223 | ||
| 2213 | if (! tty->Wcm) | 2224 | if (! tty->Wcm) |
| 2214 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 2225 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 2226 | |||
| 2227 | if (! tty->display_method) | ||
| 2228 | tty->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); | ||
| 2229 | |||
| 2230 | /* Initialize the common members in the new display method with our | ||
| 2231 | predefined template. */ | ||
| 2232 | *tty->display_method = tty_display_method_template; | ||
| 2233 | f->display_method = tty->display_method; | ||
| 2234 | |||
| 2235 | /* Termcap-based displays don't support window-based redisplay. */ | ||
| 2236 | f->display_method->rif = 0; | ||
| 2215 | 2237 | ||
| 2216 | /* Make sure the frame is live; if an error happens, it must be | 2238 | /* Make sure the frame is live; if an error happens, it must be |
| 2217 | deleted. */ | 2239 | deleted. */ |
| @@ -2219,7 +2241,6 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2219 | if (! f->output_data.tty) | 2241 | if (! f->output_data.tty) |
| 2220 | abort (); | 2242 | abort (); |
| 2221 | f->output_data.tty->display_info = tty; | 2243 | f->output_data.tty->display_info = tty; |
| 2222 | |||
| 2223 | if (name) | 2244 | if (name) |
| 2224 | { | 2245 | { |
| 2225 | int fd; | 2246 | int fd; |
| @@ -2245,7 +2266,7 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2245 | tty->type = xstrdup (terminal_type); | 2266 | tty->type = xstrdup (terminal_type); |
| 2246 | 2267 | ||
| 2247 | add_keyboard_wait_descriptor (fileno (tty->input)); | 2268 | add_keyboard_wait_descriptor (fileno (tty->input)); |
| 2248 | 2269 | ||
| 2249 | #ifdef WINDOWSNT | 2270 | #ifdef WINDOWSNT |
| 2250 | initialize_w32_display (); | 2271 | initialize_w32_display (); |
| 2251 | 2272 | ||
| @@ -2253,22 +2274,21 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2253 | 2274 | ||
| 2254 | area = (char *) xmalloc (2044); | 2275 | area = (char *) xmalloc (2044); |
| 2255 | 2276 | ||
| 2256 | FrameRows = FRAME_LINES (f); | 2277 | FrameRows (tty) = FRAME_LINES (f); |
| 2257 | FrameCols = FRAME_COLS (f); | 2278 | FrameCols (tty) = FRAME_COLS (f); |
| 2258 | specified_window = FRAME_LINES (f); | 2279 | tty->specified_window = FRAME_LINES (f); |
| 2259 | 2280 | ||
| 2260 | delete_in_insert_mode = 1; | 2281 | f->display_method->delete_in_insert_mode = 1; |
| 2261 | 2282 | ||
| 2262 | UseTabs = 0; | 2283 | UseTabs (tty) = 0; |
| 2263 | TTY_SCROLL_REGION_OK (tty) = 0; | 2284 | FRAME_SCROLL_REGION_OK (f) = 0; |
| 2264 | 2285 | ||
| 2265 | /* Seems to insert lines when it's not supposed to, messing | 2286 | /* Seems to insert lines when it's not supposed to, messing |
| 2266 | up the display. In doing a trace, it didn't seem to be | 2287 | up the display. In doing a trace, it didn't seem to be |
| 2267 | called much, so I don't think we're losing anything by | 2288 | called much, so I don't think we're losing anything by |
| 2268 | turning it off. */ | 2289 | turning it off. */ |
| 2269 | TTY_LINE_INS_DEL_OK (tty) = 0; | 2290 | FRAME_LINE_INS_DEL_OK (f) = 0; |
| 2270 | 2291 | FRAME_CHAR_INS_DEL_OK (f) = 1; | |
| 2271 | TTY_CHAR_INS_DEL_OK (tty) = 1; | ||
| 2272 | 2292 | ||
| 2273 | baud_rate = 19200; | 2293 | baud_rate = 19200; |
| 2274 | 2294 | ||
| @@ -2449,9 +2469,9 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2449 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have | 2469 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have |
| 2450 | the former flag imply the latter. */ | 2470 | the former flag imply the latter. */ |
| 2451 | AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); | 2471 | AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); |
| 2452 | TTY_MEMORY_BELOW_FRAME (tty) = tgetflag ("db"); | 2472 | FRAME_MEMORY_BELOW_FRAME (f) = tgetflag ("db"); |
| 2453 | tty->TF_hazeltine = tgetflag ("hz"); | 2473 | tty->TF_hazeltine = tgetflag ("hz"); |
| 2454 | TTY_MUST_WRITE_SPACES (tty) = tgetflag ("in"); | 2474 | FRAME_MUST_WRITE_SPACES (f) = tgetflag ("in"); |
| 2455 | tty->meta_key = tgetflag ("km") || tgetflag ("MT"); | 2475 | tty->meta_key = tgetflag ("km") || tgetflag ("MT"); |
| 2456 | tty->TF_insmode_motion = tgetflag ("mi"); | 2476 | tty->TF_insmode_motion = tgetflag ("mi"); |
| 2457 | tty->TF_standout_motion = tgetflag ("ms"); | 2477 | tty->TF_standout_motion = tgetflag ("ms"); |
| @@ -2489,7 +2509,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2489 | } | 2509 | } |
| 2490 | 2510 | ||
| 2491 | #if 0 /* This is not used anywhere. */ | 2511 | #if 0 /* This is not used anywhere. */ |
| 2492 | TTY_MIN_PADDING_SPEED (tty) = tgetnum ("pb"); | 2512 | f->display_method->min_padding_speed = tgetnum ("pb"); |
| 2493 | #endif | 2513 | #endif |
| 2494 | 2514 | ||
| 2495 | TabWidth (tty) = tgetnum ("tw"); | 2515 | TabWidth (tty) = tgetnum ("tw"); |
| @@ -2567,7 +2587,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2567 | 2587 | ||
| 2568 | if (!strcmp (terminal_type, "supdup")) | 2588 | if (!strcmp (terminal_type, "supdup")) |
| 2569 | { | 2589 | { |
| 2570 | TTY_MEMORY_BELOW_FRAME (tty) = 1; | 2590 | FRAME_MEMORY_BELOW_FRAME (f) = 1; |
| 2571 | tty->Wcm->cm_losewrap = 1; | 2591 | tty->Wcm->cm_losewrap = 1; |
| 2572 | } | 2592 | } |
| 2573 | if (!strncmp (terminal_type, "c10", 3) | 2593 | if (!strncmp (terminal_type, "c10", 3) |
| @@ -2577,7 +2597,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2577 | This string is not valid in general since it works only | 2597 | This string is not valid in general since it works only |
| 2578 | for windows starting at the upper left corner; | 2598 | for windows starting at the upper left corner; |
| 2579 | but that is all Emacs uses. | 2599 | but that is all Emacs uses. |
| 2580 | 2600 | ||
| 2581 | This string works only if the frame is using | 2601 | This string works only if the frame is using |
| 2582 | the top of the video memory, because addressing is memory-relative. | 2602 | the top of the video memory, because addressing is memory-relative. |
| 2583 | So first check the :ti string to see if that is true. | 2603 | So first check the :ti string to see if that is true. |
| @@ -2594,7 +2614,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2594 | tty->TS_set_window = "\033v%C %C %C %C "; | 2614 | tty->TS_set_window = "\033v%C %C %C %C "; |
| 2595 | } | 2615 | } |
| 2596 | /* Termcap entry often fails to have :in: flag */ | 2616 | /* Termcap entry often fails to have :in: flag */ |
| 2597 | TTY_MUST_WRITE_SPACES (tty) = 1; | 2617 | FRAME_MUST_WRITE_SPACES (f) = 1; |
| 2598 | /* :ti string typically fails to have \E^G! in it */ | 2618 | /* :ti string typically fails to have \E^G! in it */ |
| 2599 | /* This limits scope of insert-char to one line. */ | 2619 | /* This limits scope of insert-char to one line. */ |
| 2600 | strcpy (area, tty->TS_termcap_modes); | 2620 | strcpy (area, tty->TS_termcap_modes); |
| @@ -2649,7 +2669,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2649 | # endif /* TERMINFO */ | 2669 | # endif /* TERMINFO */ |
| 2650 | #endif /*VMS */ | 2670 | #endif /*VMS */ |
| 2651 | } | 2671 | } |
| 2652 | 2672 | ||
| 2653 | if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) | 2673 | if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) |
| 2654 | { | 2674 | { |
| 2655 | if (name) | 2675 | if (name) |
| @@ -2671,22 +2691,22 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2671 | 2691 | ||
| 2672 | UseTabs (tty) = tabs_safe_p (fileno (TTY_INPUT (tty))) && TabWidth (tty) == 8; | 2692 | UseTabs (tty) = tabs_safe_p (fileno (TTY_INPUT (tty))) && TabWidth (tty) == 8; |
| 2673 | 2693 | ||
| 2674 | TTY_SCROLL_REGION_OK (tty) | 2694 | FRAME_SCROLL_REGION_OK (f) |
| 2675 | = (tty->Wcm->cm_abs | 2695 | = (tty->Wcm->cm_abs |
| 2676 | && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); | 2696 | && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); |
| 2677 | 2697 | ||
| 2678 | TTY_LINE_INS_DEL_OK (tty) | 2698 | FRAME_LINE_INS_DEL_OK (f) |
| 2679 | = (((tty->TS_ins_line || tty->TS_ins_multi_lines) | 2699 | = (((tty->TS_ins_line || tty->TS_ins_multi_lines) |
| 2680 | && (tty->TS_del_line || tty->TS_del_multi_lines)) | 2700 | && (tty->TS_del_line || tty->TS_del_multi_lines)) |
| 2681 | || (TTY_SCROLL_REGION_OK (tty) | 2701 | || (FRAME_SCROLL_REGION_OK (f) |
| 2682 | && tty->TS_fwd_scroll && tty->TS_rev_scroll)); | 2702 | && tty->TS_fwd_scroll && tty->TS_rev_scroll)); |
| 2683 | 2703 | ||
| 2684 | TTY_CHAR_INS_DEL_OK (tty) | 2704 | FRAME_CHAR_INS_DEL_OK (f) |
| 2685 | = ((tty->TS_ins_char || tty->TS_insert_mode | 2705 | = ((tty->TS_ins_char || tty->TS_insert_mode |
| 2686 | || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) | 2706 | || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) |
| 2687 | && (tty->TS_del_char || tty->TS_del_multi_chars)); | 2707 | && (tty->TS_del_char || tty->TS_del_multi_chars)); |
| 2688 | 2708 | ||
| 2689 | TTY_FAST_CLEAR_END_OF_LINE (tty) = tty->TS_clr_line != 0; | 2709 | FRAME_FAST_CLEAR_END_OF_LINE (f) = tty->TS_clr_line != 0; |
| 2690 | 2710 | ||
| 2691 | init_baud_rate (fileno (TTY_INPUT (tty))); | 2711 | init_baud_rate (fileno (TTY_INPUT (tty))); |
| 2692 | if (read_socket_hook) /* Baudrate is somewhat | 2712 | if (read_socket_hook) /* Baudrate is somewhat |
| @@ -2696,14 +2716,22 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2696 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | 2716 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
| 2697 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | 2717 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; |
| 2698 | 2718 | ||
| 2719 | #ifdef AIXHFT | ||
| 2720 | /* The HFT system on AIX doesn't optimize for scrolling, so it's | ||
| 2721 | really ugly at times. */ | ||
| 2722 | FRAME_LINE_INS_DEL_OK (f) = 0; | ||
| 2723 | FRAME_CHAR_INS_DEL_OK (f) = 0; | ||
| 2724 | #endif | ||
| 2725 | |||
| 2699 | /* Don't do this. I think termcap may still need the buffer. */ | 2726 | /* Don't do this. I think termcap may still need the buffer. */ |
| 2700 | /* xfree (buffer); */ | 2727 | /* xfree (buffer); */ |
| 2701 | 2728 | ||
| 2729 | /* Set the top frame to the first frame on this display. */ | ||
| 2702 | tty->top_frame = frame; | 2730 | tty->top_frame = frame; |
| 2703 | 2731 | ||
| 2704 | /* Init system terminal modes (RAW or CBREAK, etc.). */ | 2732 | /* Init system terminal modes (RAW or CBREAK, etc.). */ |
| 2705 | init_sys_modes (tty); | 2733 | init_sys_modes (tty); |
| 2706 | 2734 | ||
| 2707 | tty_set_terminal_modes (tty); | 2735 | tty_set_terminal_modes (tty); |
| 2708 | 2736 | ||
| 2709 | return tty; | 2737 | return tty; |
| @@ -2733,7 +2761,7 @@ DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0, | |||
| 2733 | char *name = 0; | 2761 | char *name = 0; |
| 2734 | 2762 | ||
| 2735 | CHECK_STRING (tty); | 2763 | CHECK_STRING (tty); |
| 2736 | 2764 | ||
| 2737 | if (SBYTES (tty) > 0) | 2765 | if (SBYTES (tty) > 0) |
| 2738 | { | 2766 | { |
| 2739 | name = (char *) alloca (SBYTES (tty) + 1); | 2767 | name = (char *) alloca (SBYTES (tty) + 1); |
| @@ -2745,7 +2773,7 @@ DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0, | |||
| 2745 | 2773 | ||
| 2746 | if (! t) | 2774 | if (! t) |
| 2747 | error ("No such tty device: %s", name); | 2775 | error ("No such tty device: %s", name); |
| 2748 | 2776 | ||
| 2749 | delete_tty (t); | 2777 | delete_tty (t); |
| 2750 | } | 2778 | } |
| 2751 | 2779 | ||
| @@ -2755,14 +2783,14 @@ void | |||
| 2755 | delete_tty (struct tty_display_info *tty) | 2783 | delete_tty (struct tty_display_info *tty) |
| 2756 | { | 2784 | { |
| 2757 | Lisp_Object tail, frame; | 2785 | Lisp_Object tail, frame; |
| 2758 | 2786 | ||
| 2759 | if (deleting_tty) | 2787 | if (deleting_tty) |
| 2760 | /* We get a recursive call when we delete the last frame on this | 2788 | /* We get a recursive call when we delete the last frame on this |
| 2761 | tty. */ | 2789 | tty. */ |
| 2762 | return; | 2790 | return; |
| 2763 | 2791 | ||
| 2764 | deleting_tty = 1; | 2792 | deleting_tty = 1; |
| 2765 | 2793 | ||
| 2766 | if (tty == tty_list) | 2794 | if (tty == tty_list) |
| 2767 | tty_list = tty->next; | 2795 | tty_list = tty->next; |
| 2768 | else | 2796 | else |
| @@ -2782,20 +2810,20 @@ delete_tty (struct tty_display_info *tty) | |||
| 2782 | FOR_EACH_FRAME (tail, frame) | 2810 | FOR_EACH_FRAME (tail, frame) |
| 2783 | { | 2811 | { |
| 2784 | struct frame *f = XFRAME (frame); | 2812 | struct frame *f = XFRAME (frame); |
| 2785 | if (FRAME_LIVE_P (f) && FRAME_TTY (f) == tty) | 2813 | if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty) |
| 2786 | { | 2814 | { |
| 2787 | Fdelete_frame (frame, Qt); | 2815 | Fdelete_frame (frame, Qt); |
| 2788 | f->output_data.tty = 0; | 2816 | f->output_data.tty = 0; |
| 2789 | } | 2817 | } |
| 2790 | } | 2818 | } |
| 2791 | 2819 | ||
| 2792 | reset_sys_modes (tty); | 2820 | reset_sys_modes (tty); |
| 2793 | 2821 | ||
| 2794 | if (tty->name) | 2822 | if (tty->name) |
| 2795 | xfree (tty->name); | 2823 | xfree (tty->name); |
| 2796 | if (tty->type) | 2824 | if (tty->type) |
| 2797 | xfree (tty->type); | 2825 | xfree (tty->type); |
| 2798 | 2826 | ||
| 2799 | if (tty->input) | 2827 | if (tty->input) |
| 2800 | { | 2828 | { |
| 2801 | delete_keyboard_wait_descriptor (fileno (tty->input)); | 2829 | delete_keyboard_wait_descriptor (fileno (tty->input)); |
| @@ -2806,13 +2834,16 @@ delete_tty (struct tty_display_info *tty) | |||
| 2806 | fclose (tty->output); | 2834 | fclose (tty->output); |
| 2807 | if (tty->termscript) | 2835 | if (tty->termscript) |
| 2808 | fclose (tty->termscript); | 2836 | fclose (tty->termscript); |
| 2809 | 2837 | ||
| 2810 | if (tty->old_tty) | 2838 | if (tty->old_tty) |
| 2811 | xfree (tty->old_tty); | 2839 | xfree (tty->old_tty); |
| 2812 | 2840 | ||
| 2813 | if (tty->Wcm) | 2841 | if (tty->Wcm) |
| 2814 | xfree (tty->Wcm); | 2842 | xfree (tty->Wcm); |
| 2815 | 2843 | ||
| 2844 | if (tty->display_method) | ||
| 2845 | xfree (tty->display_method); | ||
| 2846 | |||
| 2816 | bzero (tty, sizeof (struct tty_display_info)); | 2847 | bzero (tty, sizeof (struct tty_display_info)); |
| 2817 | xfree (tty); | 2848 | xfree (tty); |
| 2818 | deleting_tty = 0; | 2849 | deleting_tty = 0; |
| @@ -2865,7 +2896,9 @@ The function should accept no arguments. */); | |||
| 2865 | defsubr (&Sframe_tty_name); | 2896 | defsubr (&Sframe_tty_name); |
| 2866 | defsubr (&Sframe_tty_type); | 2897 | defsubr (&Sframe_tty_type); |
| 2867 | defsubr (&Sdelete_tty); | 2898 | defsubr (&Sdelete_tty); |
| 2868 | 2899 | ||
| 2900 | /* XXX tty_display_method_template initialization will go here. */ | ||
| 2901 | |||
| 2869 | Fprovide (intern ("multi-tty"), Qnil); | 2902 | Fprovide (intern ("multi-tty"), Qnil); |
| 2870 | } | 2903 | } |
| 2871 | 2904 | ||
diff --git a/src/termchar.h b/src/termchar.h index 49b1be87bea..c54c1dde061 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -64,29 +64,6 @@ struct tty_display_info | |||
| 64 | /* The previous terminal frame we displayed on this tty. */ | 64 | /* The previous terminal frame we displayed on this tty. */ |
| 65 | struct frame *previous_terminal_frame; | 65 | struct frame *previous_terminal_frame; |
| 66 | 66 | ||
| 67 | /* Terminal characteristics. */ | ||
| 68 | |||
| 69 | int must_write_spaces; /* Nonzero means spaces in the text must | ||
| 70 | actually be output; can't just skip over | ||
| 71 | some columns to leave them blank. */ | ||
| 72 | int fast_clear_end_of_line; /* Nonzero means terminal has a `ce' string */ | ||
| 73 | |||
| 74 | int line_ins_del_ok; /* Terminal can insert and delete lines */ | ||
| 75 | int char_ins_del_ok; /* Terminal can insert and delete chars */ | ||
| 76 | int scroll_region_ok; /* Terminal supports setting the scroll | ||
| 77 | window */ | ||
| 78 | int scroll_region_cost; /* Cost of setting the scroll window, | ||
| 79 | measured in characters. */ | ||
| 80 | int memory_below_frame; /* Terminal remembers lines scrolled | ||
| 81 | off bottom */ | ||
| 82 | |||
| 83 | #if 0 /* These are not used anywhere. */ | ||
| 84 | /* EMACS_INT baud_rate; */ /* Output speed in baud */ | ||
| 85 | int min_padding_speed; /* Speed below which no padding necessary. */ | ||
| 86 | int dont_calculate_costs; /* Nonzero means don't bother computing | ||
| 87 | various cost tables; we won't use them. */ | ||
| 88 | #endif | ||
| 89 | |||
| 90 | /* Strings, numbers and flags taken from the termcap entry. */ | 67 | /* Strings, numbers and flags taken from the termcap entry. */ |
| 91 | 68 | ||
| 92 | char *TS_ins_line; /* "al" */ | 69 | char *TS_ins_line; /* "al" */ |
| @@ -198,6 +175,13 @@ struct tty_display_info | |||
| 198 | /* Flag used in tty_show/hide_cursor. */ | 175 | /* Flag used in tty_show/hide_cursor. */ |
| 199 | 176 | ||
| 200 | int cursor_hidden; | 177 | int cursor_hidden; |
| 178 | |||
| 179 | /* Nonzero means use ^S/^Q for flow control. */ | ||
| 180 | int flow_control; | ||
| 181 | |||
| 182 | /* This is a copy of struct frame's display_method value; needed for | ||
| 183 | freeing up memory when deleting the tty. */ | ||
| 184 | struct display_method *display_method; | ||
| 201 | }; | 185 | }; |
| 202 | 186 | ||
| 203 | /* A chain of structures for all tty devices currently in use. */ | 187 | /* A chain of structures for all tty devices currently in use. */ |
| @@ -215,13 +199,5 @@ extern struct tty_display_info *tty_list; | |||
| 215 | #define TTY_OUTPUT(t) ((t)->output) | 199 | #define TTY_OUTPUT(t) ((t)->output) |
| 216 | #define TTY_TERMSCRIPT(t) ((t)->termscript) | 200 | #define TTY_TERMSCRIPT(t) ((t)->termscript) |
| 217 | 201 | ||
| 218 | #define TTY_MUST_WRITE_SPACES(t) ((t)->must_write_spaces) | ||
| 219 | #define TTY_FAST_CLEAR_END_OF_LINE(t) ((t)->fast_clear_end_of_line) | ||
| 220 | #define TTY_LINE_INS_DEL_OK(t) ((t)->line_ins_del_ok) | ||
| 221 | #define TTY_CHAR_INS_DEL_OK(t) ((t)->char_ins_del_ok) | ||
| 222 | #define TTY_SCROLL_REGION_OK(t) ((t)->scroll_region_ok) | ||
| 223 | #define TTY_SCROLL_REGION_COST(t) ((t)->scroll_region_cost) | ||
| 224 | #define TTY_MEMORY_BELOW_FRAME(t) ((t)->memory_below_frame) | ||
| 225 | |||
| 226 | /* arch-tag: bf9f0d49-842b-42fb-9348-ec8759b27193 | 202 | /* arch-tag: bf9f0d49-842b-42fb-9348-ec8759b27193 |
| 227 | (do not change this comment) */ | 203 | (do not change this comment) */ |
diff --git a/src/termhooks.h b/src/termhooks.h index 0802ec50d95..0d7818ab818 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -31,11 +31,46 @@ struct frame; | |||
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /* Device-local parameters. */ | 33 | /* Device-local parameters. */ |
| 34 | struct device | 34 | struct display_method |
| 35 | { | 35 | { |
| 36 | /* Terminal characteristics. */ | ||
| 37 | |||
| 38 | int must_write_spaces; /* Nonzero means spaces in the text must | ||
| 39 | actually be output; can't just skip over | ||
| 40 | some columns to leave them blank. */ | ||
| 41 | int fast_clear_end_of_line; /* Nonzero means terminal has a `ce' string */ | ||
| 42 | |||
| 43 | int line_ins_del_ok; /* Terminal can insert and delete lines */ | ||
| 44 | int char_ins_del_ok; /* Terminal can insert and delete chars */ | ||
| 45 | int scroll_region_ok; /* Terminal supports setting the scroll | ||
| 46 | window */ | ||
| 47 | int scroll_region_cost; /* Cost of setting the scroll window, | ||
| 48 | measured in characters. */ | ||
| 49 | int memory_below_frame; /* Terminal remembers lines scrolled | ||
| 50 | off bottom */ | ||
| 51 | |||
| 52 | #if 0 /* These are not used anywhere. */ | ||
| 53 | /* EMACS_INT baud_rate; */ /* Output speed in baud */ | ||
| 54 | int min_padding_speed; /* Speed below which no padding necessary. */ | ||
| 55 | int dont_calculate_costs; /* Nonzero means don't bother computing | ||
| 56 | various cost tables; we won't use them. */ | ||
| 57 | #endif | ||
| 58 | |||
| 59 | /* Window-based redisplay interface for this frame (0 for termcap | ||
| 60 | frames). */ | ||
| 61 | struct redisplay_interface *rif; | ||
| 62 | |||
| 36 | /* XXX Display hooks will go here. */ | 63 | /* XXX Display hooks will go here. */ |
| 37 | }; | 64 | }; |
| 38 | 65 | ||
| 66 | #define FRAME_MUST_WRITE_SPACES(f) ((f)->display_method->must_write_spaces) | ||
| 67 | #define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->display_method->fast_clear_end_of_line) | ||
| 68 | #define FRAME_LINE_INS_DEL_OK(f) ((f)->display_method->line_ins_del_ok) | ||
| 69 | #define FRAME_CHAR_INS_DEL_OK(f) ((f)->display_method->char_ins_del_ok) | ||
| 70 | #define FRAME_SCROLL_REGION_OK(f) ((f)->display_method->scroll_region_ok) | ||
| 71 | #define FRAME_SCROLL_REGION_COST(f) ((f)->display_method->scroll_region_cost) | ||
| 72 | #define FRAME_MEMORY_BELOW_FRAME(f) ((f)->display_method->memory_below_frame) | ||
| 73 | |||
| 39 | /* Text display hooks. */ | 74 | /* Text display hooks. */ |
| 40 | 75 | ||
| 41 | extern void (*cursor_to_hook) P_ ((int vpos, int hpos)); | 76 | extern void (*cursor_to_hook) P_ ((int vpos, int hpos)); |
| @@ -432,7 +467,7 @@ enum { | |||
| 432 | meta_modifier = CHAR_META /* Under X, the XK_Meta_[LR] keysyms. */ | 467 | meta_modifier = CHAR_META /* Under X, the XK_Meta_[LR] keysyms. */ |
| 433 | }; | 468 | }; |
| 434 | 469 | ||
| 435 | #endif | 470 | #endif /* CONSP */ |
| 436 | 471 | ||
| 437 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d | 472 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d |
| 438 | (do not change this comment) */ | 473 | (do not change this comment) */ |
diff --git a/src/window.c b/src/window.c index 4efc43bb9ce..48e517a68f7 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6384,6 +6384,7 @@ 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; | ||
| 6387 | minibuf_window = f->minibuffer_window; | 6388 | minibuf_window = f->minibuffer_window; |
| 6388 | selected_window = f->selected_window; | 6389 | selected_window = f->selected_window; |
| 6389 | last_nonminibuf_frame = f; | 6390 | last_nonminibuf_frame = f; |
diff --git a/src/xdisp.c b/src/xdisp.c index 2c83246b9f4..e2decba9066 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2008,6 +2008,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2008 | XSETWINDOW (it->window, w); | 2008 | XSETWINDOW (it->window, w); |
| 2009 | it->w = w; | 2009 | it->w = w; |
| 2010 | it->f = XFRAME (w->frame); | 2010 | it->f = XFRAME (w->frame); |
| 2011 | |||
| 2012 | /* XXX rif hack: Make sure the redisplay interface is correctly set. */ | ||
| 2013 | rif = it->f->display_method->rif; | ||
| 2011 | 2014 | ||
| 2012 | /* Extra space between lines (on window systems only). */ | 2015 | /* Extra space between lines (on window systems only). */ |
| 2013 | if (base_face_id == DEFAULT_FACE_ID | 2016 | if (base_face_id == DEFAULT_FACE_ID |
| @@ -12899,7 +12902,7 @@ try_window_id (w) | |||
| 12899 | 12902 | ||
| 12900 | /* Window must either use window-based redisplay or be full width. */ | 12903 | /* Window must either use window-based redisplay or be full width. */ |
| 12901 | if (!FRAME_WINDOW_P (f) | 12904 | if (!FRAME_WINDOW_P (f) |
| 12902 | && (!TTY_LINE_INS_DEL_OK (CURTTY ()) | 12905 | && (!FRAME_LINE_INS_DEL_OK (f) |
| 12903 | || !WINDOW_FULL_WIDTH_P (w))) | 12906 | || !WINDOW_FULL_WIDTH_P (w))) |
| 12904 | GIVE_UP (4); | 12907 | GIVE_UP (4); |
| 12905 | 12908 | ||
| @@ -13332,7 +13335,7 @@ try_window_id (w) | |||
| 13332 | 13335 | ||
| 13333 | /* On dumb terminals delete dvpos lines at the end | 13336 | /* On dumb terminals delete dvpos lines at the end |
| 13334 | before inserting dvpos empty lines. */ | 13337 | before inserting dvpos empty lines. */ |
| 13335 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f))) | 13338 | if (!FRAME_SCROLL_REGION_OK (f)) |
| 13336 | ins_del_lines (end - dvpos, -dvpos); | 13339 | ins_del_lines (end - dvpos, -dvpos); |
| 13337 | 13340 | ||
| 13338 | /* Insert dvpos empty lines in front of | 13341 | /* Insert dvpos empty lines in front of |
| @@ -13353,7 +13356,7 @@ try_window_id (w) | |||
| 13353 | 13356 | ||
| 13354 | /* On a dumb terminal insert dvpos empty lines at the | 13357 | /* On a dumb terminal insert dvpos empty lines at the |
| 13355 | end. */ | 13358 | end. */ |
| 13356 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f))) | 13359 | if (!FRAME_SCROLL_REGION_OK (f)) |
| 13357 | ins_del_lines (end + dvpos, -dvpos); | 13360 | ins_del_lines (end + dvpos, -dvpos); |
| 13358 | } | 13361 | } |
| 13359 | 13362 | ||
| @@ -21194,6 +21197,9 @@ expose_frame (f, x, y, w, h) | |||
| 21194 | 21197 | ||
| 21195 | TRACE ((stderr, "expose_frame ")); | 21198 | TRACE ((stderr, "expose_frame ")); |
| 21196 | 21199 | ||
| 21200 | /* XXX rif hack: Make sure redisplay interface is updated. */ | ||
| 21201 | rif = f->display_method->rif; | ||
| 21202 | |||
| 21197 | /* No need to redraw if frame will be redrawn soon. */ | 21203 | /* No need to redraw if frame will be redrawn soon. */ |
| 21198 | if (FRAME_GARBAGED_P (f)) | 21204 | if (FRAME_GARBAGED_P (f)) |
| 21199 | { | 21205 | { |
diff --git a/src/xfaces.c b/src/xfaces.c index 47f406d7012..7b3637b1a6a 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6640,7 +6640,8 @@ realize_basic_faces (f) | |||
| 6640 | { | 6640 | { |
| 6641 | FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; | 6641 | FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; |
| 6642 | #ifdef USE_X_TOOLKIT | 6642 | #ifdef USE_X_TOOLKIT |
| 6643 | x_update_menu_appearance (f); | 6643 | if (FRAME_WINDOW_P (f)) |
| 6644 | x_update_menu_appearance (f); | ||
| 6644 | #endif | 6645 | #endif |
| 6645 | } | 6646 | } |
| 6646 | 6647 | ||
diff --git a/src/xfns.c b/src/xfns.c index 4d9733bdc95..3306173580c 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3191,6 +3191,9 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3191 | 3191 | ||
| 3192 | check_x (); | 3192 | check_x (); |
| 3193 | 3193 | ||
| 3194 | /* XXX rif hack:Make sure rif is set to the right value. */ | ||
| 3195 | rif = x_display_method.rif; | ||
| 3196 | |||
| 3194 | /* Use this general default value to start with | 3197 | /* Use this general default value to start with |
| 3195 | until we know if this frame has a specified name. */ | 3198 | until we know if this frame has a specified name. */ |
| 3196 | Vx_resource_name = Vinvocation_name; | 3199 | Vx_resource_name = Vinvocation_name; |
| @@ -3245,6 +3248,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3245 | /* Note that X Windows does support scroll bars. */ | 3248 | /* Note that X Windows does support scroll bars. */ |
| 3246 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; | 3249 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; |
| 3247 | 3250 | ||
| 3251 | f->display_method = &x_display_method; | ||
| 3248 | f->output_method = output_x_window; | 3252 | f->output_method = output_x_window; |
| 3249 | f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); | 3253 | f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); |
| 3250 | bzero (f->output_data.x, sizeof (struct x_output)); | 3254 | bzero (f->output_data.x, sizeof (struct x_output)); |
| @@ -9980,6 +9984,8 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 9980 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | 9984 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
| 9981 | record_unwind_protect (unwind_create_tip_frame, frame); | 9985 | record_unwind_protect (unwind_create_tip_frame, frame); |
| 9982 | 9986 | ||
| 9987 | f->display_method = &x_display_method; | ||
| 9988 | |||
| 9983 | /* By setting the output method, we're essentially saying that | 9989 | /* By setting the output method, we're essentially saying that |
| 9984 | the frame is live, as per FRAME_LIVE_P. If we get a signal | 9990 | the frame is live, as per FRAME_LIVE_P. If we get a signal |
| 9985 | from this point on, x_destroy_window might screw up reference | 9991 | from this point on, x_destroy_window might screw up reference |
diff --git a/src/xterm.c b/src/xterm.c index e01a5e540fd..01b500f1915 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -184,6 +184,10 @@ static Lisp_Object last_window; | |||
| 184 | 184 | ||
| 185 | int x_use_underline_position_properties; | 185 | int x_use_underline_position_properties; |
| 186 | 186 | ||
| 187 | /* Generic display parameters for X displays. */ | ||
| 188 | |||
| 189 | struct display_method x_display_method; | ||
| 190 | |||
| 187 | /* This is a chain of structures for all the X displays currently in | 191 | /* This is a chain of structures for all the X displays currently in |
| 188 | use. */ | 192 | use. */ |
| 189 | 193 | ||
| @@ -382,7 +386,8 @@ x_flush (f) | |||
| 382 | { | 386 | { |
| 383 | Lisp_Object rest, frame; | 387 | Lisp_Object rest, frame; |
| 384 | FOR_EACH_FRAME (rest, frame) | 388 | FOR_EACH_FRAME (rest, frame) |
| 385 | x_flush (XFRAME (frame)); | 389 | if (FRAME_X_P (XFRAME (frame))) |
| 390 | x_flush (XFRAME (frame)); | ||
| 386 | } | 391 | } |
| 387 | else if (FRAME_X_P (f)) | 392 | else if (FRAME_X_P (f)) |
| 388 | XFlush (FRAME_X_DISPLAY (f)); | 393 | XFlush (FRAME_X_DISPLAY (f)); |
| @@ -469,7 +474,6 @@ x_update_begin (f) | |||
| 469 | /* Nothing to do. */ | 474 | /* Nothing to do. */ |
| 470 | } | 475 | } |
| 471 | 476 | ||
| 472 | |||
| 473 | /* Start update of window W. Set the global variable updated_window | 477 | /* Start update of window W. Set the global variable updated_window |
| 474 | to the window being updated and set output_cursor to the cursor | 478 | to the window being updated and set output_cursor to the cursor |
| 475 | position of W. */ | 479 | position of W. */ |
| @@ -1365,7 +1369,8 @@ x_frame_of_widget (widget) | |||
| 1365 | for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) | 1369 | for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
| 1366 | if (GC_FRAMEP (XCAR (tail)) | 1370 | if (GC_FRAMEP (XCAR (tail)) |
| 1367 | && (f = XFRAME (XCAR (tail)), | 1371 | && (f = XFRAME (XCAR (tail)), |
| 1368 | (f->output_data.nothing != 1 | 1372 | (FRAME_X_P (f) |
| 1373 | && f->output_data.nothing != 1 | ||
| 1369 | && FRAME_X_DISPLAY_INFO (f) == dpyinfo)) | 1374 | && FRAME_X_DISPLAY_INFO (f) == dpyinfo)) |
| 1370 | && f->output_data.x->widget == widget) | 1375 | && f->output_data.x->widget == widget) |
| 1371 | return f; | 1376 | return f; |
| @@ -3057,6 +3062,9 @@ static void | |||
| 3057 | frame_highlight (f) | 3062 | frame_highlight (f) |
| 3058 | struct frame *f; | 3063 | struct frame *f; |
| 3059 | { | 3064 | { |
| 3065 | /* XXX hack: make sure rif is right. */ | ||
| 3066 | rif = f->display_method->rif; | ||
| 3067 | |||
| 3060 | /* We used to only do this if Vx_no_window_manager was non-nil, but | 3068 | /* We used to only do this if Vx_no_window_manager was non-nil, but |
| 3061 | the ICCCM (section 4.1.6) says that the window's border pixmap | 3069 | the ICCCM (section 4.1.6) says that the window's border pixmap |
| 3062 | and border pixel are window attributes which are "private to the | 3070 | and border pixel are window attributes which are "private to the |
| @@ -3072,6 +3080,9 @@ static void | |||
| 3072 | frame_unhighlight (f) | 3080 | frame_unhighlight (f) |
| 3073 | struct frame *f; | 3081 | struct frame *f; |
| 3074 | { | 3082 | { |
| 3083 | /* XXX hack: make sure rif is right. */ | ||
| 3084 | rif = f->display_method->rif; | ||
| 3085 | |||
| 3075 | /* We used to only do this if Vx_no_window_manager was non-nil, but | 3086 | /* We used to only do this if Vx_no_window_manager was non-nil, but |
| 3076 | the ICCCM (section 4.1.6) says that the window's border pixmap | 3087 | the ICCCM (section 4.1.6) says that the window's border pixmap |
| 3077 | and border pixel are window attributes which are "private to the | 3088 | and border pixel are window attributes which are "private to the |
| @@ -3663,7 +3674,8 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3663 | 3674 | ||
| 3664 | /* Clear the mouse-moved flag for every frame on this display. */ | 3675 | /* Clear the mouse-moved flag for every frame on this display. */ |
| 3665 | FOR_EACH_FRAME (tail, frame) | 3676 | FOR_EACH_FRAME (tail, frame) |
| 3666 | if (FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp)) | 3677 | if (FRAME_X_P (XFRAME (frame)) |
| 3678 | && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp)) | ||
| 3667 | XFRAME (frame)->mouse_moved = 0; | 3679 | XFRAME (frame)->mouse_moved = 0; |
| 3668 | 3680 | ||
| 3669 | last_mouse_scroll_bar = Qnil; | 3681 | last_mouse_scroll_bar = Qnil; |
| @@ -3877,6 +3889,9 @@ x_window_to_scroll_bar (display, window_id) | |||
| 3877 | if (! GC_FRAMEP (frame)) | 3889 | if (! GC_FRAMEP (frame)) |
| 3878 | abort (); | 3890 | abort (); |
| 3879 | 3891 | ||
| 3892 | if (! FRAME_X_P (XFRAME (frame))) | ||
| 3893 | continue; | ||
| 3894 | |||
| 3880 | /* Scan this frame's scroll bar list for a scroll bar with the | 3895 | /* Scan this frame's scroll bar list for a scroll bar with the |
| 3881 | right window ID. */ | 3896 | right window ID. */ |
| 3882 | condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); | 3897 | condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); |
| @@ -3911,11 +3926,14 @@ x_window_to_menu_bar (window) | |||
| 3911 | XGCTYPE (tail) == Lisp_Cons; | 3926 | XGCTYPE (tail) == Lisp_Cons; |
| 3912 | tail = XCDR (tail)) | 3927 | tail = XCDR (tail)) |
| 3913 | { | 3928 | { |
| 3914 | Lisp_Object frame = XCAR (tail); | 3929 | if (FRAME_X_P (XFRAME (XCAR (tail)))) |
| 3915 | Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget; | 3930 | { |
| 3931 | Lisp_Object frame = XCAR (tail); | ||
| 3932 | Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget; | ||
| 3916 | 3933 | ||
| 3917 | if (menu_bar && xlwmenu_window_p (menu_bar, window)) | 3934 | if (menu_bar && xlwmenu_window_p (menu_bar, window)) |
| 3918 | return menu_bar; | 3935 | return menu_bar; |
| 3936 | } | ||
| 3919 | } | 3937 | } |
| 3920 | 3938 | ||
| 3921 | return NULL; | 3939 | return NULL; |
| @@ -8027,7 +8045,7 @@ xim_destroy_callback (xim, client_data, call_data) | |||
| 8027 | FOR_EACH_FRAME (tail, frame) | 8045 | FOR_EACH_FRAME (tail, frame) |
| 8028 | { | 8046 | { |
| 8029 | struct frame *f = XFRAME (frame); | 8047 | struct frame *f = XFRAME (frame); |
| 8030 | if (FRAME_X_DISPLAY_INFO (f) == dpyinfo) | 8048 | if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo) |
| 8031 | { | 8049 | { |
| 8032 | FRAME_XIC (f) = NULL; | 8050 | FRAME_XIC (f) = NULL; |
| 8033 | if (FRAME_XIC_FONTSET (f)) | 8051 | if (FRAME_XIC_FONTSET (f)) |
| @@ -8130,7 +8148,8 @@ xim_instantiate_callback (display, client_data, call_data) | |||
| 8130 | { | 8148 | { |
| 8131 | struct frame *f = XFRAME (frame); | 8149 | struct frame *f = XFRAME (frame); |
| 8132 | 8150 | ||
| 8133 | if (FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo) | 8151 | if (FRAME_X_P (f) |
| 8152 | && FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo) | ||
| 8134 | if (FRAME_XIC (f) == NULL) | 8153 | if (FRAME_XIC (f) == NULL) |
| 8135 | { | 8154 | { |
| 8136 | create_frame_xic (f); | 8155 | create_frame_xic (f); |
| @@ -10801,43 +10820,41 @@ x_process_timeouts (timer) | |||
| 10801 | extern frame_parm_handler x_frame_parm_handlers[]; | 10820 | extern frame_parm_handler x_frame_parm_handlers[]; |
| 10802 | 10821 | ||
| 10803 | static struct redisplay_interface x_redisplay_interface = | 10822 | static struct redisplay_interface x_redisplay_interface = |
| 10804 | { | 10823 | { |
| 10805 | x_frame_parm_handlers, | 10824 | x_frame_parm_handlers, |
| 10806 | x_produce_glyphs, | 10825 | x_produce_glyphs, |
| 10807 | x_write_glyphs, | 10826 | x_write_glyphs, |
| 10808 | x_insert_glyphs, | 10827 | x_insert_glyphs, |
| 10809 | x_clear_end_of_line, | 10828 | x_clear_end_of_line, |
| 10810 | x_scroll_run, | 10829 | x_scroll_run, |
| 10811 | x_after_update_window_line, | 10830 | x_after_update_window_line, |
| 10812 | x_update_window_begin, | 10831 | x_update_window_begin, |
| 10813 | x_update_window_end, | 10832 | x_update_window_end, |
| 10814 | x_cursor_to, | 10833 | x_cursor_to, |
| 10815 | x_flush, | 10834 | x_flush, |
| 10816 | #ifndef XFlush | 10835 | #ifndef XFlush |
| 10817 | x_flush, | 10836 | x_flush, |
| 10818 | #else | 10837 | #else |
| 10819 | 0, /* flush_display_optional */ | 10838 | 0, /* flush_display_optional */ |
| 10820 | #endif | 10839 | #endif |
| 10821 | x_clear_window_mouse_face, | 10840 | x_clear_window_mouse_face, |
| 10822 | x_get_glyph_overhangs, | 10841 | x_get_glyph_overhangs, |
| 10823 | x_fix_overlapping_area, | 10842 | x_fix_overlapping_area, |
| 10824 | x_draw_fringe_bitmap, | 10843 | x_draw_fringe_bitmap, |
| 10825 | x_per_char_metric, | 10844 | x_per_char_metric, |
| 10826 | x_encode_char, | 10845 | x_encode_char, |
| 10827 | x_compute_glyph_string_overhangs, | 10846 | x_compute_glyph_string_overhangs, |
| 10828 | x_draw_glyph_string, | 10847 | x_draw_glyph_string, |
| 10829 | x_define_frame_cursor, | 10848 | x_define_frame_cursor, |
| 10830 | x_clear_frame_area, | 10849 | x_clear_frame_area, |
| 10831 | x_draw_window_cursor, | 10850 | x_draw_window_cursor, |
| 10832 | x_draw_vertical_window_border, | 10851 | x_draw_vertical_window_border, |
| 10833 | x_shift_glyphs_for_insert | 10852 | x_shift_glyphs_for_insert |
| 10834 | }; | 10853 | }; |
| 10835 | 10854 | ||
| 10836 | void | 10855 | void |
| 10837 | x_initialize () | 10856 | x_initialize () |
| 10838 | { | 10857 | { |
| 10839 | rif = &x_redisplay_interface; | ||
| 10840 | |||
| 10841 | clear_frame_hook = x_clear_frame; | 10858 | clear_frame_hook = x_clear_frame; |
| 10842 | ins_del_lines_hook = x_ins_del_lines; | 10859 | ins_del_lines_hook = x_ins_del_lines; |
| 10843 | delete_glyphs_hook = x_delete_glyphs; | 10860 | delete_glyphs_hook = x_delete_glyphs; |
| @@ -10857,13 +10874,13 @@ x_initialize () | |||
| 10857 | redeem_scroll_bar_hook = XTredeem_scroll_bar; | 10874 | redeem_scroll_bar_hook = XTredeem_scroll_bar; |
| 10858 | judge_scroll_bars_hook = XTjudge_scroll_bars; | 10875 | judge_scroll_bars_hook = XTjudge_scroll_bars; |
| 10859 | 10876 | ||
| 10860 | TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ()) = 1; /* we'll scroll partial frames */ | 10877 | x_display_method.rif = &x_redisplay_interface; |
| 10861 | TERMINAL_CHAR_INS_DEL_OK (CURRENT_TERMINAL ()) = 1; | 10878 | x_display_method.scroll_region_ok = 1; /* We'll scroll partial frames. */ |
| 10862 | TERMINAL_LINE_INS_DEL_OK (CURRENT_TERMINAL ()) = 1; /* we'll just blt 'em */ | 10879 | x_display_method.char_ins_del_ok = 1; |
| 10863 | TERMINAL_FAST_CLEAR_END_OF_LINE (CURRENT_TERMINAL ()) = 1; /* X does this well */ | 10880 | x_display_method.line_ins_del_ok = 1; /* We'll just blt 'em. */ |
| 10864 | TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ()) = 0; /* we don't remember what | 10881 | x_display_method.fast_clear_end_of_line = 1; /* X does this well. */ |
| 10865 | scrolls off the | 10882 | x_display_method.memory_below_frame = 0; /* We don't remember what scrolls off the |
| 10866 | bottom */ | 10883 | bottom. */ |
| 10867 | baud_rate = 19200; | 10884 | baud_rate = 19200; |
| 10868 | 10885 | ||
| 10869 | x_noop_count = 0; | 10886 | x_noop_count = 0; |
diff --git a/src/xterm.h b/src/xterm.h index 104f5f8d76e..3f629a7695a 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -134,6 +134,9 @@ struct x_bitmap_record | |||
| 134 | int height, width, depth; | 134 | int height, width, depth; |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | /* Generic parameters for X displays. */ | ||
| 138 | extern struct display_method x_display_method; | ||
| 139 | |||
| 137 | /* For each X display, we have a structure that records | 140 | /* For each X display, we have a structure that records |
| 138 | information about it. */ | 141 | information about it. */ |
| 139 | 142 | ||