diff src/sysdep.c @ 53232:22aaf1e5fbe6

Full support for multiple terminal I/O (with some rough edges). lib-src/emacsclient.c (emacs_pid): New variable. (window_change): Forward the SIGWINCH signal to the Emacs process after copying the size parameters to the proxy terminal. (copy_from_to): New parameter (sigio), kill Emacs with SIGIO if it is nonzero. (main): Set emacs_pid. lisp/server.el (server-process-filter): Send the pid of Emacs to emacsclient. src/cm.c: Added tty parameters to all functions and all Wcm macro calls. src/cm.h: Added tty parameters to all macros. Updated function prototypes. (Wcm): Moved to struct tty_output. src/dispextern.h: Updated function prototypes. src/dispnew.c: Added tty parameters to all Wcm macro calls. (do_switch_frame): Make old frame obscured, not invisible, to solve problems with other-frame. (Wcm): Moved to struct tty_output. src/keyboard.c (read_avail_input): Select the frame corresponding to the tty that was read. Slight rearrangement of tty loop. src/lisp.h (tabs_safe_p): Removed duplicate prototype. src/sysdep.c (hft_init, hft_reset): Added tty_output parameter. (discard_tty_input): Discard input from all ttys on APOLLO, too. Whatever it is. (narrow_foreground_group, widen_foreground_group): Added tty parameter (not really useful, the functions only work on the controlling tty.) (tabs_safe_p): Added tty parameter. src/term.c Added tty parameters to all Wcm macro calls. Standardised updating_frame vs. selected frame and tty_output access. (term_init): Allocate Wcm. (syms_of_term): Provide the `multi-tty' feature. src/termchar.h (struct tty_output): Added Wcm. src/xdisp.c (try_window_id): Make sure we use the tty device corresponding to the current frame. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-8
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 27 Dec 2003 01:12:57 +0000
parents e0c359b85b58
children fe9b37bee5f7
line wrap: on
line diff
--- a/src/sysdep.c	Fri Dec 26 04:31:27 2003 +0000
+++ b/src/sysdep.c	Sat Dec 27 01:12:57 2003 +0000
@@ -249,8 +249,8 @@
 void croak P_ ((char *));
 
 #ifdef AIXHFT
-void hft_init ();
-void hft_reset ();
+void hft_init P_ ((struct tty_output *));
+void hft_reset P_ ((struct tty_output *));
 #endif
 
 /* Temporary used by `sigblock' when defined in terms of signprocmask.  */
@@ -282,8 +282,12 @@
 #else /* not VMS */
 #ifdef APOLLO
   {
-    int zero = 0;
-    ioctl (fileno (TTY_INPUT (CURTTY())), TIOCFLUSH, &zero);
+    struct tty_output *tty;
+    for (tty = tty_list; tty; tty = tty->next)
+      {
+        int zero = 0;
+        ioctl (fileno (TTY_INPUT (tty)), TIOCFLUSH, &zero);
+      }
   }
 #else /* not Apollo */
 #ifdef MSDOS    /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
@@ -310,12 +314,7 @@
    the terminal.  */
 
 void
-#ifdef PROTOTYPES
 stuff_char (char c)
-#else
-stuff_char (c)
-     char c;
-#endif
 {
   if (read_socket_hook)
     return;
@@ -1074,22 +1073,23 @@
    group, redirect the TTY to point to our own process group.  We need
    to be in our own process group to receive SIGIO properly.  */
 void
-narrow_foreground_group ()
+narrow_foreground_group (struct tty_output *tty)
 {
   int me = getpid ();
 
   setpgrp (0, inherited_pgroup);
+  /* XXX This only works on the controlling tty. */
   if (inherited_pgroup != me)
-    EMACS_SET_TTY_PGRP (fileno (stdin), &me); /* stdin is intentional here */
+    EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &me);
   setpgrp (0, me);
 }
 
 /* Set the tty to our original foreground group.  */
 void
-widen_foreground_group ()
+widen_foreground_group (struct tty_output *tty)
 {
   if (inherited_pgroup != getpid ())
-    EMACS_SET_TTY_PGRP (fileno (stdin), &inherited_pgroup); /* stdin is intentional here */
+    EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &inherited_pgroup);
   setpgrp (0, inherited_pgroup);
 }
 
@@ -1353,7 +1353,7 @@
 
 #ifdef BSD_PGRPS
   if (! read_socket_hook && EQ (Vwindow_system, Qnil))
-    narrow_foreground_group ();
+    narrow_foreground_group (tty_out);
 #endif
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1578,7 +1578,7 @@
 #endif
 
 #ifdef AIXHFT
-      hft_init ();
+      hft_init (tty_out);
 #ifdef IBMR2AIX
       {
 	/* IBM's HFT device usually thinks a ^J should be LF/CR.  We need it
@@ -1678,12 +1678,12 @@
    At the time this is called, init_sys_modes has not been done yet.  */
 
 int
-tabs_safe_p ()
+tabs_safe_p (struct tty_output *tty)
 {
-  struct emacs_tty tty;
-
-  EMACS_GET_TTY (fileno (TTY_INPUT (CURTTY())), &tty);
-  return EMACS_TTY_TABS_OK (&tty);
+  struct emacs_tty etty;
+
+  EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &etty);
+  return EMACS_TTY_TABS_OK (&etty);
 }
 
 /* Get terminal size from system.
@@ -1888,7 +1888,7 @@
 #endif
 
 #ifdef BSD_PGRPS
-  widen_foreground_group ();
+  widen_foreground_group (tty_out);
 #endif
 }
 
@@ -5098,7 +5098,7 @@
 
 /* Called from init_sys_modes.  */
 void
-hft_init ()
+hft_init (struct tty_output *tty_out)
 {
   int junk;
 
@@ -5146,14 +5146,14 @@
   }
   /* The HFT system on AIX doesn't optimize for scrolling, so it's really ugly
      at times.  */
-  TTY_LINE_INS_DEL_OK (CURTTY ()) = 0;
-  TTY_CHAR_INS_DEL_OK (CURTTY ()) = 0;
+  TTY_LINE_INS_DEL_OK (tty_out) = 0;
+  TTY_CHAR_INS_DEL_OK (tty_out) = 0;
 }
 
 /* Reset the rubout key to backspace.  */
 
 void
-hft_reset ()
+hft_reset (struct tty_output *tty_out)
 {
   struct hfbuf buf;
   struct hfkeymap keymap;