new style
[wmaker-crm.git] / wrlib / DelCmap.c
blobb02e3b80362492b2f45a11fd55e2d186318ee14a
1 /* $XConsortium: DelCmap.c,v 1.2 94/04/17 20:15:58 converse Exp $ */
3 /*
5 Copyright (c) 1989 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
31 * Author: Donna Converse, MIT X Consortium
34 #include <X11/Xlib.h>
35 #include <X11/Xutil.h>
37 /* To remove any standard colormap property, use XmuDeleteStandardColormap().
38 * XmuDeleteStandardColormap() will remove the specified property from the
39 * specified screen, releasing any resources used by the colormap(s) of the
40 * property if possible.
43 void XmuDeleteStandardColormap(dpy, screen, property)
44 Display *dpy; /* specifies the X server to connect to */
45 int screen; /* specifies the screen of the display */
46 Atom property; /* specifies the standard colormap property */
48 XStandardColormap *stdcmaps, *s;
49 int count = 0;
51 if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
52 property))
54 for (s=stdcmaps; count > 0; count--, s++) {
55 if ((s->killid == ReleaseByFreeingColormap) &&
56 (s->colormap != None) &&
57 (s->colormap != DefaultColormap(dpy, screen)))
58 XFreeColormap(dpy, s->colormap);
59 else if (s->killid != None)
60 XKillClient(dpy, s->killid);
62 XDeleteProperty(dpy, RootWindow(dpy, screen), property);
63 XFree((char *) stdcmaps);
64 XSync(dpy, False);