aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.c
diff options
context:
space:
mode:
authorEli Zaretskii1999-12-06 16:54:09 +0000
committerEli Zaretskii1999-12-06 16:54:09 +0000
commit2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f (patch)
treefa1366f693555a3ec65273f478ed95babf1bd0a9 /src/frame.c
parentf6737cde3e786b0e8acea4b613aa42cf49fa204c (diff)
downloademacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.tar.gz
emacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.zip
Changes for automatic remapping of X colors on terminal frames:
* xfaces.c (XColor) [!HAVE_X_WINDOWS]: Provide a typedef for non-X frames. (Vface_tty_color_alist): Remove. (tty_defined_color): New function. (defined_color): Rewrite to support any type of frame. (tty_color_name): New function. (face_color_supported_p, Fface_color_gray_p, Fface_color_supported_p): Support non-X frames. (load_color): Enclose the color name in quotes, in the log messages. Remove DOS-specific version of load_color. (realize_tty_face): Take the supported colors from tty-color-alist. Support translation of X colors to the closest tty color, for both MSDOS and tty frames. [MSDOS]: Don't invert face colors if they were taken from the frame colors. (Fface_register_tty_color, Fface_clear_tty_colors): Remove. * frame.h (struct x_output) [!MSDOS, !WINDOWSNT, !HAVE_X_WINDOWS]: Define a mostly empty surrogate. (tty_display): Declare. * frame.c (make_terminal_frame) [!macintosh]: Don't use tty_display. (Fframe_parameters): Don't invert colors of non-FRAME_WINDOW_P frames when the frame's param_alist includes 'reverse. (tty_display): Define. (make_terminal_frame) [!MSDOS]: Assign &tty_display to the output_data.x member. (Fframe_parameters): Return foreground and background color names on tty frames as well, in addition to MSDOS frames. * msdos.h (DisplayWidth, DisplayHeight): Changes for Lisp_Object selected_frame. (struct x_output): Remove unused members; document who uses each member. (FRAME_PARAM_FACES, FRAME_N_PARAM_FACES, FRAME_DEFAULT_PARAM_FACE, FRAME_MODE_LINE_PARAM_FACE, FRAME_COMPUTED_FACES, FRAME_N_COMPUTED_FACES, FRAME_SIZE_COMPUTED_FACES, FRAME_DEFAULT_FACE, FRAME_MODE_LINE_FACE, unload_color): Remove unused macro definintions. * msdos.c (IT_set_frame_parameters): Don't call recompute_basic_faces, the next redisplay will, anyway. (x_current_display): Remove unused variable. Many functions: changes for Lisp_object selected_frame. (IT_set_face): If the tty_reverse_p flag is set for the face, reverse the foreground and background colors. (Fmsdos_remember_default_colors): New function. (syms_of_msdos): Defsubr it. (IT_set_frame_parameters): Use initial_screen_colors[] when creating a new frame. If the frame parameters include 'reverse, swap the foreground and background colors. (internal_terminal_init): Initialize initial_screen_colors to -1. (syms_of_msdos): Add DEFVAR_BOOL for x-stretch-cursor, to shut up cus-start.el. * Makefile.in (lisp, shortlisp): Add lisp/term/tty-colors.elc. * xfns.c (x_defined_color): Rename from defined_color. All callers changed. (Fxw_color_defined_p): Renamed from Fx_color_defined_p; all callers changed. (Fxw_color_values): Renamed from Fx_color_values; all callers changed. (Fxw_display_color_p): Renamed from Fx_display_color_p; all callers changed. (x_window_to_frame, x_any_window_to_frame, x_non_menubar_window_to_frame, x_menubar_window_to_frame, x_top_window_to_frame): Use !FRAME_X_P instead of f->output_data.nothing. * xterm.h (x_defined_color): Rename from defined_color. * w32fns.c (x_window_to_frame): Use FRAME_W32_P instead of f->output_data.nothing. (Fxw_color_defined_p): Renamed from Fx_color_defined_p; all callers changed. (Fxw_color_values): Renamed from Fx_color_values; all callers changed. (Fxw_display_color_p): Renamed from Fx_display_color_p; all callers changed. * dispextern.h (tty_color_name): Add prototype. * xmenu.c (menubar_id_to_frame): Use FRAME_WINDOW_P instead of f->output_data.nothing. * w32menu.c (menubar_id_to_frame): Likewise. * w32term.h (w32_output): Declare. * dosfns.c (Qmsdos_color_translate): Remove. (msdos_stdcolor_name): Now returns a Lisp_Object. * dosfns.h (Qmsdos_color_translate): Remove. * s/msdos.h (INTERNAL_TERMINAL): Add entries for color support.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/frame.c b/src/frame.c
index 8298a01aa17..aaaf03add34 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -222,6 +222,8 @@ set_menu_bar_lines (f, value, oldval)
222Lisp_Object Vemacs_iconified; 222Lisp_Object Vemacs_iconified;
223Lisp_Object Vframe_list; 223Lisp_Object Vframe_list;
224 224
225struct x_output tty_display;
226
225extern Lisp_Object Vminibuffer_list; 227extern Lisp_Object Vminibuffer_list;
226extern Lisp_Object get_minibuffer (); 228extern Lisp_Object get_minibuffer ();
227extern Lisp_Object Fhandle_switch_frame (); 229extern Lisp_Object Fhandle_switch_frame ();
@@ -232,6 +234,8 @@ DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
232 "Return non-nil if OBJECT is a frame.\n\ 234 "Return non-nil if OBJECT is a frame.\n\
233Value is t for a termcap frame (a character-only terminal),\n\ 235Value is t for a termcap frame (a character-only terminal),\n\
234`x' for an Emacs frame that is really an X window,\n\ 236`x' for an Emacs frame that is really an X window,\n\
237`w32' for an Emacs frame that is a window on MS-Windows display,\n\
238`mac' for an Emacs frame on a Macintosh display,\n\
235`pc' for a direct-write MS-DOS frame.\n\ 239`pc' for a direct-write MS-DOS frame.\n\
236See also `frame-live-p'.") 240See also `frame-live-p'.")
237 (object) 241 (object)
@@ -545,9 +549,13 @@ make_terminal_frame ()
545 f->async_visible = 1; /* Don't let visible be cleared later. */ 549 f->async_visible = 1; /* Don't let visible be cleared later. */
546#ifdef MSDOS 550#ifdef MSDOS
547 f->output_data.x = &the_only_x_display; 551 f->output_data.x = &the_only_x_display;
548 f->output_method = output_msdos_raw; 552 if (!inhibit_window_system
549#endif /* MSDOS */ 553 && (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))
550 554 || XFRAME (selected_frame)->output_method == output_msdos_raw))
555 f->output_method = output_msdos_raw;
556 else
557 f->output_method = output_termcap;
558#else
551#ifdef macintosh 559#ifdef macintosh
552 f->output_data.mac = NewMacWindow(f); 560 f->output_data.mac = NewMacWindow(f);
553 f->output_data.mac->background_pixel = 0xffffff; 561 f->output_data.mac->background_pixel = 0xffffff;
@@ -559,16 +567,15 @@ make_terminal_frame ()
559 f->auto_raise = 1; 567 f->auto_raise = 1;
560 f->auto_lower = 1; 568 f->auto_lower = 1;
561 init_frame_faces (f); 569 init_frame_faces (f);
562#endif /* macintosh */ 570#else /* !macintosh */
571 f->output_data.x = &tty_display;
572#endif /* !macintosh */
573#endif /* MSDOS */
563 574
564#ifndef MSDOS
565#ifndef macintosh 575#ifndef macintosh
566 f->output_data.nothing = 1; /* Nonzero means frame isn't deleted. */
567#endif
568#endif
569
570 if (!noninteractive) 576 if (!noninteractive)
571 init_frame_faces (f); 577 init_frame_faces (f);
578#endif
572 return f; 579 return f;
573} 580}
574 581
@@ -587,7 +594,8 @@ Note that changing the size of one terminal frame automatically affects all.")
587 struct frame *sf = SELECTED_FRAME (); 594 struct frame *sf = SELECTED_FRAME ();
588 595
589#ifdef MSDOS 596#ifdef MSDOS
590 if (sf->output_method != output_msdos_raw) 597 if (sf->output_method != output_msdos_raw
598 && sf->output_method != output_termcap)
591 abort (); 599 abort ();
592#else /* not MSDOS */ 600#else /* not MSDOS */
593 601
@@ -1994,23 +2002,20 @@ If FRAME is omitted, return information on the currently selected frame.")
1994 return Qnil; 2002 return Qnil;
1995 2003
1996 alist = Fcopy_alist (f->param_alist); 2004 alist = Fcopy_alist (f->param_alist);
1997#ifdef MSDOS 2005 if (!FRAME_WINDOW_P (f))
1998 if (FRAME_MSDOS_P (f))
1999 { 2006 {
2000 int fg = FRAME_FOREGROUND_PIXEL (f); 2007 int fg = FRAME_FOREGROUND_PIXEL (f);
2001 int bg = FRAME_BACKGROUND_PIXEL (f); 2008 int bg = FRAME_BACKGROUND_PIXEL (f);
2002 Lisp_Object qreverse = intern ("reverse");
2003 int rv =
2004 !NILP (Fassq (qreverse, alist))
2005 || !NILP (Fassq (qreverse, Vdefault_frame_alist));
2006 2009
2007 store_in_alist (&alist, intern ("foreground-color"), 2010 store_in_alist (&alist, intern ("foreground-color"),
2008 build_string (msdos_stdcolor_name (rv ? bg : fg))); 2011 tty_color_name (f, fg));
2009 store_in_alist (&alist, intern ("background-color"), 2012 store_in_alist (&alist, intern ("background-color"),
2010 build_string (msdos_stdcolor_name (rv ? fg : bg))); 2013 tty_color_name (f, bg));
2014 store_in_alist (&alist, intern ("font"),
2015 build_string (FRAME_MSDOS_P (f)
2016 ? "ms-dos"
2017 : FRAME_W32_P (f) ? "w32term" : "tty"));
2011 } 2018 }
2012 store_in_alist (&alist, intern ("font"), build_string ("ms-dos"));
2013#endif
2014 store_in_alist (&alist, Qname, f->name); 2019 store_in_alist (&alist, Qname, f->name);
2015 height = (FRAME_NEW_HEIGHT (f) ? FRAME_NEW_HEIGHT (f) : FRAME_HEIGHT (f)); 2020 height = (FRAME_NEW_HEIGHT (f) ? FRAME_NEW_HEIGHT (f) : FRAME_HEIGHT (f));
2016 store_in_alist (&alist, Qheight, make_number (height)); 2021 store_in_alist (&alist, Qheight, make_number (height));