diff src/frame.c @ 82989:f3845715a5f6

Separate frame-local, tty-dependent parameters from tty-local parameters. src/termchar.h (struct tty_output): Redefined to contain frame-local tty-dependent parameters. (Currently there are no such parameters, so it consists of the tty_display_info pointer.) (struct tty_display_info): New structure, with reference_count. (FRAME_TTY): Updated to reflect new termcap frame structure. src/term.c: Update prototypes. Use tty_display_info instead of tty_output. src/cm.c (current_tty, cmcheckmagic, cmcostinit, calccost, cmgoto, Wcm_clear) (Wcm_init): Use tty_display_info instead of tty_output. src/cm.h: Update prototypes. src/dispextern.h: Ditto. src/dispnew.c (window_change_signal, init_display, make_terminal_frame): Use tty_display_info instead of tty_output. src/frame.c (Fdelete_frame): Use tty_display_info instead of tty_output. Fix delete_tty check. (make_terminal_frame): Allocate f->output_data.tty. Increase reference count of tty device. (delete_frame): Free f->output_data.tty. Use reference count to decide if the tty should be closed. src/frame.h (FRAME_FOREGROUND_PIXEL, FRAME_BACKGROUND_PIXEL): New, unconditional definitions. (struct device): New declaration (at the moment, it is defined as empty in termhooks.h). (struct frame): Added display, background_pixel, foreground_pixel member. src/keyboard.c (read_avail_input): Use tty_display_info instead of tty_output. src/lisp.h: Declare struct display. Update prototypes. src/sysdep.c: Update prototypes. (discard_tty_input, init_all_sys_modes, init_sys_modes, reset_all_sys_modes) (reset_sys_modes, hft_init, hft_reset): Use tty_display_info instead of tty_output. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-29
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 01 Jan 2004 17:55:53 +0000
parents 1682917e56b4
children 2ecd1f669db9
line wrap: on
line diff
--- a/src/frame.c	Wed Dec 31 05:09:29 2003 +0000
+++ b/src/frame.c	Thu Jan 01 17:55:53 2004 +0000
@@ -544,20 +544,27 @@
   make_mac_terminal_frame (f);
 #else
   {
-    struct tty_output *tty;
+    struct tty_display_info *tty;
     f->output_method = output_termcap;
+
+    f->output_data.tty = (struct tty_output *) xmalloc (sizeof (struct tty_output));
+    bzero (f->output_data.tty, sizeof (struct tty_output));
+
+    FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
+    FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
     
     if (initialized)
       {
         /* Note that term_init may signal an error, but then it is its
            responsibility to make sure this frame is deleted. */
-        f->output_data.tty = term_init (frame, tty_name, tty_type);
+        f->output_data.tty->display_info = term_init (frame, tty_name, tty_type);
       }
     else
       {
         /* init_display() will reinitialize the terminal with correct values after dump. */
-        f->output_data.tty = term_dummy_init ();
+        f->output_data.tty->display_info = term_dummy_init ();
       }
+    FRAME_TTY (f)->reference_count++;
   }
   
 #ifdef CANNOT_DUMP
@@ -1390,28 +1397,17 @@
 
   if (FRAME_TERMCAP_P (f))
     {
-      Lisp_Object tail, frame1;
       int delete = 1;
-      struct tty_output *tty = FRAME_TTY (f);
-
-      /* delete_tty will call us recursively, so better kill the
-         frame now. */
-      f->output_data.nothing = 0;
-      
-      /* See if the terminal needs to be closed. */
-      FOR_EACH_FRAME (tail, frame1)
+      struct tty_display_info *tty = FRAME_TTY (f);
+
+      if (! --tty->reference_count)
         {
-          if (frame1 != frame
-              && FRAME_LIVE_P (XFRAME (frame1))
-              && FRAME_TERMCAP_P (XFRAME (frame1))
-              && FRAME_TTY (XFRAME (frame1)) == FRAME_TTY (f))
-            {
-              delete = 0;
-              break;
-            }
+          /* delete_tty would call us recursively if we don't kill the
+             frame now. */
+          xfree (f->output_data.tty);
+          f->output_data.nothing = 0;
+          delete_tty (tty);
         }
-      if (delete)
-        delete_tty (tty);
     }
   else
     {