Annotation of researchv9/X11/src/X.V11R1/lib/X/XGetStCmap.c, revision 1.1.1.1

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XGetStCmap.c,v 1.3 87/09/11 08:15:49 toddb Exp $ */
                      4: 
                      5: /***********************************************************
                      6: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      7: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      8: 
                      9:                         All Rights Reserved
                     10: 
                     11: Permission to use, copy, modify, and distribute this software and its 
                     12: documentation for any purpose and without fee is hereby granted, 
                     13: provided that the above copyright notice appear in all copies and that
                     14: both that copyright notice and this permission notice appear in 
                     15: supporting documentation, and that the names of Digital or MIT not be
                     16: used in advertising or publicity pertaining to distribution of the
                     17: software without specific, written prior permission.  
                     18: 
                     19: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     20: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     21: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     22: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     23: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     24: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     25: SOFTWARE.
                     26: 
                     27: ******************************************************************/
                     28: 
                     29: #include "Xlibint.h"
                     30: #include "Xutil.h"
                     31: #include "Xatomtype.h"
                     32: #include "Xatom.h"
                     33: 
                     34: Status XGetStandardColormap (dpy, w, cmap, property)
                     35:        Display *dpy;
                     36:        Window w;
                     37:        XStandardColormap *cmap;
                     38:         Atom property;         /* XA_RGB_BEST_MAP, etc. */
                     39: {
                     40:        xPropStandardColormap *prop;
                     41:         Atom actual_type;
                     42:         int actual_format;
                     43:         long leftover;
                     44:         unsigned long nitems;
                     45: 
                     46:        if (XGetWindowProperty (dpy, w, property, 0L,
                     47:            (long)NumPropStandardColormapElements, False,
                     48:            XA_RGB_COLOR_MAP, &actual_type, &actual_format,
                     49:             &nitems, &leftover, (unsigned char **)&prop)
                     50:             != Success) return (0);
                     51: 
                     52:         if ((nitems < NumPropStandardColormapElements)
                     53:         || (actual_format != 32)) {
                     54:                Xfree ((char *)prop);
                     55:                 return(0);
                     56:                }
                     57:        cmap->colormap   = prop->colormap;
                     58:        cmap->red_max    = prop->red_max;
                     59:        cmap->red_mult   = prop->red_mult;
                     60:        cmap->green_max  = prop->green_max;
                     61:        cmap->green_mult = prop->green_mult;
                     62:        cmap->blue_max   = prop->blue_max;
                     63:        cmap->blue_mult  = prop->blue_mult;
                     64:        cmap->base_pixel = prop->base_pixel;
                     65:        Xfree((char *)prop);
                     66:        return(1);
                     67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.