Change to the linux kernel coding style
[wmaker-crm.git] / wrlib / DelCmap.c
Commit [+]AuthorDateLineData
33b8c225 kojima1999-11-16 00:13:21 +00001/* $XConsortium: DelCmap.c,v 1.2 94/04/17 20:15:58 converse Exp $ */
2
6830b057 dan2004-10-12 21:28:27 +00003/*
4
33b8c225 kojima1999-11-16 00:13:21 +00005Copyright (c) 1989 X Consortium
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in
15all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of the X Consortium shall not be
25used in advertising or otherwise to promote the sale, use or other dealings
26in this Software without prior written authorization from the X Consortium.
27
28*/
29
30/*
31 * Author: Donna Converse, MIT X Consortium
32 */
33
34#include <X11/Xlib.h>
35#include <X11/Xutil.h>
36
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.
41 */
42
43void XmuDeleteStandardColormap(dpy, screen, property)
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020044Display *dpy; /* specifies the X server to connect to */
45int screen; /* specifies the screen of the display */
46Atom property; /* specifies the standard colormap property */
33b8c225 kojima1999-11-16 00:13:21 +000047{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020048 XStandardColormap *stdcmaps, *s;
49 int count = 0;
50
51 if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count, property)) {
52 for (s = stdcmaps; count > 0; count--, s++) {
53 if ((s->killid == ReleaseByFreeingColormap) &&
54 (s->colormap != None) && (s->colormap != DefaultColormap(dpy, screen)))
55 XFreeColormap(dpy, s->colormap);
56 else if (s->killid != None)
57 XKillClient(dpy, s->killid);
58 }
59 XDeleteProperty(dpy, RootWindow(dpy, screen), property);
60 XFree((char *)stdcmaps);
61 XSync(dpy, False);
62 }
33b8c225 kojima1999-11-16 00:13:21 +000063}