diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-03-18 18:05:28 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-03-18 18:05:28 +0000 |
commit | 95626e112bf3663c0900974609b4f1a0ab890aed (patch) | |
tree | 28e32309bfaf7df49b871b2558d4b03a099c7e95 | |
parent | 92182a70b3a7bf7a55b8b8e1c524051d35cf13ed (diff) | |
download | emacs-95626e112bf3663c0900974609b4f1a0ab890aed.tar.gz emacs-95626e112bf3663c0900974609b4f1a0ab890aed.tar.bz2 emacs-95626e112bf3663c0900974609b4f1a0ab890aed.zip |
(x_decode_color): Don't use cdef if defined_color failed.
-rw-r--r-- | src/xfns.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c index 6eebc7deb04..6f3be6d6966 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1069,11 +1069,13 @@ x_decode_color (f, arg, def) 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' |