summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@gtk.org>1998-06-13 15:51:34 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-06-13 15:51:34 +0000
commite17f31db8f295f229a992fcd45912d3ef2b08b57 (patch)
treead9fee68f26c349be64a5b7656c2559c83ff08c9 /gdk
parent2e5dda7c62a5c55481e1f26c4426926283583879 (diff)
downloadgtk+-e17f31db8f295f229a992fcd45912d3ef2b08b57.tar.gz
Patch from Tom Bech <tomb@ii.uib.no>, to handle color specs of the form c
Sat Jun 13 11:48:26 1998 Owen Taylor <otaylor@gtk.org> * gdk/gdkpixmap.c (gdk_pixmap_extract_color): Patch from Tom Bech <tomb@ii.uib.no>, to handle color specs of the form c #abcdef [ more keys ] properly.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkpixmap.c13
-rw-r--r--gdk/x11/gdkpixmap-x11.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index 7ba8727885..799bd8d462 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -340,7 +340,18 @@ gdk_pixmap_extract_color (gchar *buffer)
return NULL;
else if (ptr[0] == '#')
{
- retcol = g_strdup (ptr);
+ counter = 1;
+ while (ptr[counter] != 0 &&
+ ((ptr[counter] >= '0' && ptr[counter] <= '9') ||
+ (ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
+ (ptr[counter] >= 'A' && ptr[counter] <= 'F')))
+ counter++;
+
+ retcol = g_new (gchar, counter+1);
+ strncpy (retcol, ptr, counter);
+
+ retcol[counter] = 0;
+
return retcol;
}
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index 7ba8727885..799bd8d462 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -340,7 +340,18 @@ gdk_pixmap_extract_color (gchar *buffer)
return NULL;
else if (ptr[0] == '#')
{
- retcol = g_strdup (ptr);
+ counter = 1;
+ while (ptr[counter] != 0 &&
+ ((ptr[counter] >= '0' && ptr[counter] <= '9') ||
+ (ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
+ (ptr[counter] >= 'A' && ptr[counter] <= 'F')))
+ counter++;
+
+ retcol = g_new (gchar, counter+1);
+ strncpy (retcol, ptr, counter);
+
+ retcol[counter] = 0;
+
return retcol;
}