aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKaroly Lorentey2003-12-27 01:12:57 +0000
committerKaroly Lorentey2003-12-27 01:12:57 +0000
commit6548cf002c635f6799e2e127393128842be35632 (patch)
treefd4c575d43e456302e02f3bd042046730bd7ac8c /lib-src
parentce9d5d591d781613a3e3a7c4f43ab53bb0fe6637 (diff)
downloademacs-6548cf002c635f6799e2e127393128842be35632.tar.gz
emacs-6548cf002c635f6799e2e127393128842be35632.zip
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
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 2f0f45e1f59..14da37b1bb8 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -380,6 +380,7 @@ int tty_erase_char;
380int flow_control = 0; 380int flow_control = 0;
381int meta_key = 0; 381int meta_key = 0;
382char _sobuf[BUFSIZ]; 382char _sobuf[BUFSIZ];
383int emacs_pid;
383 384
384/* Adapted from init_sys_modes() in sysdep.c. */ 385/* Adapted from init_sys_modes() in sysdep.c. */
385int 386int
@@ -548,7 +549,7 @@ init_tty ()
548void 549void
549window_change () 550window_change ()
550{ 551{
551 int width, height; 552 int width = 0, height = 0;
552 553
553#ifdef TIOCGWINSZ 554#ifdef TIOCGWINSZ
554 { 555 {
@@ -601,6 +602,9 @@ window_change ()
601 } 602 }
602#endif /* not SunOS-style */ 603#endif /* not SunOS-style */
603#endif /* not BSD-style */ 604#endif /* not BSD-style */
605
606 if (width != 0 && height != 0)
607 kill (emacs_pid, SIGWINCH);
604} 608}
605 609
606int in_conversation = 0; 610int in_conversation = 0;
@@ -696,7 +700,7 @@ init_pty ()
696} 700}
697 701
698int 702int
699copy_from_to (int in, int out) 703copy_from_to (int in, int out, int sigio)
700{ 704{
701 static char buf[BUFSIZ]; 705 static char buf[BUFSIZ];
702 int nread = read (in, &buf, BUFSIZ); 706 int nread = read (in, &buf, BUFSIZ);
@@ -716,6 +720,11 @@ copy_from_to (int in, int out)
716 720
717 if (r < 0) 721 if (r < 0)
718 return 0; /* Error */ 722 return 0; /* Error */
723
724 if (sigio)
725 {
726 kill (emacs_pid, SIGIO);
727 }
719 } 728 }
720 return 1; 729 return 1;
721} 730}
@@ -744,13 +753,13 @@ pty_conversation ()
744 if (FD_ISSET (master, &set)) 753 if (FD_ISSET (master, &set))
745 { 754 {
746 /* Copy Emacs output to stdout. */ 755 /* Copy Emacs output to stdout. */
747 if (! copy_from_to (master, 0)) 756 if (! copy_from_to (master, 0, 0))
748 return 1; 757 return 1;
749 } 758 }
750 if (FD_ISSET (1, &set)) 759 if (FD_ISSET (1, &set))
751 { 760 {
752 /* Forward user input to Emacs. */ 761 /* Forward user input to Emacs. */
753 if (! copy_from_to (1, master)) 762 if (! copy_from_to (1, master, 1))
754 return 1; 763 return 1;
755 } 764 }
756 } 765 }
@@ -1078,6 +1087,18 @@ To start the server in Emacs, type \"M-x server-start\".\n",
1078 1087
1079 if (here) 1088 if (here)
1080 { 1089 {
1090 /* First of all, get the pid of the Emacs process.
1091 XXX Is there is some nifty libc/kernel feature for doing this?
1092 */
1093 str = fgets (string, BUFSIZ, in);
1094 emacs_pid = atoi (str);
1095 if (emacs_pid == 0)
1096 {
1097 reset_tty ();
1098 fprintf (stderr, "%s: Could not get process id of Emacs\n", argv[0]);
1099 fail (argc, argv);
1100 }
1101
1081 if (! pty_conversation ()) 1102 if (! pty_conversation ())
1082 { 1103 {
1083 reset_tty (); 1104 reset_tty ();