Commit e1d0bbc9 authored by Eli Zaretskii's avatar Eli Zaretskii

(Fframe_parameters): If a tty's frame's param_alist says

the colors are unspecified and reversed, reverse fore- and back-
ground in the returned value.
(Fframe_parameter): Ditto.
parent c3c98473
...@@ -2061,11 +2061,29 @@ If FRAME is omitted, return information on the currently selected frame.") ...@@ -2061,11 +2061,29 @@ If FRAME is omitted, return information on the currently selected frame.")
{ {
int fg = FRAME_FOREGROUND_PIXEL (f); int fg = FRAME_FOREGROUND_PIXEL (f);
int bg = FRAME_BACKGROUND_PIXEL (f); int bg = FRAME_BACKGROUND_PIXEL (f);
Lisp_Object elt;
store_in_alist (&alist, intern ("foreground-color"),
tty_color_name (f, fg)); /* If the frame's parameter alist says the colors are
store_in_alist (&alist, intern ("background-color"), unspecified and reversed, take the frame's background pixel
tty_color_name (f, bg)); for foreground and vice versa. */
elt = Fassq (Qforeground_color, alist);
if (!NILP (elt) && CONSP (elt)
&& STRINGP (XCDR (elt))
&& strncmp (XSTRING (XCDR (elt))->data,
unspecified_bg,
XSTRING (XCDR (elt))->size) == 0)
store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg));
else
store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
elt = Fassq (Qbackground_color, alist);
if (!NILP (elt) && CONSP (elt)
&& STRINGP (XCDR (elt))
&& strncmp (XSTRING (XCDR (elt))->data,
unspecified_fg,
XSTRING (XCDR (elt))->size) == 0)
store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg));
else
store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg));
store_in_alist (&alist, intern ("font"), store_in_alist (&alist, intern ("font"),
build_string (FRAME_MSDOS_P (f) build_string (FRAME_MSDOS_P (f)
? "ms-dos" ? "ms-dos"
...@@ -2134,9 +2152,6 @@ If FRAME is nil, describe the currently selected frame.") ...@@ -2134,9 +2152,6 @@ If FRAME is nil, describe the currently selected frame.")
value = Fassq (parameter, f->param_alist); value = Fassq (parameter, f->param_alist);
if (CONSP (value)) if (CONSP (value))
{ {
extern char unspecified_fg[], unspecified_bg[];
extern Lisp_Object Qbackground_color, Qforeground_color;
value = XCDR (value); value = XCDR (value);
/* Fframe_parameters puts the actual fg/bg color names, /* Fframe_parameters puts the actual fg/bg color names,
even if f->param_alist says otherwise. This is even if f->param_alist says otherwise. This is
...@@ -2144,16 +2159,27 @@ If FRAME is nil, describe the currently selected frame.") ...@@ -2144,16 +2159,27 @@ If FRAME is nil, describe the currently selected frame.")
"unspecified". We need to do the same here. */ "unspecified". We need to do the same here. */
if (STRINGP (value) && !FRAME_WINDOW_P (f)) if (STRINGP (value) && !FRAME_WINDOW_P (f))
{ {
if (EQ (parameter, Qbackground_color) char *color_name;
&& strncmp (XSTRING (value)->data, EMACS_INT csz;
unspecified_bg,
XSTRING (value)->size) == 0) if (EQ (parameter, Qbackground_color))
value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)); {
else if (EQ (parameter, Qforeground_color) color_name = XSTRING (value)->data;
&& strncmp (XSTRING (value)->data, csz = XSTRING (value)->size;
unspecified_fg, if (strncmp (color_name, unspecified_bg, csz) == 0)
XSTRING (value)->size) == 0) value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)); else if (strncmp (color_name, unspecified_fg, csz) == 0)
value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
}
else if (EQ (parameter, Qforeground_color))
{
color_name = XSTRING (value)->data;
csz = XSTRING (value)->size;
if (strncmp (color_name, unspecified_fg, csz) == 0)
value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
else if (strncmp (color_name, unspecified_bg, csz) == 0)
value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
}
} }
} }
else if (EQ (parameter, Qdisplay_type) else if (EQ (parameter, Qdisplay_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment