From: Gerd Moellmann Date: Wed, 30 May 2001 15:30:19 +0000 (+0000) Subject: (enum image_value_type): New enumerator X-Git-Tag: emacs-pretest-21.0.104~348 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6f1be3b90ce4cf152f39d8c164deadbd7df2ff6c;p=emacs.git (enum image_value_type): New enumerator IMAGE_STRING_OR_NIL_VALUE. (parse_image_spec): Handle it. (xbm_format, pbm_format): Use it for :foreground and :background. (xbm_load, pbm_load): Check for nil color names. --- diff --git a/src/ChangeLog b/src/ChangeLog index 26ee254877a..86932ba4e9f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2001-05-30 Gerd Moellmann + * xfns.c (enum image_value_type): New enumerator + IMAGE_STRING_OR_NIL_VALUE. + (parse_image_spec): Handle it. + (xbm_format, pbm_format): Use it for :foreground and :background. + (xbm_load, pbm_load): Check for nil color names. + * xterm.c (note_mouse_highlight): If an overlapping overlay exists, but we find that we highlight the same overlay as before, don't do the highlighting again. diff --git a/src/xfns.c b/src/xfns.c index 485a2f9b4c7..53e7f090ef6 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5324,6 +5324,7 @@ enum image_value_type { IMAGE_DONT_CHECK_VALUE_TYPE, IMAGE_STRING_VALUE, + IMAGE_STRING_OR_NIL_VALUE, IMAGE_SYMBOL_VALUE, IMAGE_POSITIVE_INTEGER_VALUE, IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, @@ -5421,6 +5422,11 @@ parse_image_spec (spec, keywords, nkeywords, type) return 0; break; + case IMAGE_STRING_OR_NIL_VALUE: + if (!STRINGP (value) && !NILP (value)) + return 0; + break; + case IMAGE_SYMBOL_VALUE: if (!SYMBOLP (value)) return 0; @@ -6384,8 +6390,8 @@ static struct image_keyword xbm_format[XBM_LAST] = {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_VALUE, 0}, - {":background", IMAGE_STRING_VALUE, 0}, + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, {":ascent", IMAGE_ASCENT_VALUE, 0}, {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, {":relief", IMAGE_INTEGER_VALUE, 0}, @@ -6919,10 +6925,12 @@ xbm_load (f, img) } /* Get foreground and background colors, maybe allocate colors. */ - if (fmt[XBM_FOREGROUND].count) + if (fmt[XBM_FOREGROUND].count + && STRINGP (fmt[XBM_FOREGROUND].value)) foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, foreground); - if (fmt[XBM_BACKGROUND].count) + if (fmt[XBM_BACKGROUND].count + && STRINGP (fmt[XBM_BACKGROUND].value)) background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value, background); @@ -8110,8 +8118,8 @@ static struct image_keyword pbm_format[PBM_LAST] = {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, - {":foreground", IMAGE_STRING_VALUE, 0}, - {":background", IMAGE_STRING_VALUE, 0} + {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, + {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; /* Structure describing the image type `pbm'. */ @@ -8309,9 +8317,11 @@ pbm_load (f, img) parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); /* Get foreground and background colors, maybe allocate colors. */ - if (fmt[PBM_FOREGROUND].count) + if (fmt[PBM_FOREGROUND].count + && STRINGP (fmt[PBM_FOREGROUND].value)) fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); - if (fmt[PBM_BACKGROUND].count) + if (fmt[PBM_BACKGROUND].count + && STRINGP (fmt[PBM_BACKGROUND].value)) bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); for (y = 0; y < height; ++y)