summaryrefslogtreecommitdiff
path: root/src/GetColor.c
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:20 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:20 +0000
commit917de4a98eeb9a7eafeab7ddd8e1b1ae6aae6514 (patch)
treee79f892e8545c72ddbe15d679315143e5672175d /src/GetColor.c
parentdeae12c6b683898f5213992d561a59d4ea889cca (diff)
XFree86 4.3.0.1PRE_xf86-4_3_0_1
Diffstat (limited to 'src/GetColor.c')
-rw-r--r--src/GetColor.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/GetColor.c b/src/GetColor.c
index b469b5d..090f241 100644
--- a/src/GetColor.c
+++ b/src/GetColor.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetColor.c,v 1.5 2002/12/04 23:18:32 paulo Exp $ */
#define NEED_REPLIES
#include <stdio.h>
@@ -32,6 +33,16 @@ in this Software without prior written authorization from The Open Group.
extern void _XcmsRGB_to_XColor();
+/* cmsColNm.c */
+extern Status _XcmsResolveColorString(
+#if NeedFunctionPrototypes
+ XcmsCCC ccc,
+ _Xconst char **color_string,
+ XcmsColor *pColor_exact_return,
+ XcmsColorFormat result_format
+#endif
+);
+
#if NeedFunctionPrototypes
Status XAllocNamedColor(
register Display *dpy,
@@ -60,20 +71,27 @@ XColor *exact_def; /* RETURN */
/*
* Let's Attempt to use Xcms and i18n approach to Parse Color
*/
- /* copy string to allow overwrite by _XcmsResolveColorString() */
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {
- if (_XcmsResolveColorString(ccc, &colorname, &cmsColor_exact,
- XcmsRGBFormat) >= XcmsSuccess) {
+ const char *tmpName = colorname;
+
+ switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact,
+ XcmsRGBFormat)) {
+ case XcmsSuccess:
+ case XcmsSuccessWithCompression:
_XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1);
memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor));
ret = XAllocColor(dpy, cmap, hard_def);
exact_def->pixel = hard_def->pixel;
return(ret);
+ case XcmsFailure:
+ case _XCMS_NEWNAME:
+ /*
+ * if the result was _XCMS_NEWNAME tmpName points to
+ * a string in cmsColNm.c:pairs table, for example,
+ * gray70 would become tekhvc:0.0/70.0/0.0
+ */
+ break;
}
- /*
- * Otherwise we failed; or colorname was changed with yet another
- * name. Thus pass name to the X Server.
- */
}
/*