diff src/term.c @ 83100:4970ad4995f5

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
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 16 Apr 2004 15:03:58 +0000
parents b448166f5664
children a330cf2446ad
line wrap: on
line diff
--- a/src/term.c	Fri Apr 16 13:36:07 2004 +0000
+++ b/src/term.c	Fri Apr 16 15:03:58 2004 +0000
@@ -171,11 +171,6 @@
 
 int max_frame_lines;
 
-/* Frame currently being redisplayed; 0 if not currently redisplaying.
-   (Direct output does not count).  */
-
-FRAME_PTR updating_frame;
-
 /* Non-zero if we have dropped our controlling tty and therefore
    should not open a frame on stdout. */
 static int no_controlling_tty;
@@ -201,10 +196,8 @@
 #endif /* WINDOWSNT */
 
 void
-ring_bell ()
+ring_bell (struct frame *f)
 {
-  struct frame *f = XFRAME (selected_frame);
-
   if (!NILP (Vring_bell_function))
     {
       Lisp_Object function;
@@ -225,20 +218,20 @@
       Vring_bell_function = function;
     }
   else if (FRAME_DISPLAY (f)->ring_bell_hook)
-    (*FRAME_DISPLAY (f)->ring_bell_hook) ();
+    (*FRAME_DISPLAY (f)->ring_bell_hook) (f);
 }
 
 /* Ring the bell on a tty. */
 
 void
-tty_ring_bell ()
+tty_ring_bell (struct frame *f)
 {
-  struct frame *f = XFRAME (selected_frame);
   struct tty_display_info *tty = FRAME_TTY (f);
 
   OUTPUT (tty, (tty->TS_visible_bell && visible_bell
                 ? tty->TS_visible_bell
                 : tty->TS_bell));
+  fflush (tty->output);
 }
 
 /* Set up termcap modes for Emacs. */
@@ -282,7 +275,6 @@
 update_begin (f)
      struct frame *f;
 {
-  updating_frame = f;
   if (FRAME_DISPLAY (f)->update_begin_hook)
     (*FRAME_DISPLAY (f)->update_begin_hook) (f);
 }
@@ -293,7 +285,6 @@
 {
   if (FRAME_DISPLAY (f)->update_end_hook)
     (*FRAME_DISPLAY (f)->update_end_hook) (f);
-  updating_frame = NULL;
 }
 
 /* Flag the end of a display update on a termcap display. */
@@ -315,36 +306,32 @@
    that is bounded by calls to update_begin and update_end.  */
 
 void
-set_terminal_window (size)
+set_terminal_window (f, size)
+     struct frame *f;
      int size;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->set_terminal_window_hook)
-    (*FRAME_DISPLAY (f)->set_terminal_window_hook) (size);
+    (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size);
 }
 
 /* The implementation of set_terminal_window for termcap frames. */
 
 void
-tty_set_terminal_window (int size)
+tty_set_terminal_window (struct frame *f, int size)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
 
   tty->specified_window = size ? size : FRAME_LINES (f);
   if (FRAME_SCROLL_REGION_OK (f))
-    set_scroll_region (0, tty->specified_window);
+    set_scroll_region (f, 0, tty->specified_window);
 }
 
 void
-set_scroll_region (start, stop)
+set_scroll_region (f, start, stop)
+     struct frame *f;
      int start, stop;
 {
   char *buf;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
 
   if (tty->TS_set_scroll_region)
@@ -463,20 +450,17 @@
    frame-relative coordinates.  */
 
 void
-cursor_to (vpos, hpos)
+cursor_to (f, vpos, hpos)
+     struct frame *f;
      int vpos, hpos;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->cursor_to_hook)
-    (*FRAME_DISPLAY (f)->cursor_to_hook) (vpos, hpos);
+    (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos);
 }
 
 void
-tty_cursor_to (int vpos, int hpos)
+tty_cursor_to (struct frame *f, int vpos, int hpos)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-  
   struct tty_display_info *tty = FRAME_TTY (f);
 
   /* Detect the case where we are called from reset_sys_modes
@@ -497,20 +481,17 @@
 /* Similar but don't take any account of the wasted characters.  */
 
 void
-raw_cursor_to (row, col)
+raw_cursor_to (f, row, col)
+     struct frame *f;
      int row, col;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->raw_cursor_to_hook)
-    (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (row, col);  
+    (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col);  
 }
 
 void
-tty_raw_cursor_to (int row, int col)
+tty_raw_cursor_to (struct frame *f, int row, int col)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
 
   if (curY (tty) == row
@@ -527,21 +508,18 @@
 
 /* Clear from cursor to end of frame. */
 void
-clear_to_end ()
+clear_to_end (struct frame *f)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->clear_to_end_hook)
-    (*FRAME_DISPLAY (f)->clear_to_end_hook) ();
+    (*FRAME_DISPLAY (f)->clear_to_end_hook) (f);
 }
 
 /* Clear from cursor to end of frame on a termcap device. */
 
 void
-tty_clear_to_end (void)
+tty_clear_to_end (struct frame *f)
 {
   register int i;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
   struct tty_display_info *tty = FRAME_TTY (f);
 
   if (tty->TS_clr_to_bottom)
@@ -553,8 +531,8 @@
     {
       for (i = curY (tty); i < FRAME_LINES (f); i++)
 	{
-	  cursor_to (i, 0);
-	  clear_end_of_line (FRAME_COLS (f));
+	  cursor_to (f, i, 0);
+	  clear_end_of_line (f, FRAME_COLS (f));
 	}
     }
 }
@@ -562,21 +540,17 @@
 /* Clear entire frame */
 
 void
-clear_frame ()
+clear_frame (struct frame *f)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->clear_frame_hook)
-    (*FRAME_DISPLAY (f)->clear_frame_hook) ();
+    (*FRAME_DISPLAY (f)->clear_frame_hook) (f);
 }
 
 /* Clear an entire termcap frame. */
 
 void
-tty_clear_frame ()
+tty_clear_frame (struct frame *f)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
 
   if (tty->TS_clr_frame)
@@ -587,8 +561,8 @@
     }
   else
     {
-      cursor_to (0, 0);
-      clear_to_end ();
+      cursor_to (f, 0, 0);
+      clear_to_end (f);
     }
 }
 
@@ -598,13 +572,12 @@
    Note that the cursor may be moved, on terminals lacking a `ce' string.  */
 
 void
-clear_end_of_line (first_unused_hpos)
+clear_end_of_line (f, first_unused_hpos)
+     struct frame *f;
      int first_unused_hpos;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->clear_end_of_line_hook)
-    (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (first_unused_hpos);
+    (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos);
 }
 
 /* An implementation of clear_end_of_line for termcap frames.
@@ -612,10 +585,9 @@
    Note that the cursor may be moved, on terminals lacking a `ce' string.  */
 
 void
-tty_clear_end_of_line (int first_unused_hpos)
+tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
 {
   register int i;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
   struct tty_display_info *tty = FRAME_TTY (f);
 
   /* Detect the case where we are called from reset_sys_modes
@@ -763,27 +735,24 @@
    Advance the nominal cursor over the text.  */
 
 void
-write_glyphs (string, len)
+write_glyphs (f, string, len)
+     struct frame *f;
      register struct glyph *string;
      register int len;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->write_glyphs_hook)
-    (*FRAME_DISPLAY (f)->write_glyphs_hook) (string, len);
+    (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len);
 }
 
 /* An implementation of write_glyphs for termcap frames. */
 
 void
-tty_write_glyphs (struct glyph *string, int len)
+tty_write_glyphs (struct frame *f, struct glyph *string, int len)
 {
   int produced, consumed;
   unsigned char conversion_buffer[1024];
   int conversion_buffer_size = sizeof conversion_buffer;
 
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
 
   turn_off_insert (tty);
@@ -873,27 +842,25 @@
    If start is zero, insert blanks instead of a string at start */
 
 void
-insert_glyphs (start, len)
+insert_glyphs (f, start, len)
+     struct frame *f;
      register struct glyph *start;
      register int len;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (len <= 0)
     return;
 
   if (FRAME_DISPLAY (f)->insert_glyphs_hook)
-    (*FRAME_DISPLAY (f)->insert_glyphs_hook) (start, len);
+    (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len);
 }
 
 /* An implementation of insert_glyphs for termcap frames. */
 
 void
-tty_insert_glyphs (struct glyph *start, int len)
+tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
 {
   char *buf;
   struct glyph *glyph = NULL;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
 
   struct tty_display_info *tty = FRAME_TTY (f);
 
@@ -903,7 +870,7 @@
       OUTPUT1 (tty, buf);
       xfree (buf);
       if (start)
-	write_glyphs (start, len);
+	write_glyphs (f, start, len);
       return;
     }
 
@@ -972,23 +939,21 @@
 /* Delete N glyphs at the nominal cursor position. */
 
 void
-delete_glyphs (n)
+delete_glyphs (f, n)
+     struct frame *f;
      register int n;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   if (FRAME_DISPLAY (f)->delete_glyphs_hook)
-    (*FRAME_DISPLAY (f)->delete_glyphs_hook) (n);
+    (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n);
 }
 
 /* An implementation of delete_glyphs for termcap frames. */
 
 void
-tty_delete_glyphs (int n)
+tty_delete_glyphs (struct frame *f, int n)
 {
   char *buf;
   register int i;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
 
   struct tty_display_info *tty = FRAME_TTY (f);
 
@@ -1018,22 +983,19 @@
 /* Insert N lines at vpos VPOS.  If N is negative, delete -N lines.  */
 
 void
-ins_del_lines (vpos, n)
+ins_del_lines (f, vpos, n)
+     struct frame *f;
      int vpos, n;
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-  
   if (FRAME_DISPLAY (f)->ins_del_lines_hook)
-    (*FRAME_DISPLAY (f)->ins_del_lines_hook) (vpos, n);
+    (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n);
 }
 
 /* An implementation of ins_del_lines for termcap frames. */
 
 void
-tty_ins_del_lines (int vpos, int n)
+tty_ins_del_lines (struct frame *f, int vpos, int n)
 {
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
-
   struct tty_display_info *tty = FRAME_TTY (f);
   char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
   char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
@@ -1075,7 +1037,7 @@
     }
   else
     {
-      set_scroll_region (vpos, tty->specified_window);
+      set_scroll_region (f, vpos, tty->specified_window);
       if (n < 0)
         raw_cursor_to (tty->specified_window - 1, 0);
       else
@@ -1083,15 +1045,15 @@
       background_highlight (tty);
       while (--i >= 0)
         OUTPUTL (tty, scroll, tty->specified_window - vpos);
-      set_scroll_region (0, tty->specified_window);
+      set_scroll_region (f, 0, tty->specified_window);
     }
   
   if (!FRAME_SCROLL_REGION_OK (f)
       && FRAME_MEMORY_BELOW_FRAME (f)
       && n < 0)
     {
-      cursor_to (FRAME_LINES (f) + n, 0);
-      clear_to_end ();
+      cursor_to (f, FRAME_LINES (f) + n, 0);
+      clear_to_end (f);
     }
 }