comparison src/video/Xext/XmuStdCmap/DelCmap.c @ 2185:2032348afed1

This code adds support for DirectColor visuals to SDL 1.3. The support uses part of the Xmu library. To ensure that the library is available and to keep people form having to install yet another library I have added the essential parts of Xmu in src/video/extensions/XmuStdCmap and an include file in src/video/extensions. The support makes use of standard X11 mechanisms to create color maps and make sure that an application uses the same color map for each window/visual combination. This should make it possible for gamma support to be implemented based on a single color map per application. Hurm... it looks like "make indent" modified a few extra files. Those are getting committed too.
author Bob Pendleton <bob@pendleton.com>
date Thu, 12 Jul 2007 20:00:50 +0000
parents
children
comparison
equal deleted inserted replaced
2184:8f8516e79a13 2185:2032348afed1
1 /* $Xorg: DelCmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
2
3 /*
4
5 Copyright 1989, 1998 The Open Group
6
7 Permission to use, copy, modify, distribute, and sell this software and its
8 documentation for any purpose is hereby granted without fee, provided that
9 the above copyright notice appear in all copies and that both that
10 copyright notice and this permission notice appear in supporting
11 documentation.
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 Except as contained in this notice, the name of The Open Group shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from The Open Group.
26
27 */
28 /* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.6 2001/01/17 19:42:54 dawes Exp $ */
29
30 /*
31 * Author: Donna Converse, MIT X Consortium
32 */
33
34 #ifdef HAVE_CONFIG_H
35 #include <config.h>
36 #endif
37 #include <X11/Xlib.h>
38 #include <X11/Xutil.h>
39 #include "../extensions/StdCmap.h"
40
41 /* To remove any standard colormap property, use XmuDeleteStandardColormap().
42 * XmuDeleteStandardColormap() will remove the specified property from the
43 * specified screen, releasing any resources used by the colormap(s) of the
44 * property if possible.
45 */
46
47 void
48 XmuDeleteStandardColormap(Display * dpy, int screen, Atom property)
49 /* dpy; - specifies the X server to connect to
50 * screen - specifies the screen of the display
51 * property - specifies the standard colormap property
52 */
53 {
54 XStandardColormap *stdcmaps, *s;
55 int count = 0;
56
57 if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
58 property)) {
59 for (s = stdcmaps; count > 0; count--, s++) {
60 if ((s->killid == ReleaseByFreeingColormap) &&
61 (s->colormap != None) &&
62 (s->colormap != DefaultColormap(dpy, screen)))
63 XFreeColormap(dpy, s->colormap);
64 else if (s->killid != None)
65 XKillClient(dpy, s->killid);
66 }
67 XDeleteProperty(dpy, RootWindow(dpy, screen), property);
68 XFree((char *) stdcmaps);
69 XSync(dpy, False);
70 }
71 }