changeset 32545:288723d38c06

(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.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 16 Oct 2000 19:15:09 +0000
parents 244478dd087e
children 9672c4db6bed
files src/frame.c
diffstat 1 files changed, 43 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/frame.c	Mon Oct 16 19:14:14 2000 +0000
+++ b/src/frame.c	Mon Oct 16 19:15:09 2000 +0000
@@ -2061,11 +2061,29 @@
     {
       int fg = FRAME_FOREGROUND_PIXEL (f);
       int bg = FRAME_BACKGROUND_PIXEL (f);
+      Lisp_Object elt;
 
-      store_in_alist (&alist, intern ("foreground-color"),
-		      tty_color_name (f, fg));
-      store_in_alist (&alist, intern ("background-color"),
-		      tty_color_name (f, bg));
+      /* If the frame's parameter alist says the colors are
+	 unspecified and reversed, take the frame's background pixel
+	 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"),
 		      build_string (FRAME_MSDOS_P (f)
 				    ? "ms-dos"
@@ -2134,9 +2152,6 @@
 	  value = Fassq (parameter, f->param_alist);
 	  if (CONSP (value))
 	    {
-	      extern char unspecified_fg[], unspecified_bg[];
-	      extern Lisp_Object Qbackground_color, Qforeground_color;
-
 	      value = XCDR (value);
 	      /* Fframe_parameters puts the actual fg/bg color names,
 		 even if f->param_alist says otherwise.  This is
@@ -2144,16 +2159,27 @@
 		 "unspecified".  We need to do the same here.  */
 	      if (STRINGP (value) && !FRAME_WINDOW_P (f))
 		{
-		  if (EQ (parameter, Qbackground_color)
-		      && strncmp (XSTRING (value)->data,
-				  unspecified_bg,
-				  XSTRING (value)->size) == 0)
-		    value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
-		  else if (EQ (parameter, Qforeground_color)
-			   && strncmp (XSTRING (value)->data,
-				       unspecified_fg,
-				       XSTRING (value)->size) == 0)
-		    value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
+		  char *color_name;
+		  EMACS_INT csz;
+
+		  if (EQ (parameter, Qbackground_color))
+		    {
+		      color_name = XSTRING (value)->data;
+		      csz = XSTRING (value)->size;
+		      if (strncmp (color_name, unspecified_bg, csz) == 0)
+			value = tty_color_name (f, FRAME_BACKGROUND_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)