comparison src/keyboard.c @ 82991:2b26656ff804

MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions. lib-src/emacsclient.c (pty_conversation): Fix errno check for read from fileno(in). src/config.in: Unconditionally define MULTI_KBOARD. src/frame.c (make_terminal_frame): Initialize f->kboard. src/keyboard.c (cmd_error_internal): Don't kill Emacs if a Quit was pressed on the tty of a X+tty session. (read_avail_input): Initialize nread to zero. Abort if there is no tty after a termcap read. (interrupt_signal)[USG]: Always reset signal handler. (init_keyboard): Always set signal handler for SIGINT/SIGQUIT if noninteractive. src/term.c (term_dummy_init): Initialize kboard to the initial_kboard. (term_init): Free component structures of the initial tty. Clear xmalloced structures. Moved rif initialization to syms_of_term. (term_init)[MULTI_KBOARD]: Initialize tty->kboard. (delete_tty)[MULTI_KBOARD]: Delete the keyboard. (syms_of_term): Initialize tty_display_method_template. src/termchar.h (tty_output)[MULTI_KBOARD]: Added kboard member. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-31
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 02 Jan 2004 02:54:17 +0000
parents 2ecd1f669db9
children 5de4189e659d
comparison
equal deleted inserted replaced
82990:2ecd1f669db9 82991:2b26656ff804
1203 if (!sf->glyphs_initialized_p 1203 if (!sf->glyphs_initialized_p
1204 /* This is the case of the frame dumped with Emacs, when we're 1204 /* This is the case of the frame dumped with Emacs, when we're
1205 running under a window system. */ 1205 running under a window system. */
1206 || (!NILP (Vwindow_system) 1206 || (!NILP (Vwindow_system)
1207 && !inhibit_window_system 1207 && !inhibit_window_system
1208 && FRAME_TERMCAP_P (sf)) 1208 && FRAME_TERMCAP_P (sf)
1209 && !FRAME_TTY (sf)->type) /* XXX This is ugly. */
1209 || noninteractive) 1210 || noninteractive)
1210 { 1211 {
1211 stream = Qexternal_debugging_output; 1212 stream = Qexternal_debugging_output;
1212 kill_emacs_p = 1; 1213 kill_emacs_p = 1;
1213 } 1214 }
6592 read_avail_input (expected) 6593 read_avail_input (expected)
6593 int expected; 6594 int expected;
6594 { 6595 {
6595 struct input_event buf[KBD_BUFFER_SIZE]; 6596 struct input_event buf[KBD_BUFFER_SIZE];
6596 register int i; 6597 register int i;
6597 int nread; 6598 int nread = 0;
6598 6599
6599 for (i = 0; i < KBD_BUFFER_SIZE; i++) 6600 for (i = 0; i < KBD_BUFFER_SIZE; i++)
6600 EVENT_INIT (buf[i]); 6601 EVENT_INIT (buf[i]);
6601 6602
6602 if (read_socket_hook) 6603 if (read_socket_hook)
6736 return 0; 6737 return 0;
6737 6738
6738 #endif /* not MSDOS */ 6739 #endif /* not MSDOS */
6739 #endif /* not WINDOWSNT */ 6740 #endif /* not WINDOWSNT */
6740 6741
6742 if (!tty)
6743 abort ();
6744
6741 /* Select frame corresponding to the active tty. Note that the 6745 /* Select frame corresponding to the active tty. Note that the
6742 value of selected_frame is not reliable here, redisplay tends 6746 value of selected_frame is not reliable here, redisplay tends
6743 to temporarily change it. But tty should always be non-NULL. */ 6747 to temporarily change it. But tty should always be non-NULL. */
6744 frame = (tty ? tty->top_frame : selected_frame); 6748 frame = tty->top_frame;
6745 6749
6746 for (i = 0; i < nread; i++) 6750 for (i = 0; i < nread; i++)
6747 { 6751 {
6748 buf[i].kind = ASCII_KEYSTROKE_EVENT; 6752 buf[i].kind = ASCII_KEYSTROKE_EVENT;
6749 buf[i].modifiers = 0; 6753 buf[i].modifiers = 0;
10243 /* Must preserve main program's value of errno. */ 10247 /* Must preserve main program's value of errno. */
10244 int old_errno = errno; 10248 int old_errno = errno;
10245 struct frame *sf = SELECTED_FRAME (); 10249 struct frame *sf = SELECTED_FRAME ();
10246 10250
10247 #if defined (USG) && !defined (POSIX_SIGNALS) 10251 #if defined (USG) && !defined (POSIX_SIGNALS)
10248 if (!read_socket_hook && NILP (Vwindow_system)) 10252 /* USG systems forget handlers when they are used;
10249 { 10253 must reestablish each time */
10250 /* USG systems forget handlers when they are used; 10254 signal (SIGINT, interrupt_signal);
10251 must reestablish each time */ 10255 signal (SIGQUIT, interrupt_signal);
10252 signal (SIGINT, interrupt_signal);
10253 signal (SIGQUIT, interrupt_signal);
10254 }
10255 #endif /* USG */ 10256 #endif /* USG */
10256 10257
10257 cancel_echoing (); 10258 cancel_echoing ();
10258 10259
10259 if (!NILP (Vquit_flag) 10260 if (!NILP (Vquit_flag)
10624 current_kboard = initial_kboard; 10625 current_kboard = initial_kboard;
10625 #endif 10626 #endif
10626 wipe_kboard (current_kboard); 10627 wipe_kboard (current_kboard);
10627 init_kboard (current_kboard); 10628 init_kboard (current_kboard);
10628 10629
10629 if (!noninteractive && !read_socket_hook && NILP (Vwindow_system)) 10630 if (!noninteractive)
10630 { 10631 {
10631 signal (SIGINT, interrupt_signal); 10632 signal (SIGINT, interrupt_signal);
10632 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 10633 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
10633 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and 10634 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
10634 SIGQUIT and we can't tell which one it will give us. */ 10635 SIGQUIT and we can't tell which one it will give us. */