comparison 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
comparison
equal deleted inserted replaced
82988:f82e3a6f5ccb 82989:f3845715a5f6
542 #else 542 #else
543 #ifdef MAC_OS8 543 #ifdef MAC_OS8
544 make_mac_terminal_frame (f); 544 make_mac_terminal_frame (f);
545 #else 545 #else
546 { 546 {
547 struct tty_output *tty; 547 struct tty_display_info *tty;
548 f->output_method = output_termcap; 548 f->output_method = output_termcap;
549
550 f->output_data.tty = (struct tty_output *) xmalloc (sizeof (struct tty_output));
551 bzero (f->output_data.tty, sizeof (struct tty_output));
552
553 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
554 FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
549 555
550 if (initialized) 556 if (initialized)
551 { 557 {
552 /* Note that term_init may signal an error, but then it is its 558 /* Note that term_init may signal an error, but then it is its
553 responsibility to make sure this frame is deleted. */ 559 responsibility to make sure this frame is deleted. */
554 f->output_data.tty = term_init (frame, tty_name, tty_type); 560 f->output_data.tty->display_info = term_init (frame, tty_name, tty_type);
555 } 561 }
556 else 562 else
557 { 563 {
558 /* init_display() will reinitialize the terminal with correct values after dump. */ 564 /* init_display() will reinitialize the terminal with correct values after dump. */
559 f->output_data.tty = term_dummy_init (); 565 f->output_data.tty->display_info = term_dummy_init ();
560 } 566 }
567 FRAME_TTY (f)->reference_count++;
561 } 568 }
562 569
563 #ifdef CANNOT_DUMP 570 #ifdef CANNOT_DUMP
564 FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR; 571 FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR;
565 FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR; 572 FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR;
1388 x_destroy_window (f); 1395 x_destroy_window (f);
1389 #endif 1396 #endif
1390 1397
1391 if (FRAME_TERMCAP_P (f)) 1398 if (FRAME_TERMCAP_P (f))
1392 { 1399 {
1393 Lisp_Object tail, frame1;
1394 int delete = 1; 1400 int delete = 1;
1395 struct tty_output *tty = FRAME_TTY (f); 1401 struct tty_display_info *tty = FRAME_TTY (f);
1396 1402
1397 /* delete_tty will call us recursively, so better kill the 1403 if (! --tty->reference_count)
1398 frame now. */
1399 f->output_data.nothing = 0;
1400
1401 /* See if the terminal needs to be closed. */
1402 FOR_EACH_FRAME (tail, frame1)
1403 { 1404 {
1404 if (frame1 != frame 1405 /* delete_tty would call us recursively if we don't kill the
1405 && FRAME_LIVE_P (XFRAME (frame1)) 1406 frame now. */
1406 && FRAME_TERMCAP_P (XFRAME (frame1)) 1407 xfree (f->output_data.tty);
1407 && FRAME_TTY (XFRAME (frame1)) == FRAME_TTY (f)) 1408 f->output_data.nothing = 0;
1408 { 1409 delete_tty (tty);
1409 delete = 0;
1410 break;
1411 }
1412 } 1410 }
1413 if (delete)
1414 delete_tty (tty);
1415 } 1411 }
1416 else 1412 else
1417 { 1413 {
1418 f->output_data.nothing = 0; 1414 f->output_data.nothing = 0;
1419 } 1415 }