aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-04-16 15:03:58 +0000
committerKaroly Lorentey2004-04-16 15:03:58 +0000
commit385ed61f9d0bffef8a3f037e8cdc85d0de71bf15 (patch)
treef731aec43c0fd28ae4c35f4102d1d2dd21ab735c /src
parent5ffa0039d41813857b4442d435ad4f65123737c5 (diff)
downloademacs-385ed61f9d0bffef8a3f037e8cdc85d0de71bf15.tar.gz
emacs-385ed61f9d0bffef8a3f037e8cdc85d0de71bf15.zip
Eliminated updating_frame.
src/termhooks.h (cursor_to_hook, raw_cursor_to_hook) (clear_to_end_hook, clear_end_of_line_hook, clear_frame_hook) (ins_del_lines_hook, insert_glyphs_hook, write_glyphs_hook) (delete_glyphs_hook, ring_bell_hook, set_terminal_window_hook): Added frame parameter. src/term.c (ring_bell, tty_ring_bell, set_terminal_window) (tty_set_terminal_window, set_scroll_region, cursor_to) (tty_cursor_to, raw_cursor_to, tty_raw_cursor_to, clear_to_end) (tty_clear_to_end, clear_frame, tty_clear_frame, clear_end_of_line) (tty_clear_end_of_line, write_glyphs, tty_write_glyphs, insert_glyphs) (tty_insert_glyphs, delete_glyphs, tty_delete_glyphs, ins_del_lines) (tty_ins_del_lines): Added frame parameter. src/xterm.c (x_delete_glyphs, x_clear_frame, x_ins_del_lines): Added frame parameter. src/scroll.c (do_direct_scrolling, do_scrolling): Added frame parameter. src/term.c (update_begin, update_end): Don't set updating_frame. src/xfns.c (x_set_tool_bar_lines): Ditto. src/term.c (updating_frame): Removed. src/dispextern.h: Updated prototypes. src/dispnew.c (Fredraw_frame, direct_output_for_insert) (direct_output_forward_char, update_frame_1, update_frame_line) (ding, bitch_at_user): Added frame parameter to calls to redisplay. src/xdisp.c (try_window_id): Ditto. src/scroll.c (do_scrolling, do_direct_scrolling, scrolling_1): Ditto. src/fileio.c (auto_save_error): Ditto. src/term.c (tty_ring_bell): Flush the output stream after beeping. src/dispnew.c (ding, bitch_at_user): Don't fflush CURTTY. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-140
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h28
-rw-r--r--src/dispnew.c78
-rw-r--r--src/fileio.c4
-rw-r--r--src/scroll.c39
-rw-r--r--src/term.c146
-rw-r--r--src/termhooks.h24
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfns.c4
-rw-r--r--src/xterm.c17
9 files changed, 154 insertions, 200 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 7056519e7bf..3b71002a304 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -968,10 +968,6 @@ extern int fonts_changed_p;
968 968
969extern struct glyph space_glyph; 969extern struct glyph space_glyph;
970 970
971/* Frame being updated by update_window/update_frame. */
972
973extern struct frame *updating_frame;
974
975/* Window being updated by update_window. This is non-null as long as 971/* Window being updated by update_window. This is non-null as long as
976 update_window has not finished, and null otherwise. It's role is 972 update_window has not finished, and null otherwise. It's role is
977 analogous to updating_frame. */ 973 analogous to updating_frame. */
@@ -2777,8 +2773,8 @@ void clear_glyph_row P_ ((struct glyph_row *));
2777void prepare_desired_row P_ ((struct glyph_row *)); 2773void prepare_desired_row P_ ((struct glyph_row *));
2778int line_hash_code P_ ((struct glyph_row *)); 2774int line_hash_code P_ ((struct glyph_row *));
2779void set_window_update_flags P_ ((struct window *, int)); 2775void set_window_update_flags P_ ((struct window *, int));
2780void write_glyphs P_ ((struct glyph *, int)); 2776void write_glyphs P_ ((struct frame *, struct glyph *, int));
2781void insert_glyphs P_ ((struct glyph *, int)); 2777void insert_glyphs P_ ((struct frame *, struct glyph *, int));
2782void redraw_frame P_ ((struct frame *)); 2778void redraw_frame P_ ((struct frame *));
2783void redraw_garbaged_frames P_ ((void)); 2779void redraw_garbaged_frames P_ ((void));
2784int scroll_cost P_ ((struct frame *, int, int, int)); 2780int scroll_cost P_ ((struct frame *, int, int, int));
@@ -2797,20 +2793,20 @@ extern Lisp_Object Qredisplay_dont_pause;
2797 2793
2798/* Defined in term.c */ 2794/* Defined in term.c */
2799 2795
2800extern void ring_bell P_ ((void)); 2796extern void ring_bell P_ ((struct frame *));
2801extern void update_begin P_ ((struct frame *)); 2797extern void update_begin P_ ((struct frame *));
2802extern void update_end P_ ((struct frame *)); 2798extern void update_end P_ ((struct frame *));
2803extern void set_terminal_window P_ ((int)); 2799extern void set_terminal_window P_ ((struct frame *, int));
2804extern void set_scroll_region P_ ((int, int)); 2800extern void set_scroll_region P_ ((struct frame *, int, int));
2805extern void turn_off_insert P_ ((struct tty_display_info *)); 2801extern void turn_off_insert P_ ((struct tty_display_info *));
2806extern void turn_off_highlight P_ ((struct tty_display_info *)); 2802extern void turn_off_highlight P_ ((struct tty_display_info *));
2807extern void background_highlight P_ ((struct tty_display_info *)); 2803extern void background_highlight P_ ((struct tty_display_info *));
2808extern void clear_frame P_ ((void)); 2804extern void clear_frame P_ ((struct frame *));
2809extern void clear_end_of_line P_ ((int)); 2805extern void clear_end_of_line P_ ((struct frame *, int));
2810extern void clear_end_of_line_raw P_ ((int)); 2806extern void clear_end_of_line_raw P_ ((struct frame *, int));
2811extern void tty_clear_end_of_line P_ ((int)); 2807extern void tty_clear_end_of_line P_ ((struct frame *, int));
2812extern void delete_glyphs P_ ((int)); 2808extern void delete_glyphs P_ ((struct frame *, int));
2813extern void ins_del_lines P_ ((int, int)); 2809extern void ins_del_lines P_ ((struct frame *, int, int));
2814extern int string_cost P_ ((char *)); 2810extern int string_cost P_ ((char *));
2815extern int per_line_cost P_ ((char *)); 2811extern int per_line_cost P_ ((char *));
2816extern void calculate_costs P_ ((struct frame *)); 2812extern void calculate_costs P_ ((struct frame *));
@@ -2822,7 +2818,7 @@ extern struct display *init_initial_display P_ ((void));
2822extern struct display *term_init P_ ((char *, char *, int)); 2818extern struct display *term_init P_ ((char *, char *, int));
2823extern void delete_tty P_ ((struct display *)); 2819extern void delete_tty P_ ((struct display *));
2824extern void fatal P_ ((/* char *, ... */)); 2820extern void fatal P_ ((/* char *, ... */));
2825extern void cursor_to P_ ((int, int)); 2821extern void cursor_to P_ ((struct frame *, int, int));
2826extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); 2822extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
2827extern void tty_set_terminal_modes P_ ((struct display *)); 2823extern void tty_set_terminal_modes P_ ((struct display *));
2828extern void tty_reset_terminal_modes P_ ((struct display *)); 2824extern void tty_reset_terminal_modes P_ ((struct display *));
diff --git a/src/dispnew.c b/src/dispnew.c
index 9a6b0cb65cf..f65a81fc5ef 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3312,7 +3312,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
3312 if (FRAME_MSDOS_P (f)) 3312 if (FRAME_MSDOS_P (f))
3313 set_terminal_modes (FRAME_DISPLAY (f)); 3313 set_terminal_modes (FRAME_DISPLAY (f));
3314#endif 3314#endif
3315 clear_frame (); 3315 clear_frame (f);
3316 clear_current_matrices (f); 3316 clear_current_matrices (f);
3317 update_end (f); 3317 update_end (f);
3318 if (FRAME_TERMCAP_P (f)) 3318 if (FRAME_TERMCAP_P (f))
@@ -3622,9 +3622,9 @@ direct_output_for_insert (g)
3622 else 3622 else
3623 { 3623 {
3624 if (glyphs == end - n) 3624 if (glyphs == end - n)
3625 write_glyphs (glyphs, n); 3625 write_glyphs (f, glyphs, n);
3626 else 3626 else
3627 insert_glyphs (glyphs, n); 3627 insert_glyphs (f, glyphs, n);
3628 } 3628 }
3629 3629
3630 w->cursor.hpos += n; 3630 w->cursor.hpos += n;
@@ -3647,7 +3647,7 @@ direct_output_for_insert (g)
3647 ? XFASTINT (w->left_margin_cols) 3647 ? XFASTINT (w->left_margin_cols)
3648 : 0)); 3648 : 0));
3649 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); 3649 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
3650 cursor_to (y, x); 3650 cursor_to (f, y, x);
3651 } 3651 }
3652 3652
3653#ifdef HAVE_WINDOW_SYSTEM 3653#ifdef HAVE_WINDOW_SYSTEM
@@ -3747,7 +3747,7 @@ direct_output_forward_char (n)
3747 ? XFASTINT (w->left_margin_cols) 3747 ? XFASTINT (w->left_margin_cols)
3748 : 0)); 3748 : 0));
3749 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); 3749 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
3750 cursor_to (y, x); 3750 cursor_to (f, y, x);
3751 } 3751 }
3752 3752
3753 if (FRAME_TERMCAP_P (f)) 3753 if (FRAME_TERMCAP_P (f))
@@ -5234,7 +5234,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5234 } 5234 }
5235 } 5235 }
5236 5236
5237 cursor_to (row, col); 5237 cursor_to (f, row, col);
5238 } 5238 }
5239 else 5239 else
5240 { 5240 {
@@ -5256,7 +5256,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5256 x += XFASTINT (w->left_margin_cols); 5256 x += XFASTINT (w->left_margin_cols);
5257 5257
5258 /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */ 5258 /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */
5259 cursor_to (y, x); 5259 cursor_to (f, y, x);
5260 } 5260 }
5261 } 5261 }
5262 } 5262 }
@@ -5472,8 +5472,8 @@ update_frame_line (f, vpos)
5472 /* Write the contents of the desired line. */ 5472 /* Write the contents of the desired line. */
5473 if (nlen) 5473 if (nlen)
5474 { 5474 {
5475 cursor_to (vpos, 0); 5475 cursor_to (f, vpos, 0);
5476 write_glyphs (nbody, nlen); 5476 write_glyphs (f, nbody, nlen);
5477 } 5477 }
5478 5478
5479 /* Don't call clear_end_of_line if we already wrote the whole 5479 /* Don't call clear_end_of_line if we already wrote the whole
@@ -5481,13 +5481,13 @@ update_frame_line (f, vpos)
5481 case but in the line below. */ 5481 case but in the line below. */
5482 if (nlen < FRAME_TOTAL_COLS (f)) 5482 if (nlen < FRAME_TOTAL_COLS (f))
5483 { 5483 {
5484 cursor_to (vpos, nlen); 5484 cursor_to (f, vpos, nlen);
5485 clear_end_of_line (FRAME_TOTAL_COLS (f)); 5485 clear_end_of_line (f, FRAME_TOTAL_COLS (f));
5486 } 5486 }
5487 else 5487 else
5488 /* Make sure we are in the right row, otherwise cursor movement 5488 /* Make sure we are in the right row, otherwise cursor movement
5489 with cmgoto might use `ch' in the wrong row. */ 5489 with cmgoto might use `ch' in the wrong row. */
5490 cursor_to (vpos, 0); 5490 cursor_to (f, vpos, 0);
5491 5491
5492 make_current (desired_matrix, current_matrix, vpos); 5492 make_current (desired_matrix, current_matrix, vpos);
5493 return; 5493 return;
@@ -5519,8 +5519,8 @@ update_frame_line (f, vpos)
5519 ++j; 5519 ++j;
5520 5520
5521 /* Output this run of non-matching chars. */ 5521 /* Output this run of non-matching chars. */
5522 cursor_to (vpos, i); 5522 cursor_to (f, vpos, i);
5523 write_glyphs (nbody + i, j - i); 5523 write_glyphs (f, nbody + i, j - i);
5524 i = j - 1; 5524 i = j - 1;
5525 5525
5526 /* Now find the next non-match. */ 5526 /* Now find the next non-match. */
@@ -5530,8 +5530,8 @@ update_frame_line (f, vpos)
5530 /* Clear the rest of the line, or the non-clear part of it. */ 5530 /* Clear the rest of the line, or the non-clear part of it. */
5531 if (olen > nlen) 5531 if (olen > nlen)
5532 { 5532 {
5533 cursor_to (vpos, nlen); 5533 cursor_to (f, vpos, nlen);
5534 clear_end_of_line (olen); 5534 clear_end_of_line (f, olen);
5535 } 5535 }
5536 5536
5537 /* Make current row = desired row. */ 5537 /* Make current row = desired row. */
@@ -5553,8 +5553,8 @@ update_frame_line (f, vpos)
5553 5553
5554 if (nlen > nsp) 5554 if (nlen > nsp)
5555 { 5555 {
5556 cursor_to (vpos, nsp); 5556 cursor_to (f, vpos, nsp);
5557 write_glyphs (nbody + nsp, nlen - nsp); 5557 write_glyphs (f, nbody + nsp, nlen - nsp);
5558 } 5558 }
5559 5559
5560 /* Exchange contents between current_frame and new_frame. */ 5560 /* Exchange contents between current_frame and new_frame. */
@@ -5626,8 +5626,8 @@ update_frame_line (f, vpos)
5626 5626
5627 if (osp > nsp) 5627 if (osp > nsp)
5628 { 5628 {
5629 cursor_to (vpos, nsp); 5629 cursor_to (f, vpos, nsp);
5630 delete_glyphs (osp - nsp); 5630 delete_glyphs (f, osp - nsp);
5631 } 5631 }
5632 else if (nsp > osp) 5632 else if (nsp > osp)
5633 { 5633 {
@@ -5636,12 +5636,12 @@ update_frame_line (f, vpos)
5636 must delete first to avoid losing data in the insert */ 5636 must delete first to avoid losing data in the insert */
5637 if (endmatch && nlen < olen + nsp - osp) 5637 if (endmatch && nlen < olen + nsp - osp)
5638 { 5638 {
5639 cursor_to (vpos, nlen - endmatch + osp - nsp); 5639 cursor_to (f, vpos, nlen - endmatch + osp - nsp);
5640 delete_glyphs (olen + nsp - osp - nlen); 5640 delete_glyphs (f, olen + nsp - osp - nlen);
5641 olen = nlen - (nsp - osp); 5641 olen = nlen - (nsp - osp);
5642 } 5642 }
5643 cursor_to (vpos, osp); 5643 cursor_to (f, vpos, osp);
5644 insert_glyphs (0, nsp - osp); 5644 insert_glyphs (f, 0, nsp - osp);
5645 } 5645 }
5646 olen += nsp - osp; 5646 olen += nsp - osp;
5647 5647
@@ -5662,8 +5662,8 @@ update_frame_line (f, vpos)
5662 unnecessary cursor movement. */ 5662 unnecessary cursor movement. */
5663 if (nlen - tem > 0) 5663 if (nlen - tem > 0)
5664 { 5664 {
5665 cursor_to (vpos, nsp + begmatch); 5665 cursor_to (f, vpos, nsp + begmatch);
5666 write_glyphs (nbody + nsp + begmatch, nlen - tem); 5666 write_glyphs (f, nbody + nsp + begmatch, nlen - tem);
5667 } 5667 }
5668 } 5668 }
5669 else if (nlen > olen) 5669 else if (nlen > olen)
@@ -5678,27 +5678,27 @@ update_frame_line (f, vpos)
5678 int out = olen - tem; /* Columns to be overwritten originally. */ 5678 int out = olen - tem; /* Columns to be overwritten originally. */
5679 int del; 5679 int del;
5680 5680
5681 cursor_to (vpos, nsp + begmatch); 5681 cursor_to (f, vpos, nsp + begmatch);
5682 5682
5683 /* Calculate columns we can actually overwrite. */ 5683 /* Calculate columns we can actually overwrite. */
5684 while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out])) 5684 while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
5685 out--; 5685 out--;
5686 write_glyphs (nbody + nsp + begmatch, out); 5686 write_glyphs (f, nbody + nsp + begmatch, out);
5687 5687
5688 /* If we left columns to be overwritten, we must delete them. */ 5688 /* If we left columns to be overwritten, we must delete them. */
5689 del = olen - tem - out; 5689 del = olen - tem - out;
5690 if (del > 0) 5690 if (del > 0)
5691 delete_glyphs (del); 5691 delete_glyphs (f, del);
5692 5692
5693 /* At last, we insert columns not yet written out. */ 5693 /* At last, we insert columns not yet written out. */
5694 insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del); 5694 insert_glyphs (f, nbody + nsp + begmatch + out, nlen - olen + del);
5695 olen = nlen; 5695 olen = nlen;
5696 } 5696 }
5697 else if (olen > nlen) 5697 else if (olen > nlen)
5698 { 5698 {
5699 cursor_to (vpos, nsp + begmatch); 5699 cursor_to (f, vpos, nsp + begmatch);
5700 write_glyphs (nbody + nsp + begmatch, nlen - tem); 5700 write_glyphs (f, nbody + nsp + begmatch, nlen - tem);
5701 delete_glyphs (olen - nlen); 5701 delete_glyphs (f, olen - nlen);
5702 olen = nlen; 5702 olen = nlen;
5703 } 5703 }
5704 } 5704 }
@@ -5707,8 +5707,8 @@ update_frame_line (f, vpos)
5707 /* If any unerased characters remain after the new line, erase them. */ 5707 /* If any unerased characters remain after the new line, erase them. */
5708 if (olen > nlen) 5708 if (olen > nlen)
5709 { 5709 {
5710 cursor_to (vpos, nlen); 5710 cursor_to (f, vpos, nlen);
5711 clear_end_of_line (olen); 5711 clear_end_of_line (f, olen);
5712 } 5712 }
5713 5713
5714 /* Exchange contents between current_frame and new_frame. */ 5714 /* Exchange contents between current_frame and new_frame. */
@@ -6275,9 +6275,7 @@ terminate any keyboard macro currently executing. */)
6275 if (noninteractive) 6275 if (noninteractive)
6276 putchar (07); 6276 putchar (07);
6277 else 6277 else
6278 ring_bell (); 6278 ring_bell (XFRAME (selected_frame));
6279 if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
6280 fflush (CURTTY ()->output);
6281 } 6279 }
6282 else 6280 else
6283 bitch_at_user (); 6281 bitch_at_user ();
@@ -6293,9 +6291,7 @@ bitch_at_user ()
6293 else if (!INTERACTIVE) /* Stop executing a keyboard macro. */ 6291 else if (!INTERACTIVE) /* Stop executing a keyboard macro. */
6294 error ("Keyboard macro terminated by a command ringing the bell"); 6292 error ("Keyboard macro terminated by a command ringing the bell");
6295 else 6293 else
6296 ring_bell (); 6294 ring_bell (XFRAME (selected_frame));
6297 if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
6298 fflush (CURTTY ()->output);
6299} 6295}
6300 6296
6301 6297
diff --git a/src/fileio.c b/src/fileio.c
index c0195558a3c..38b2cbd5b52 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -78,6 +78,8 @@ extern int errno;
78#include "charset.h" 78#include "charset.h"
79#include "coding.h" 79#include "coding.h"
80#include "window.h" 80#include "window.h"
81#include "frame.h"
82#include "dispextern.h"
81 83
82#ifdef WINDOWSNT 84#ifdef WINDOWSNT
83#define NOMINMAX 1 85#define NOMINMAX 1
@@ -5619,7 +5621,7 @@ auto_save_error (error)
5619 int i, nbytes; 5621 int i, nbytes;
5620 struct gcpro gcpro1; 5622 struct gcpro gcpro1;
5621 5623
5622 ring_bell (); 5624 ring_bell (XFRAME (selected_frame));
5623 5625
5624 args[0] = build_string ("Auto-saving %s: %s"); 5626 args[0] = build_string ("Auto-saving %s: %s");
5625 args[1] = current_buffer->name; 5627 args[1] = current_buffer->name;
diff --git a/src/scroll.c b/src/scroll.c
index 8f83851a2e0..5991fec004a 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -58,10 +58,12 @@ struct matrix_elt
58 unsigned char writecount; 58 unsigned char writecount;
59 }; 59 };
60 60
61static void do_direct_scrolling P_ ((struct glyph_matrix *, 61static void do_direct_scrolling P_ ((struct frame *,
62 struct glyph_matrix *,
62 struct matrix_elt *, 63 struct matrix_elt *,
63 int, int)); 64 int, int));
64static void do_scrolling P_ ((struct glyph_matrix *, 65static void do_scrolling P_ ((struct frame *,
66 struct glyph_matrix *,
65 struct matrix_elt *, 67 struct matrix_elt *,
66 int, int)); 68 int, int));
67 69
@@ -242,7 +244,8 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
242 of lines. */ 244 of lines. */
243 245
244static void 246static void
245do_scrolling (current_matrix, matrix, window_size, unchanged_at_top) 247do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
248 struct frame *frame;
246 struct glyph_matrix *current_matrix; 249 struct glyph_matrix *current_matrix;
247 struct matrix_elt *matrix; 250 struct matrix_elt *matrix;
248 int window_size; 251 int window_size;
@@ -309,12 +312,12 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
309 /* Set the terminal window, if not done already. */ 312 /* Set the terminal window, if not done already. */
310 if (! terminal_window_p) 313 if (! terminal_window_p)
311 { 314 {
312 set_terminal_window (window_size + unchanged_at_top); 315 set_terminal_window (frame, window_size + unchanged_at_top);
313 terminal_window_p = 1; 316 terminal_window_p = 1;
314 } 317 }
315 318
316 /* Delete lines on the terminal. */ 319 /* Delete lines on the terminal. */
317 ins_del_lines (j + unchanged_at_top, - p->deletecount); 320 ins_del_lines (frame, j + unchanged_at_top, - p->deletecount);
318 } 321 }
319 else 322 else
320 { 323 {
@@ -339,7 +342,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
339 /* Set the terminal window if not yet done. */ 342 /* Set the terminal window if not yet done. */
340 if (!terminal_window_p) 343 if (!terminal_window_p)
341 { 344 {
342 set_terminal_window (window_size + unchanged_at_top); 345 set_terminal_window (frame, window_size + unchanged_at_top);
343 terminal_window_p = 1; 346 terminal_window_p = 1;
344 } 347 }
345 348
@@ -348,7 +351,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
348 --queue; 351 --queue;
349 352
350 /* Do the deletion on the terminal. */ 353 /* Do the deletion on the terminal. */
351 ins_del_lines (queue->pos, queue->count); 354 ins_del_lines (frame, queue->pos, queue->count);
352 355
353 /* All lines in the range deleted become empty in the glyph 356 /* All lines in the range deleted become empty in the glyph
354 matrix. Assign to them glyph rows that are not retained. 357 matrix. Assign to them glyph rows that are not retained.
@@ -381,7 +384,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
381 CHECK_MATRIX (current_matrix); 384 CHECK_MATRIX (current_matrix);
382 385
383 if (terminal_window_p) 386 if (terminal_window_p)
384 set_terminal_window (0); 387 set_terminal_window (frame, 0);
385} 388}
386 389
387 390
@@ -652,8 +655,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
652 the cost matrix for this approach is constructed. */ 655 the cost matrix for this approach is constructed. */
653 656
654static void 657static void
655do_direct_scrolling (current_matrix, cost_matrix, window_size, 658do_direct_scrolling (frame, current_matrix, cost_matrix,
656 unchanged_at_top) 659 window_size, unchanged_at_top)
660 struct frame *frame;
657 struct glyph_matrix *current_matrix; 661 struct glyph_matrix *current_matrix;
658 struct matrix_elt *cost_matrix; 662 struct matrix_elt *cost_matrix;
659 int window_size; 663 int window_size;
@@ -744,9 +748,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
744 if (i > j) 748 if (i > j)
745 { 749 {
746 /* Immediately insert lines */ 750 /* Immediately insert lines */
747 set_terminal_window (i + unchanged_at_top); 751 set_terminal_window (frame, i + unchanged_at_top);
748 terminal_window_p = 1; 752 terminal_window_p = 1;
749 ins_del_lines (j - n_to_write + unchanged_at_top, i - j); 753 ins_del_lines (frame, j - n_to_write + unchanged_at_top, i - j);
750 } 754 }
751 else if (i < j) 755 else if (i < j)
752 { 756 {
@@ -776,9 +780,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
776 --queue; 780 --queue;
777 if (queue->count) 781 if (queue->count)
778 { 782 {
779 set_terminal_window (queue->window); 783 set_terminal_window (frame, queue->window);
780 terminal_window_p = 1; 784 terminal_window_p = 1;
781 ins_del_lines (queue->pos, queue->count); 785 ins_del_lines (frame, queue->pos, queue->count);
782 } 786 }
783 else 787 else
784 { 788 {
@@ -801,7 +805,7 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
801 copy_from, retained_p); 805 copy_from, retained_p);
802 806
803 if (terminal_window_p) 807 if (terminal_window_p)
804 set_terminal_window (0); 808 set_terminal_window (frame, 0);
805} 809}
806 810
807 811
@@ -827,7 +831,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
827 unchanged_at_bottom, 831 unchanged_at_bottom,
828 draw_cost, old_draw_cost, 832 draw_cost, old_draw_cost,
829 old_hash, new_hash, free_at_end); 833 old_hash, new_hash, free_at_end);
830 do_direct_scrolling (frame->current_matrix, 834 do_direct_scrolling (frame, frame->current_matrix,
831 matrix, window_size, unchanged_at_top); 835 matrix, window_size, unchanged_at_top);
832 } 836 }
833 else 837 else
@@ -835,7 +839,8 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
835 calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom, 839 calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom,
836 draw_cost, old_hash, new_hash, 840 draw_cost, old_hash, new_hash,
837 free_at_end); 841 free_at_end);
838 do_scrolling (frame->current_matrix, matrix, window_size, 842 do_scrolling (frame,
843 frame->current_matrix, matrix, window_size,
839 unchanged_at_top); 844 unchanged_at_top);
840 } 845 }
841} 846}
diff --git a/src/term.c b/src/term.c
index aeccdf285cb..13c8e036ea4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -171,11 +171,6 @@ int max_frame_cols;
171 171
172int max_frame_lines; 172int max_frame_lines;
173 173
174/* Frame currently being redisplayed; 0 if not currently redisplaying.
175 (Direct output does not count). */
176
177FRAME_PTR updating_frame;
178
179/* Non-zero if we have dropped our controlling tty and therefore 174/* Non-zero if we have dropped our controlling tty and therefore
180 should not open a frame on stdout. */ 175 should not open a frame on stdout. */
181static int no_controlling_tty; 176static int no_controlling_tty;
@@ -201,10 +196,8 @@ extern char *tgetstr ();
201#endif /* WINDOWSNT */ 196#endif /* WINDOWSNT */
202 197
203void 198void
204ring_bell () 199ring_bell (struct frame *f)
205{ 200{
206 struct frame *f = XFRAME (selected_frame);
207
208 if (!NILP (Vring_bell_function)) 201 if (!NILP (Vring_bell_function))
209 { 202 {
210 Lisp_Object function; 203 Lisp_Object function;
@@ -225,20 +218,20 @@ ring_bell ()
225 Vring_bell_function = function; 218 Vring_bell_function = function;
226 } 219 }
227 else if (FRAME_DISPLAY (f)->ring_bell_hook) 220 else if (FRAME_DISPLAY (f)->ring_bell_hook)
228 (*FRAME_DISPLAY (f)->ring_bell_hook) (); 221 (*FRAME_DISPLAY (f)->ring_bell_hook) (f);
229} 222}
230 223
231/* Ring the bell on a tty. */ 224/* Ring the bell on a tty. */
232 225
233void 226void
234tty_ring_bell () 227tty_ring_bell (struct frame *f)
235{ 228{
236 struct frame *f = XFRAME (selected_frame);
237 struct tty_display_info *tty = FRAME_TTY (f); 229 struct tty_display_info *tty = FRAME_TTY (f);
238 230
239 OUTPUT (tty, (tty->TS_visible_bell && visible_bell 231 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
240 ? tty->TS_visible_bell 232 ? tty->TS_visible_bell
241 : tty->TS_bell)); 233 : tty->TS_bell));
234 fflush (tty->output);
242} 235}
243 236
244/* Set up termcap modes for Emacs. */ 237/* Set up termcap modes for Emacs. */
@@ -282,7 +275,6 @@ void
282update_begin (f) 275update_begin (f)
283 struct frame *f; 276 struct frame *f;
284{ 277{
285 updating_frame = f;
286 if (FRAME_DISPLAY (f)->update_begin_hook) 278 if (FRAME_DISPLAY (f)->update_begin_hook)
287 (*FRAME_DISPLAY (f)->update_begin_hook) (f); 279 (*FRAME_DISPLAY (f)->update_begin_hook) (f);
288} 280}
@@ -293,7 +285,6 @@ update_end (f)
293{ 285{
294 if (FRAME_DISPLAY (f)->update_end_hook) 286 if (FRAME_DISPLAY (f)->update_end_hook)
295 (*FRAME_DISPLAY (f)->update_end_hook) (f); 287 (*FRAME_DISPLAY (f)->update_end_hook) (f);
296 updating_frame = NULL;
297} 288}
298 289
299/* Flag the end of a display update on a termcap display. */ 290/* Flag the end of a display update on a termcap display. */
@@ -315,36 +306,32 @@ tty_update_end (struct frame *f)
315 that is bounded by calls to update_begin and update_end. */ 306 that is bounded by calls to update_begin and update_end. */
316 307
317void 308void
318set_terminal_window (size) 309set_terminal_window (f, size)
310 struct frame *f;
319 int size; 311 int size;
320{ 312{
321 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
322
323 if (FRAME_DISPLAY (f)->set_terminal_window_hook) 313 if (FRAME_DISPLAY (f)->set_terminal_window_hook)
324 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (size); 314 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size);
325} 315}
326 316
327/* The implementation of set_terminal_window for termcap frames. */ 317/* The implementation of set_terminal_window for termcap frames. */
328 318
329void 319void
330tty_set_terminal_window (int size) 320tty_set_terminal_window (struct frame *f, int size)
331{ 321{
332 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
333
334 struct tty_display_info *tty = FRAME_TTY (f); 322 struct tty_display_info *tty = FRAME_TTY (f);
335 323
336 tty->specified_window = size ? size : FRAME_LINES (f); 324 tty->specified_window = size ? size : FRAME_LINES (f);
337 if (FRAME_SCROLL_REGION_OK (f)) 325 if (FRAME_SCROLL_REGION_OK (f))
338 set_scroll_region (0, tty->specified_window); 326 set_scroll_region (f, 0, tty->specified_window);
339} 327}
340 328
341void 329void
342set_scroll_region (start, stop) 330set_scroll_region (f, start, stop)
331 struct frame *f;
343 int start, stop; 332 int start, stop;
344{ 333{
345 char *buf; 334 char *buf;
346 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
347
348 struct tty_display_info *tty = FRAME_TTY (f); 335 struct tty_display_info *tty = FRAME_TTY (f);
349 336
350 if (tty->TS_set_scroll_region) 337 if (tty->TS_set_scroll_region)
@@ -463,20 +450,17 @@ highlight_if_desired (struct tty_display_info *tty)
463 frame-relative coordinates. */ 450 frame-relative coordinates. */
464 451
465void 452void
466cursor_to (vpos, hpos) 453cursor_to (f, vpos, hpos)
454 struct frame *f;
467 int vpos, hpos; 455 int vpos, hpos;
468{ 456{
469 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
470
471 if (FRAME_DISPLAY (f)->cursor_to_hook) 457 if (FRAME_DISPLAY (f)->cursor_to_hook)
472 (*FRAME_DISPLAY (f)->cursor_to_hook) (vpos, hpos); 458 (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos);
473} 459}
474 460
475void 461void
476tty_cursor_to (int vpos, int hpos) 462tty_cursor_to (struct frame *f, int vpos, int hpos)
477{ 463{
478 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
479
480 struct tty_display_info *tty = FRAME_TTY (f); 464 struct tty_display_info *tty = FRAME_TTY (f);
481 465
482 /* Detect the case where we are called from reset_sys_modes 466 /* Detect the case where we are called from reset_sys_modes
@@ -497,20 +481,17 @@ tty_cursor_to (int vpos, int hpos)
497/* Similar but don't take any account of the wasted characters. */ 481/* Similar but don't take any account of the wasted characters. */
498 482
499void 483void
500raw_cursor_to (row, col) 484raw_cursor_to (f, row, col)
485 struct frame *f;
501 int row, col; 486 int row, col;
502{ 487{
503 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
504
505 if (FRAME_DISPLAY (f)->raw_cursor_to_hook) 488 if (FRAME_DISPLAY (f)->raw_cursor_to_hook)
506 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (row, col); 489 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col);
507} 490}
508 491
509void 492void
510tty_raw_cursor_to (int row, int col) 493tty_raw_cursor_to (struct frame *f, int row, int col)
511{ 494{
512 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
513
514 struct tty_display_info *tty = FRAME_TTY (f); 495 struct tty_display_info *tty = FRAME_TTY (f);
515 496
516 if (curY (tty) == row 497 if (curY (tty) == row
@@ -527,21 +508,18 @@ tty_raw_cursor_to (int row, int col)
527 508
528/* Clear from cursor to end of frame. */ 509/* Clear from cursor to end of frame. */
529void 510void
530clear_to_end () 511clear_to_end (struct frame *f)
531{ 512{
532 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
533
534 if (FRAME_DISPLAY (f)->clear_to_end_hook) 513 if (FRAME_DISPLAY (f)->clear_to_end_hook)
535 (*FRAME_DISPLAY (f)->clear_to_end_hook) (); 514 (*FRAME_DISPLAY (f)->clear_to_end_hook) (f);
536} 515}
537 516
538/* Clear from cursor to end of frame on a termcap device. */ 517/* Clear from cursor to end of frame on a termcap device. */
539 518
540void 519void
541tty_clear_to_end (void) 520tty_clear_to_end (struct frame *f)
542{ 521{
543 register int i; 522 register int i;
544 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
545 struct tty_display_info *tty = FRAME_TTY (f); 523 struct tty_display_info *tty = FRAME_TTY (f);
546 524
547 if (tty->TS_clr_to_bottom) 525 if (tty->TS_clr_to_bottom)
@@ -553,8 +531,8 @@ tty_clear_to_end (void)
553 { 531 {
554 for (i = curY (tty); i < FRAME_LINES (f); i++) 532 for (i = curY (tty); i < FRAME_LINES (f); i++)
555 { 533 {
556 cursor_to (i, 0); 534 cursor_to (f, i, 0);
557 clear_end_of_line (FRAME_COLS (f)); 535 clear_end_of_line (f, FRAME_COLS (f));
558 } 536 }
559 } 537 }
560} 538}
@@ -562,21 +540,17 @@ tty_clear_to_end (void)
562/* Clear entire frame */ 540/* Clear entire frame */
563 541
564void 542void
565clear_frame () 543clear_frame (struct frame *f)
566{ 544{
567 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
568
569 if (FRAME_DISPLAY (f)->clear_frame_hook) 545 if (FRAME_DISPLAY (f)->clear_frame_hook)
570 (*FRAME_DISPLAY (f)->clear_frame_hook) (); 546 (*FRAME_DISPLAY (f)->clear_frame_hook) (f);
571} 547}
572 548
573/* Clear an entire termcap frame. */ 549/* Clear an entire termcap frame. */
574 550
575void 551void
576tty_clear_frame () 552tty_clear_frame (struct frame *f)
577{ 553{
578 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
579
580 struct tty_display_info *tty = FRAME_TTY (f); 554 struct tty_display_info *tty = FRAME_TTY (f);
581 555
582 if (tty->TS_clr_frame) 556 if (tty->TS_clr_frame)
@@ -587,8 +561,8 @@ tty_clear_frame ()
587 } 561 }
588 else 562 else
589 { 563 {
590 cursor_to (0, 0); 564 cursor_to (f, 0, 0);
591 clear_to_end (); 565 clear_to_end (f);
592 } 566 }
593} 567}
594 568
@@ -598,13 +572,12 @@ tty_clear_frame ()
598 Note that the cursor may be moved, on terminals lacking a `ce' string. */ 572 Note that the cursor may be moved, on terminals lacking a `ce' string. */
599 573
600void 574void
601clear_end_of_line (first_unused_hpos) 575clear_end_of_line (f, first_unused_hpos)
576 struct frame *f;
602 int first_unused_hpos; 577 int first_unused_hpos;
603{ 578{
604 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
605
606 if (FRAME_DISPLAY (f)->clear_end_of_line_hook) 579 if (FRAME_DISPLAY (f)->clear_end_of_line_hook)
607 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (first_unused_hpos); 580 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos);
608} 581}
609 582
610/* An implementation of clear_end_of_line for termcap frames. 583/* An implementation of clear_end_of_line for termcap frames.
@@ -612,10 +585,9 @@ clear_end_of_line (first_unused_hpos)
612 Note that the cursor may be moved, on terminals lacking a `ce' string. */ 585 Note that the cursor may be moved, on terminals lacking a `ce' string. */
613 586
614void 587void
615tty_clear_end_of_line (int first_unused_hpos) 588tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
616{ 589{
617 register int i; 590 register int i;
618 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
619 struct tty_display_info *tty = FRAME_TTY (f); 591 struct tty_display_info *tty = FRAME_TTY (f);
620 592
621 /* Detect the case where we are called from reset_sys_modes 593 /* Detect the case where we are called from reset_sys_modes
@@ -763,27 +735,24 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
763 Advance the nominal cursor over the text. */ 735 Advance the nominal cursor over the text. */
764 736
765void 737void
766write_glyphs (string, len) 738write_glyphs (f, string, len)
739 struct frame *f;
767 register struct glyph *string; 740 register struct glyph *string;
768 register int len; 741 register int len;
769{ 742{
770 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
771
772 if (FRAME_DISPLAY (f)->write_glyphs_hook) 743 if (FRAME_DISPLAY (f)->write_glyphs_hook)
773 (*FRAME_DISPLAY (f)->write_glyphs_hook) (string, len); 744 (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len);
774} 745}
775 746
776/* An implementation of write_glyphs for termcap frames. */ 747/* An implementation of write_glyphs for termcap frames. */
777 748
778void 749void
779tty_write_glyphs (struct glyph *string, int len) 750tty_write_glyphs (struct frame *f, struct glyph *string, int len)
780{ 751{
781 int produced, consumed; 752 int produced, consumed;
782 unsigned char conversion_buffer[1024]; 753 unsigned char conversion_buffer[1024];
783 int conversion_buffer_size = sizeof conversion_buffer; 754 int conversion_buffer_size = sizeof conversion_buffer;
784 755
785 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
786
787 struct tty_display_info *tty = FRAME_TTY (f); 756 struct tty_display_info *tty = FRAME_TTY (f);
788 757
789 turn_off_insert (tty); 758 turn_off_insert (tty);
@@ -873,27 +842,25 @@ tty_write_glyphs (struct glyph *string, int len)
873 If start is zero, insert blanks instead of a string at start */ 842 If start is zero, insert blanks instead of a string at start */
874 843
875void 844void
876insert_glyphs (start, len) 845insert_glyphs (f, start, len)
846 struct frame *f;
877 register struct glyph *start; 847 register struct glyph *start;
878 register int len; 848 register int len;
879{ 849{
880 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
881
882 if (len <= 0) 850 if (len <= 0)
883 return; 851 return;
884 852
885 if (FRAME_DISPLAY (f)->insert_glyphs_hook) 853 if (FRAME_DISPLAY (f)->insert_glyphs_hook)
886 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (start, len); 854 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len);
887} 855}
888 856
889/* An implementation of insert_glyphs for termcap frames. */ 857/* An implementation of insert_glyphs for termcap frames. */
890 858
891void 859void
892tty_insert_glyphs (struct glyph *start, int len) 860tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
893{ 861{
894 char *buf; 862 char *buf;
895 struct glyph *glyph = NULL; 863 struct glyph *glyph = NULL;
896 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
897 864
898 struct tty_display_info *tty = FRAME_TTY (f); 865 struct tty_display_info *tty = FRAME_TTY (f);
899 866
@@ -903,7 +870,7 @@ tty_insert_glyphs (struct glyph *start, int len)
903 OUTPUT1 (tty, buf); 870 OUTPUT1 (tty, buf);
904 xfree (buf); 871 xfree (buf);
905 if (start) 872 if (start)
906 write_glyphs (start, len); 873 write_glyphs (f, start, len);
907 return; 874 return;
908 } 875 }
909 876
@@ -972,23 +939,21 @@ tty_insert_glyphs (struct glyph *start, int len)
972/* Delete N glyphs at the nominal cursor position. */ 939/* Delete N glyphs at the nominal cursor position. */
973 940
974void 941void
975delete_glyphs (n) 942delete_glyphs (f, n)
943 struct frame *f;
976 register int n; 944 register int n;
977{ 945{
978 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
979
980 if (FRAME_DISPLAY (f)->delete_glyphs_hook) 946 if (FRAME_DISPLAY (f)->delete_glyphs_hook)
981 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (n); 947 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n);
982} 948}
983 949
984/* An implementation of delete_glyphs for termcap frames. */ 950/* An implementation of delete_glyphs for termcap frames. */
985 951
986void 952void
987tty_delete_glyphs (int n) 953tty_delete_glyphs (struct frame *f, int n)
988{ 954{
989 char *buf; 955 char *buf;
990 register int i; 956 register int i;
991 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
992 957
993 struct tty_display_info *tty = FRAME_TTY (f); 958 struct tty_display_info *tty = FRAME_TTY (f);
994 959
@@ -1018,22 +983,19 @@ tty_delete_glyphs (int n)
1018/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ 983/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */
1019 984
1020void 985void
1021ins_del_lines (vpos, n) 986ins_del_lines (f, vpos, n)
987 struct frame *f;
1022 int vpos, n; 988 int vpos, n;
1023{ 989{
1024 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1025
1026 if (FRAME_DISPLAY (f)->ins_del_lines_hook) 990 if (FRAME_DISPLAY (f)->ins_del_lines_hook)
1027 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (vpos, n); 991 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n);
1028} 992}
1029 993
1030/* An implementation of ins_del_lines for termcap frames. */ 994/* An implementation of ins_del_lines for termcap frames. */
1031 995
1032void 996void
1033tty_ins_del_lines (int vpos, int n) 997tty_ins_del_lines (struct frame *f, int vpos, int n)
1034{ 998{
1035 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1036
1037 struct tty_display_info *tty = FRAME_TTY (f); 999 struct tty_display_info *tty = FRAME_TTY (f);
1038 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 1000 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
1039 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; 1001 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
@@ -1075,7 +1037,7 @@ tty_ins_del_lines (int vpos, int n)
1075 } 1037 }
1076 else 1038 else
1077 { 1039 {
1078 set_scroll_region (vpos, tty->specified_window); 1040 set_scroll_region (f, vpos, tty->specified_window);
1079 if (n < 0) 1041 if (n < 0)
1080 raw_cursor_to (tty->specified_window - 1, 0); 1042 raw_cursor_to (tty->specified_window - 1, 0);
1081 else 1043 else
@@ -1083,15 +1045,15 @@ tty_ins_del_lines (int vpos, int n)
1083 background_highlight (tty); 1045 background_highlight (tty);
1084 while (--i >= 0) 1046 while (--i >= 0)
1085 OUTPUTL (tty, scroll, tty->specified_window - vpos); 1047 OUTPUTL (tty, scroll, tty->specified_window - vpos);
1086 set_scroll_region (0, tty->specified_window); 1048 set_scroll_region (f, 0, tty->specified_window);
1087 } 1049 }
1088 1050
1089 if (!FRAME_SCROLL_REGION_OK (f) 1051 if (!FRAME_SCROLL_REGION_OK (f)
1090 && FRAME_MEMORY_BELOW_FRAME (f) 1052 && FRAME_MEMORY_BELOW_FRAME (f)
1091 && n < 0) 1053 && n < 0)
1092 { 1054 {
1093 cursor_to (FRAME_LINES (f) + n, 0); 1055 cursor_to (f, FRAME_LINES (f) + n, 0);
1094 clear_to_end (); 1056 clear_to_end (f);
1095 } 1057 }
1096} 1058}
1097 1059
diff --git a/src/termhooks.h b/src/termhooks.h
index 49a0cbac85b..ba677e9c41d 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -329,26 +329,27 @@ struct display
329 329
330 /* Text display hooks. */ 330 /* Text display hooks. */
331 331
332 void (*cursor_to_hook) P_ ((int vpos, int hpos)); 332 void (*cursor_to_hook) P_ ((struct frame *f, int vpos, int hpos));
333 void (*raw_cursor_to_hook) P_ ((int, int)); 333 void (*raw_cursor_to_hook) P_ ((struct frame *, int, int));
334 334
335 void (*clear_to_end_hook) P_ ((void)); 335 void (*clear_to_end_hook) P_ ((struct frame *));
336 void (*clear_frame_hook) P_ ((void)); 336 void (*clear_frame_hook) P_ ((struct frame *));
337 void (*clear_end_of_line_hook) P_ ((int)); 337 void (*clear_end_of_line_hook) P_ ((struct frame *, int));
338 338
339 void (*ins_del_lines_hook) P_ ((int, int)); 339 void (*ins_del_lines_hook) P_ ((struct frame *f, int, int));
340 340
341 void (*insert_glyphs_hook) P_ ((struct glyph *s, int n)); 341 void (*insert_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
342 void (*write_glyphs_hook) P_ ((struct glyph *s, int n)); 342 void (*write_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
343 void (*delete_glyphs_hook) P_ ((int)); 343 void (*delete_glyphs_hook) P_ ((struct frame *, int));
344 344
345 void (*ring_bell_hook) P_ ((void)); 345 void (*ring_bell_hook) P_ ((struct frame *f));
346 346
347 void (*reset_terminal_modes_hook) P_ ((struct display *)); 347 void (*reset_terminal_modes_hook) P_ ((struct display *));
348 void (*set_terminal_modes_hook) P_ ((struct display *)); 348 void (*set_terminal_modes_hook) P_ ((struct display *));
349
349 void (*update_begin_hook) P_ ((struct frame *)); 350 void (*update_begin_hook) P_ ((struct frame *));
350 void (*update_end_hook) P_ ((struct frame *)); 351 void (*update_end_hook) P_ ((struct frame *));
351 void (*set_terminal_window_hook) P_ ((int)); 352 void (*set_terminal_window_hook) P_ ((struct frame *, int));
352 353
353 /* Multi-frame and mouse support hooks. */ 354 /* Multi-frame and mouse support hooks. */
354 355
@@ -548,7 +549,6 @@ extern struct display *display_list;
548#define FRAME_WINDOW_P(f) (0) 549#define FRAME_WINDOW_P(f) (0)
549#endif 550#endif
550 551
551
552extern struct display *create_display P_ ((void)); 552extern struct display *create_display P_ ((void));
553extern void delete_display P_ ((struct display *)); 553extern void delete_display P_ ((struct display *));
554 554
diff --git a/src/xdisp.c b/src/xdisp.c
index b2e26d0858a..16bdf7a8768 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13347,36 +13347,36 @@ try_window_id (w)
13347 { 13347 {
13348 /* Scroll last_unchanged_at_beg_row to the end of the 13348 /* Scroll last_unchanged_at_beg_row to the end of the
13349 window down dvpos lines. */ 13349 window down dvpos lines. */
13350 set_terminal_window (end); 13350 set_terminal_window (f, end);
13351 13351
13352 /* On dumb terminals delete dvpos lines at the end 13352 /* On dumb terminals delete dvpos lines at the end
13353 before inserting dvpos empty lines. */ 13353 before inserting dvpos empty lines. */
13354 if (!FRAME_SCROLL_REGION_OK (f)) 13354 if (!FRAME_SCROLL_REGION_OK (f))
13355 ins_del_lines (end - dvpos, -dvpos); 13355 ins_del_lines (f, end - dvpos, -dvpos);
13356 13356
13357 /* Insert dvpos empty lines in front of 13357 /* Insert dvpos empty lines in front of
13358 last_unchanged_at_beg_row. */ 13358 last_unchanged_at_beg_row. */
13359 ins_del_lines (from, dvpos); 13359 ins_del_lines (f, from, dvpos);
13360 } 13360 }
13361 else if (dvpos < 0) 13361 else if (dvpos < 0)
13362 { 13362 {
13363 /* Scroll up last_unchanged_at_beg_vpos to the end of 13363 /* Scroll up last_unchanged_at_beg_vpos to the end of
13364 the window to last_unchanged_at_beg_vpos - |dvpos|. */ 13364 the window to last_unchanged_at_beg_vpos - |dvpos|. */
13365 set_terminal_window (end); 13365 set_terminal_window (f, end);
13366 13366
13367 /* Delete dvpos lines in front of 13367 /* Delete dvpos lines in front of
13368 last_unchanged_at_beg_vpos. ins_del_lines will set 13368 last_unchanged_at_beg_vpos. ins_del_lines will set
13369 the cursor to the given vpos and emit |dvpos| delete 13369 the cursor to the given vpos and emit |dvpos| delete
13370 line sequences. */ 13370 line sequences. */
13371 ins_del_lines (from + dvpos, dvpos); 13371 ins_del_lines (f, from + dvpos, dvpos);
13372 13372
13373 /* On a dumb terminal insert dvpos empty lines at the 13373 /* On a dumb terminal insert dvpos empty lines at the
13374 end. */ 13374 end. */
13375 if (!FRAME_SCROLL_REGION_OK (f)) 13375 if (!FRAME_SCROLL_REGION_OK (f))
13376 ins_del_lines (end + dvpos, -dvpos); 13376 ins_del_lines (f, end + dvpos, -dvpos);
13377 } 13377 }
13378 13378
13379 set_terminal_window (0); 13379 set_terminal_window (f, 0);
13380 } 13380 }
13381 13381
13382 update_end (f); 13382 update_end (f);
diff --git a/src/xfns.c b/src/xfns.c
index 8528229c087..93de6ee4bfa 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1370,10 +1370,8 @@ x_set_tool_bar_lines (f, value, oldval)
1370 below the menu bar. */ 1370 below the menu bar. */
1371 if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0) 1371 if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
1372 { 1372 {
1373 updating_frame = f; 1373 clear_frame (f);
1374 clear_frame ();
1375 clear_current_matrices (f); 1374 clear_current_matrices (f);
1376 updating_frame = NULL;
1377 } 1375 }
1378 1376
1379 /* If the tool bar gets smaller, the internal border below it 1377 /* If the tool bar gets smaller, the internal border below it
diff --git a/src/xterm.c b/src/xterm.c
index 350c68ca20f..ea82a435b2b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -344,7 +344,7 @@ static void x_update_end P_ ((struct frame *));
344static void XTframe_up_to_date P_ ((struct frame *)); 344static void XTframe_up_to_date P_ ((struct frame *));
345static void XTset_terminal_modes P_ ((struct display *)); 345static void XTset_terminal_modes P_ ((struct display *));
346static void XTreset_terminal_modes P_ ((struct display *)); 346static void XTreset_terminal_modes P_ ((struct display *));
347static void x_clear_frame P_ ((void)); 347static void x_clear_frame P_ ((struct frame *));
348static void frame_highlight P_ ((struct frame *)); 348static void frame_highlight P_ ((struct frame *));
349static void frame_unhighlight P_ ((struct frame *)); 349static void frame_unhighlight P_ ((struct frame *));
350static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); 350static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
@@ -2747,7 +2747,8 @@ x_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
2747 for X frames. */ 2747 for X frames. */
2748 2748
2749static void 2749static void
2750x_delete_glyphs (n) 2750x_delete_glyphs (f, n)
2751 struct frame *f;
2751 register int n; 2752 register int n;
2752{ 2753{
2753 abort (); 2754 abort ();
@@ -2774,15 +2775,8 @@ x_clear_area (dpy, window, x, y, width, height, exposures)
2774 frame. Otherwise clear the selected frame. */ 2775 frame. Otherwise clear the selected frame. */
2775 2776
2776static void 2777static void
2777x_clear_frame () 2778x_clear_frame (struct frame *f)
2778{ 2779{
2779 struct frame *f;
2780
2781 if (updating_frame)
2782 f = updating_frame;
2783 else
2784 f = SELECTED_FRAME ();
2785
2786 /* Clearing the frame will erase any cursor, so mark them all as no 2780 /* Clearing the frame will erase any cursor, so mark them all as no
2787 longer visible. */ 2781 longer visible. */
2788 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); 2782 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
@@ -3032,7 +3026,8 @@ XTset_terminal_window (n)
3032 lines or deleting -N lines at vertical position VPOS. */ 3026 lines or deleting -N lines at vertical position VPOS. */
3033 3027
3034static void 3028static void
3035x_ins_del_lines (vpos, n) 3029x_ins_del_lines (f, vpos, n)
3030 struct frame *f;
3036 int vpos, n; 3031 int vpos, n;
3037{ 3032{
3038 abort (); 3033 abort ();