changeset 11060:0a7048d331e6

(x_decode_color): Don't use cdef if defined_color failed.
author Richard M. Stallman <rms@gnu.org>
date Sat, 18 Mar 1995 18:05:28 +0000
parents 43a05391e3e1
children 2f41090c58b3
files src/xfns.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Sat Mar 18 07:14:50 1995 +0000
+++ b/src/xfns.c	Sat Mar 18 18:05:28 1995 +0000
@@ -1069,11 +1069,13 @@
   if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1)
     return def;
 
-  /* Ignore the return value of defined_color so that
-     we use a color close to the one requested
-     if we can't get the exact request.  */
-  defined_color (f, XSTRING (arg)->data, &cdef, 1);
-  return cdef.pixel;
+  /* defined_color is responsible for coping with failures
+     by looking for a near-miss.  */
+  if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
+    return cdef.pixel;
+
+  /* defined_color failed; return an ultimate default.  */
+  return def;
 }
 
 /* Functions called only from `x_set_frame_param'