diff options
author | Egbert Eich <eich@freedesktop.org> | 2004-04-23 18:42:09 +0000 |
---|---|---|
committer | Egbert Eich <eich@freedesktop.org> | 2004-04-23 18:42:09 +0000 |
commit | c6349f43193b74a3c09945f3093a871b0157ba47 (patch) | |
tree | aea173c19da6fa57e24eb4633ff815feb7ae3fa0 /src/LookupCol.c | |
parent | c3c4ddc682950a01b80825021f3e2503ab01ea7f (diff) | |
download | xorg-lib-libX11-c6349f43193b74a3c09945f3093a871b0157ba47.tar.gz |
Merging XORG-CURRENT into trunk
Diffstat (limited to 'src/LookupCol.c')
-rw-r--r-- | src/LookupCol.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/LookupCol.c b/src/LookupCol.c index b7f56d3d..e68625e8 100644 --- a/src/LookupCol.c +++ b/src/LookupCol.c @@ -24,29 +24,21 @@ 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/LookupCol.c,v 1.6 2003/04/13 19:22:16 dawes Exp $ */ #define NEED_REPLIES #include <stdio.h> #include "Xlibint.h" #include "Xcmsint.h" -extern void _XcmsRGB_to_XColor(); -extern void _XUnresolveColor(); -#if NeedFunctionPrototypes -Status XLookupColor ( +Status +XLookupColor ( register Display *dpy, Colormap cmap, _Xconst char *spec, XColor *def, XColor *scr) -#else -Status XLookupColor (dpy, cmap, spec, def, scr) - register Display *dpy; - Colormap cmap; - char *spec; - XColor *def, *scr; -#endif { register int n; xLookupColorReply reply; @@ -57,22 +49,28 @@ Status XLookupColor (dpy, cmap, spec, def, scr) /* * 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, &spec, - &cmsColor_exact, XcmsRGBFormat) >= XcmsSuccess) { + const char *tmpName = spec; + + switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, + XcmsRGBFormat)) { + case XcmsSuccess: + case XcmsSuccessWithCompression: _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); memcpy((char *)scr, (char *)def, sizeof(XColor)); _XUnresolveColor(ccc, scr); return(1); + 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 spec was changed with yet another - * name. Thus pass name to the X Server. - */ } - /* * Xcms and i18n methods failed, so lets pass it to the server * for parsing. |