SetStCmap.c revision 1ab64890
11ab64890Smrg/* $Xorg: SetStCmap.c,v 1.4 2001/02/09 02:03:36 xorgcvs Exp $ */
21ab64890Smrg
31ab64890Smrg/***********************************************************
41ab64890Smrg
51ab64890SmrgCopyright 1987, 1998  The Open Group
61ab64890Smrg
71ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its
81ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that
91ab64890Smrgthe above copyright notice appear in all copies and that both that
101ab64890Smrgcopyright notice and this permission notice appear in supporting
111ab64890Smrgdocumentation.
121ab64890Smrg
131ab64890SmrgThe above copyright notice and this permission notice shall be included in
141ab64890Smrgall copies or substantial portions of the Software.
151ab64890Smrg
161ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171ab64890SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181ab64890SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
191ab64890SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
201ab64890SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
211ab64890SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
221ab64890Smrg
231ab64890SmrgExcept as contained in this notice, the name of The Open Group shall not be
241ab64890Smrgused in advertising or otherwise to promote the sale, use or other dealings
251ab64890Smrgin this Software without prior written authorization from The Open Group.
261ab64890Smrg
271ab64890Smrg
281ab64890SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
291ab64890Smrg
301ab64890Smrg                        All Rights Reserved
311ab64890Smrg
321ab64890SmrgPermission to use, copy, modify, and distribute this software and its
331ab64890Smrgdocumentation for any purpose and without fee is hereby granted,
341ab64890Smrgprovided that the above copyright notice appear in all copies and that
351ab64890Smrgboth that copyright notice and this permission notice appear in
361ab64890Smrgsupporting documentation, and that the name of Digital not be
371ab64890Smrgused in advertising or publicity pertaining to distribution of the
381ab64890Smrgsoftware without specific, written prior permission.
391ab64890Smrg
401ab64890SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
411ab64890SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
421ab64890SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
431ab64890SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
441ab64890SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
451ab64890SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
461ab64890SmrgSOFTWARE.
471ab64890Smrg
481ab64890Smrg******************************************************************/
491ab64890Smrg
501ab64890Smrg#ifdef HAVE_CONFIG_H
511ab64890Smrg#include <config.h>
521ab64890Smrg#endif
531ab64890Smrg#include <X11/Xlibint.h>
541ab64890Smrg#include <X11/Xutil.h>
551ab64890Smrg#include "Xatomtype.h"
561ab64890Smrg#include <X11/Xatom.h>
571ab64890Smrg
581ab64890Smrg/*
591ab64890Smrg * 				    WARNING
601ab64890Smrg *
611ab64890Smrg * This is a pre-ICCCM routine.  It must not reference any of the new fields
621ab64890Smrg * in the XStandardColormap structure.
631ab64890Smrg */
641ab64890Smrg
651ab64890Smrgvoid XSetStandardColormap(
661ab64890Smrg    Display *dpy,
671ab64890Smrg    Window w,
681ab64890Smrg    XStandardColormap *cmap,
691ab64890Smrg    Atom property)		/* XA_RGB_BEST_MAP, etc. */
701ab64890Smrg{
711ab64890Smrg    Screen *sp;
721ab64890Smrg    XStandardColormap stdcmap;
731ab64890Smrg
741ab64890Smrg    sp = _XScreenOfWindow (dpy, w);
751ab64890Smrg    if (!sp) {
761ab64890Smrg	/* already caught the XGetGeometry error in _XScreenOfWindow */
771ab64890Smrg	return;
781ab64890Smrg    }
791ab64890Smrg
801ab64890Smrg    stdcmap.colormap	= cmap->colormap;
811ab64890Smrg    stdcmap.red_max	= cmap->red_max;
821ab64890Smrg    stdcmap.red_mult	= cmap->red_mult;
831ab64890Smrg    stdcmap.green_max	= cmap->green_max;
841ab64890Smrg    stdcmap.green_mult  = cmap->green_mult;
851ab64890Smrg    stdcmap.blue_max	= cmap->blue_max;
861ab64890Smrg    stdcmap.blue_mult	= cmap->blue_mult;
871ab64890Smrg    stdcmap.base_pixel	= cmap->base_pixel;
881ab64890Smrg    stdcmap.visualid	= sp->root_visual->visualid;
891ab64890Smrg    stdcmap.killid	= None;		/* don't know how to kill this one */
901ab64890Smrg
911ab64890Smrg#ifdef XCMS
921ab64890Smrg    XSetRGBColormaps (dpy, w, &stdcmap, 1, property);
931ab64890Smrg#endif
941ab64890Smrg
951ab64890Smrg    return;
961ab64890Smrg}
97