DelCmap.c

Go to the documentation of this file.
00001 /* $Xorg: DelCmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
00002 
00003 /* 
00004  
00005 Copyright 1989, 1998  The Open Group
00006 
00007 Permission to use, copy, modify, distribute, and sell this software and its
00008 documentation for any purpose is hereby granted without fee, provided that
00009 the above copyright notice appear in all copies and that both that
00010 copyright notice and this permission notice appear in supporting
00011 documentation.
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00019 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022 
00023 Except as contained in this notice, the name of The Open Group shall not be
00024 used in advertising or otherwise to promote the sale, use or other dealings
00025 in this Software without prior written authorization from The Open Group.
00026 
00027 */
00028 /* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.6 2001/01/17 19:42:54 dawes Exp $ */
00029 
00030 /*
00031  * Author:  Donna Converse, MIT X Consortium
00032  */
00033 
00034 #include <X11/Xlib.h>
00035 #include <X11/Xutil.h>
00036 #include <X11/Xmu/StdCmap.h>
00037 
00038 /* To remove any standard colormap property, use XmuDeleteStandardColormap().
00039  * XmuDeleteStandardColormap() will remove the specified property from the
00040  * specified screen, releasing any resources used by the colormap(s) of the
00041  * property if possible.
00042  */
00043 
00044 void
00045 XmuDeleteStandardColormap(Display *dpy, int screen, Atom property)
00046      /* dpy;            - specifies the X server to connect to
00047       * screen          - specifies the screen of the display
00048       * property        - specifies the standard colormap property
00049       */
00050 {
00051     XStandardColormap   *stdcmaps, *s;
00052     int                 count = 0;
00053 
00054     if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
00055                          property))
00056     {
00057         for (s=stdcmaps; count > 0; count--, s++) {
00058             if ((s->killid == ReleaseByFreeingColormap) &&
00059                 (s->colormap != None) &&
00060                 (s->colormap != DefaultColormap(dpy, screen)))
00061                 XFreeColormap(dpy, s->colormap);
00062             else if (s->killid != None)
00063                 XKillClient(dpy, s->killid);
00064         }
00065         XDeleteProperty(dpy, RootWindow(dpy, screen), property);
00066         XFree((char *) stdcmaps);
00067         XSync(dpy, False);
00068     }
00069 }
00070 

Generated on Sun Mar 4 15:03:56 2007 for Scilab [trunk] by  doxygen 1.5.1