comparison src/keyboard.c @ 82990:2ecd1f669db9

Fixed X support, preliminary support for X-tty combo sessions. lib-src/emacsclient.c (copy_from_to, pty_conversation): Re-added SIGIO hack. (Sigh.) lisp/frame.el (make-frame-on-tty): Use make-terminal-frame, not make-frame. src/dispnew.c (line_hash_code, line_draw_cost): Updated to use the new display_method parameters. (Fredraw_frame): fflush the tty only if f is a termcap frame. (direct_output_for_insert): Updated to use the new display_method parameters. fflush the tty only if f is a termcap frame. (direct_output_forward_char, update_frame_1, scrolling): Ditto. (update_frame_line, Fding, bitch_at_user): Ditto. (Fsend_string_to_terminal): Fail if current frame is not on a tty. (init_display): Frame size change is safe here. src/frame.c (Vterminal_frame): Restored previously deleted variable. (syms_of_frame): Initialize it. (make_terminal_frame): Copy the frame's display_method from tty_display_info. (Fmake_terminal_frame): Enable simultaneous X and tty frames (buggy). (Fredirect_frame_focus): Don't call frame_rehighlight_hook if frame is on a termcap device. src/frame.h (struct frame): Renamed display to display_method. (Vterminal_frame): Re-added declaration. src/keyboard.c (flow_control): Moved to struct tty_display_info. (read_avail_input): Check ttys even if there is a read_socket_hook. (Fset_input_mode): Call reset_sys_modes/init_sys_modes and set flow_control or meta_key only when the frame is a termcap frame. (Fcurrent_input_mode): Handle flow_control and meta_key right on non-termcap frames. src/scroll.c (calculate_scrolling, calculate_direct_scrolling): Update to use the new display_method parameters. (scrolling_1, scroll_cost): Ditto. src/sysdep.c (init_sys_modes, reset_sys_modes): Always set the terminal parameters if tty_out->input is not stdin. Updated to the new location of flow_control. (hft_init): Moved HFT init code to term_init, as it needs the frame. src/term.c (tty_display_method_template): New variable. (update_begin): Added rif hack. (set_terminal_window, ins_del_lines, term_init): Updated to use the new display_method parameters. (insert_glyphs, ins_del_lines): Only call insert_glyphs_hook if the current frame is not on a tty. (calculate_costs): Don't calculate costs if not on a tty. (term_dummy_init): Fixed tty->output initialization. Preallocate Wcm and display_method. (term_init): Allocate & initialize display_method. Blindly fixed WINDOWSNT-specific parts. Added HFT-specific initialization exception from hft_init. (delete_tty): Only delete termcap frames. Free() the display_method. src/termchar.h (struct tty_display_info): Moved high-level terminal characteristics to struct display_method. Added flow_control and display_method members. src/termhooks.h (struct display_method): New struct (renamed from struct device). Added accessor macros. src/window.c (init_window_once): Initialize Vterminal_frame. src/xdisp.c (init_iterator, expose_frame): Added rif hack. (try_window_id): Updated to use the new display_method parameters. src/xfaces.c (realize_basic_faces): Don't call x_update_menu_appearance if the frame is a tty frame. src/xfns.c (Fx_create_frame): Added rif hack. Initialize display_method. (x_create_tip_frame): Initialize display_method. src/xterm.c (x_display_method): New variable. (x_flush, x_frame_of_widget, XTmouse_position): Ignore non-X frames. (x_window_to_scroll_bar, x_window_to_menu_bar): Ditto. (xim_destroy_callback, xim_instantiate_callback): Ditto. (frame_highlight, frame_unhighlight): Added rif hack. (x_initialize): Don't initialize rif. Do initialize x_display_method. src/xterm.h (x_display_method): New declaration. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-30
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 02 Jan 2004 01:15:26 +0000
parents f3845715a5f6
children 2b26656ff804
comparison
equal deleted inserted replaced
82989:f3845715a5f6 82990:2ecd1f669db9
614 Default is 1 if INTERRUPT_INPUT is defined. */ 614 Default is 1 if INTERRUPT_INPUT is defined. */
615 int interrupt_input; 615 int interrupt_input;
616 616
617 /* Nonzero while interrupts are temporarily deferred during redisplay. */ 617 /* Nonzero while interrupts are temporarily deferred during redisplay. */
618 int interrupts_deferred; 618 int interrupts_deferred;
619
620 /* Nonzero means use ^S/^Q for flow control. */
621 int flow_control;
622 619
623 /* Allow m- file to inhibit use of FIONREAD. */ 620 /* Allow m- file to inhibit use of FIONREAD. */
624 #ifdef BROKEN_FIONREAD 621 #ifdef BROKEN_FIONREAD
625 #undef FIONREAD 622 #undef FIONREAD
626 #endif 623 #endif
6603 EVENT_INIT (buf[i]); 6600 EVENT_INIT (buf[i]);
6604 6601
6605 if (read_socket_hook) 6602 if (read_socket_hook)
6606 /* No need for FIONREAD or fcntl; just say don't wait. */ 6603 /* No need for FIONREAD or fcntl; just say don't wait. */
6607 nread = (*read_socket_hook) (buf, KBD_BUFFER_SIZE, expected); 6604 nread = (*read_socket_hook) (buf, KBD_BUFFER_SIZE, expected);
6608 else 6605
6606 if (!nread && tty_list)
6609 { 6607 {
6610 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than 6608 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
6611 the kbd_buffer can really hold. That may prevent loss 6609 the kbd_buffer can really hold. That may prevent loss
6612 of characters on some systems when input is stuffed at us. */ 6610 of characters on some systems when input is stuffed at us. */
6613 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; 6611 unsigned char cbuf[KBD_BUFFER_SIZE - 1];
10431 stop_polling (); 10429 stop_polling ();
10432 #endif 10430 #endif
10433 10431
10434 #ifndef DOS_NT 10432 #ifndef DOS_NT
10435 /* this causes startup screen to be restored and messes with the mouse */ 10433 /* this causes startup screen to be restored and messes with the mouse */
10436 reset_sys_modes (CURTTY ()); 10434 if (FRAME_TERMCAP_P (SELECTED_FRAME ()))
10435 reset_sys_modes (CURTTY ());
10437 #endif 10436 #endif
10438 10437
10439 #ifdef SIGIO 10438 #ifdef SIGIO
10440 /* Note SIGIO has been undef'd if FIONREAD is missing. */ 10439 /* Note SIGIO has been undef'd if FIONREAD is missing. */
10441 if (read_socket_hook) 10440 if (read_socket_hook)
10457 /* Our VMS input only works by interrupts, as of now. */ 10456 /* Our VMS input only works by interrupts, as of now. */
10458 #ifdef VMS 10457 #ifdef VMS
10459 interrupt_input = 1; 10458 interrupt_input = 1;
10460 #endif 10459 #endif
10461 10460
10462 flow_control = !NILP (flow); 10461 if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
10463 if (NILP (meta)) 10462 {
10464 CURTTY ()->meta_key = 0; 10463 struct tty_display_info *tty = CURTTY ();
10465 else if (EQ (meta, Qt)) 10464 tty->flow_control = !NILP (flow);
10466 CURTTY ()->meta_key = 1; 10465 if (NILP (meta))
10467 else 10466 tty->meta_key = 0;
10468 CURTTY ()->meta_key = 2; 10467 else if (EQ (meta, Qt))
10468 tty->meta_key = 1;
10469 else
10470 tty->meta_key = 2;
10471 }
10472
10469 if (!NILP (quit)) 10473 if (!NILP (quit))
10470 /* Don't let this value be out of range. */ 10474 /* Don't let this value be out of range. */
10471 quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177); 10475 quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177);
10472 10476
10473 #ifndef DOS_NT 10477 #ifndef DOS_NT
10474 init_sys_modes (CURTTY ()); 10478 if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
10479 init_sys_modes (CURTTY ());
10475 #endif 10480 #endif
10476 10481
10477 #ifdef POLL_FOR_INPUT 10482 #ifdef POLL_FOR_INPUT
10478 poll_suppress_count = 1; 10483 poll_suppress_count = 1;
10479 start_polling (); 10484 start_polling ();
10496 The elements of this list correspond to the arguments of 10501 The elements of this list correspond to the arguments of
10497 `set-input-mode'. */) 10502 `set-input-mode'. */)
10498 () 10503 ()
10499 { 10504 {
10500 Lisp_Object val[4]; 10505 Lisp_Object val[4];
10501 10506 struct frame *sf = XFRAME (selected_frame);
10507
10502 val[0] = interrupt_input ? Qt : Qnil; 10508 val[0] = interrupt_input ? Qt : Qnil;
10503 val[1] = flow_control ? Qt : Qnil; 10509 if (FRAME_TERMCAP_P (sf))
10504 val[2] = FRAME_TTY (SELECTED_FRAME ())->meta_key == 2 10510 {
10505 ? make_number (0) 10511 val[1] = FRAME_TTY (sf)->flow_control ? Qt : Qnil;
10506 : FRAME_TTY (SELECTED_FRAME ())->meta_key == 1 ? Qt : Qnil; 10512 val[2] = FRAME_TTY (sf)->meta_key == 2
10513 ? make_number (0)
10514 : CURTTY ()->meta_key == 1 ? Qt : Qnil;
10515 }
10516 else
10517 {
10518 val[1] = Qnil;
10519 val[2] = Qt;
10520 }
10507 XSETFASTINT (val[3], quit_char); 10521 XSETFASTINT (val[3], quit_char);
10508 10522
10509 return Flist (sizeof (val) / sizeof (val[0]), val); 10523 return Flist (sizeof (val) / sizeof (val[0]), val);
10510 } 10524 }
10511 10525