also accept the short hexadecimal notation (3 hex digits).

2004-07-27  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcolorhexentry.c (gimp_color_hex_entry_events):
	also accept the short hexadecimal notation (3 hex digits).
This commit is contained in:
Sven Neumann
2004-07-26 22:30:35 +00:00
committed by Sven Neumann
parent 2fbf203a47
commit 095a0d0e8f
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-07-27 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpcolorhexentry.c (gimp_color_hex_entry_events):
also accept the short hexadecimal notation (3 hex digits).
2004-07-26 Sven Neumann <sven@gimp.org> 2004-07-26 Sven Neumann <sven@gimp.org>
* libgimpwidgets/Makefile.am (libgimpwidgetsinclude_HEADERS): * libgimpwidgets/Makefile.am (libgimpwidgetsinclude_HEADERS):

View File

@ -262,9 +262,11 @@ gimp_color_hex_entry_events (GtkWidget *widget,
if (g_ascii_strcasecmp (buffer, text) != 0) if (g_ascii_strcasecmp (buffer, text) != 0)
{ {
GimpRGB color; GimpRGB color;
gsize len = strlen (text);
if ((strlen (text) == 6 && gimp_rgb_parse_hex (&color, text, 6)) || if (len > 0&&
(gimp_rgb_parse_name (&color, text, -1))) ((len % 3 == 0 && gimp_rgb_parse_hex (&color, text, len)) ||
(gimp_rgb_parse_name (&color, text, -1))))
{ {
gimp_color_hex_entry_set_color (entry, &color); gimp_color_hex_entry_set_color (entry, &color);
} }