From ff12cd1d433d4344d6f0496c92e92a3e497700f9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 2 Mar 2001 13:31:52 +0000 Subject: [PATCH] (Fmsdos_remember_default_colors): If default-frame-alist specifies (reverse . t), reverse the initial screen colors. (IT_set_frame_parameters): If the property is foreground-color, but we are reversing the colors, set bg_set, not fg_set. Likewise for setting background-color and reversing: set fg_set. Set unspecified-fg and unspecified-bg correctly when (reverse . t) is in effect. --- src/msdos.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/msdos.c b/src/msdos.c index 6312d5dc2c0..ad7d8b13032 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2312,8 +2312,20 @@ DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors, CHECK_FRAME (frame, 0); f= XFRAME (frame); - initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); - initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); + /* This function is called after applying default-frame-alist to the + initial frame. At that time, if reverse-colors option was + specified in default-frame-alist, it was already applied, and + frame colors are reversed. We need to account for that. */ + if (EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt)) + { + initial_screen_colors[0] = FRAME_BACKGROUND_PIXEL (f); + initial_screen_colors[1] = FRAME_FOREGROUND_PIXEL (f); + } + else + { + initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); + initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); + } } void @@ -2415,14 +2427,15 @@ IT_set_frame_parameters (f, alist) Finternal_set_lisp_face_attribute (Qdefault, QCbackground, val, frame); prop = Qbackground_color; + bg_set = 1; } else { Finternal_set_lisp_face_attribute (Qdefault, QCforeground, val, frame); + fg_set = 1; } redraw = 1; - fg_set = 1; if (termscript) fprintf (termscript, "\n", new_color); } @@ -2445,14 +2458,15 @@ IT_set_frame_parameters (f, alist) Finternal_set_lisp_face_attribute (Qdefault, QCforeground, val, frame); prop = Qforeground_color; + fg_set = 1; } else { Finternal_set_lisp_face_attribute (Qdefault, QCbackground, val, frame); + bg_set = 1; } redraw = 1; - bg_set = 1; if (termscript) fprintf (termscript, "\n", new_color); } @@ -2483,19 +2497,17 @@ IT_set_frame_parameters (f, alist) if (!fg_set) { XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCbackground, - tty_color_name (f, orig_fg), + Finternal_set_lisp_face_attribute (Qdefault, QCforeground, + tty_color_name (f, orig_bg), frame); - store_frame_param (f, Qbackground_color, frame_fg); redraw = 1; } if (!bg_set) { XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCforeground, - tty_color_name (f, orig_bg), + Finternal_set_lisp_face_attribute (Qdefault, QCbackground, + tty_color_name (f, orig_fg), frame); - store_frame_param (f, Qforeground_color, frame_bg); redraw = 1; } } -- 2.39.5