Mercurial > emacs
comparison src/frame.c @ 26729:f5dded41adcc
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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 06 Dec 1999 16:54:09 +0000 |
parents | d39ec0a27081 |
children | 2344fab04513 |
comparison
equal
deleted
inserted
replaced
26728:8a531f428463 | 26729:f5dded41adcc |
---|---|
220 #include "keyboard.h" | 220 #include "keyboard.h" |
221 | 221 |
222 Lisp_Object Vemacs_iconified; | 222 Lisp_Object Vemacs_iconified; |
223 Lisp_Object Vframe_list; | 223 Lisp_Object Vframe_list; |
224 | 224 |
225 struct x_output tty_display; | |
226 | |
225 extern Lisp_Object Vminibuffer_list; | 227 extern Lisp_Object Vminibuffer_list; |
226 extern Lisp_Object get_minibuffer (); | 228 extern Lisp_Object get_minibuffer (); |
227 extern Lisp_Object Fhandle_switch_frame (); | 229 extern Lisp_Object Fhandle_switch_frame (); |
228 extern Lisp_Object Fredirect_frame_focus (); | 230 extern Lisp_Object Fredirect_frame_focus (); |
229 extern Lisp_Object x_get_focus_frame (); | 231 extern Lisp_Object x_get_focus_frame (); |
230 | 232 |
231 DEFUN ("framep", Fframep, Sframep, 1, 1, 0, | 233 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\ |
233 Value is t for a termcap frame (a character-only terminal),\n\ | 235 Value 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\ |
236 See also `frame-live-p'.") | 240 See also `frame-live-p'.") |
237 (object) | 241 (object) |
238 Lisp_Object object; | 242 Lisp_Object object; |
239 { | 243 { |
543 | 547 |
544 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ | 548 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ |
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; |
554 f->output_data.mac->foreground_pixel = 0; | 562 f->output_data.mac->foreground_pixel = 0; |
555 f->output_data.mac->n_param_faces = 0; | 563 f->output_data.mac->n_param_faces = 0; |
557 f->output_data.mac->size_computed_faces = 0; | 565 f->output_data.mac->size_computed_faces = 0; |
558 f->output_method = output_mac; | 566 f->output_method = output_mac; |
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 */ |
563 | 571 f->output_data.x = &tty_display; |
564 #ifndef MSDOS | 572 #endif /* !macintosh */ |
573 #endif /* MSDOS */ | |
574 | |
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 |
575 DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame, | 582 DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame, |
576 1, 1, 0, "Create an additional terminal frame.\n\ | 583 1, 1, 0, "Create an additional terminal frame.\n\ |
585 struct frame *f; | 592 struct frame *f; |
586 Lisp_Object frame, tem; | 593 Lisp_Object frame, tem; |
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 |
594 #ifdef macintosh | 602 #ifdef macintosh |
595 if (sf->output_method != output_mac) | 603 if (sf->output_method != output_mac) |
1992 | 2000 |
1993 if (!FRAME_LIVE_P (f)) | 2001 if (!FRAME_LIVE_P (f)) |
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)); |
2011 } | 2014 store_in_alist (&alist, intern ("font"), |
2012 store_in_alist (&alist, intern ("font"), build_string ("ms-dos")); | 2015 build_string (FRAME_MSDOS_P (f) |
2013 #endif | 2016 ? "ms-dos" |
2017 : FRAME_W32_P (f) ? "w32term" : "tty")); | |
2018 } | |
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)); |
2017 width = (FRAME_NEW_WIDTH (f) ? FRAME_NEW_WIDTH (f) : FRAME_WIDTH (f)); | 2022 width = (FRAME_NEW_WIDTH (f) ? FRAME_NEW_WIDTH (f) : FRAME_WIDTH (f)); |
2018 store_in_alist (&alist, Qwidth, make_number (width)); | 2023 store_in_alist (&alist, Qwidth, make_number (width)); |