Removed a bunch of X11 support that we no longer need.
authorSam Lantinga <slouken@libsdl.org>
Fri, 04 Feb 2011 19:18:08 -0800
changeset 5183227d81a4b66c
parent 5182 073b86030262
child 5184 d976b67150c5
Removed a bunch of X11 support that we no longer need.
configure.in
include/SDL_config.h.in
src/video/Xext/XmuStdCmap/AllCmap.c
src/video/Xext/XmuStdCmap/CmapAlloc.c
src/video/Xext/XmuStdCmap/CrCmap.c
src/video/Xext/XmuStdCmap/DelCmap.c
src/video/Xext/XmuStdCmap/Distinct.c
src/video/Xext/XmuStdCmap/LookupCmap.c
src/video/Xext/XmuStdCmap/StdCmap.c
src/video/Xext/XmuStdCmap/VisCmap.c
src/video/Xext/extensions/StdCmap.h
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.h
src/video/x11/SDL_x11window.c
     1.1 --- a/configure.in	Fri Feb 04 18:05:20 2011 -0800
     1.2 +++ b/configure.in	Fri Feb 04 19:18:08 2011 -0800
     1.3 @@ -1118,7 +1118,6 @@
     1.4  
     1.5              AC_DEFINE(SDL_VIDEO_DRIVER_X11)
     1.6              SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
     1.7 -            SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
     1.8              EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
     1.9  
    1.10              if test x$enable_x11_shared = xmaybe; then
    1.11 @@ -1261,69 +1260,6 @@
    1.12              if test x$definitely_enable_video_x11_scrnsaver = xyes; then
    1.13                  AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
    1.14              fi
    1.15 -            AC_ARG_ENABLE(video-x11-xrender,
    1.16 -AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
    1.17 -                            , enable_video_x11_xrender=yes)
    1.18 -            if test x$enable_video_x11_xrender = xyes; then
    1.19 -                AC_CHECK_HEADER(X11/extensions/Xrender.h,
    1.20 -                                have_xrender_h_hdr=yes,
    1.21 -                                have_xrender_h_hdr=no,
    1.22 -                                [#include <X11/Xlib.h>
    1.23 -                                ])
    1.24 -                if test x$have_xrender_h_hdr = xyes; then
    1.25 -                    if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
    1.26 -                        echo "-- dynamic libXrender -> $xrender_lib"
    1.27 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
    1.28 -                        definitely_enable_video_x11_xrender=yes
    1.29 -                    else
    1.30 -                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
    1.31 -                        if test x$have_xrender_lib = xyes ; then
    1.32 -                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
    1.33 -                            definitely_enable_video_x11_xrender=yes
    1.34 -                        fi
    1.35 -                    fi
    1.36 -                fi
    1.37 -            fi
    1.38 -            if test x$definitely_enable_video_x11_xrender = xyes; then
    1.39 -                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
    1.40 -            fi
    1.41 -            AC_ARG_ENABLE(video-x11-xdamage-xfixes,
    1.42 -AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
    1.43 -                            , enable_video_x11_xdamage=yes)
    1.44 -            if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
    1.45 -                AC_CHECK_HEADER(X11/extensions/Xdamage.h,
    1.46 -                                have_xdamage_h_hdr=yes,
    1.47 -                                have_xdamage_h_hdr=no,
    1.48 -                                [#include <X11/Xlib.h>
    1.49 -                                ])
    1.50 -                AC_CHECK_HEADER(X11/extensions/Xfixes.h,
    1.51 -                                have_xfixes_h_hdr=yes,
    1.52 -                                have_xfixes_h_hdr=no,
    1.53 -                                [#include <X11/Xlib.h>
    1.54 -                                ])
    1.55 -                if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
    1.56 -                    if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
    1.57 -                        echo "-- dynamic libXdamage -> $xdamage_lib"
    1.58 -                        echo "-- dynamic libXfixes -> $xfixes_lib"
    1.59 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
    1.60 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
    1.61 -                        definitely_enable_video_x11_xdamage=yes
    1.62 -                        definitely_enable_video_x11_xfixes=yes
    1.63 -                    else
    1.64 -                        AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
    1.65 -                        AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
    1.66 -                        if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
    1.67 -                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
    1.68 -                            definitely_enable_video_x11_xdamage=yes
    1.69 -                            definitely_enable_video_x11_xfixes=yes
    1.70 -                        fi
    1.71 -                    fi
    1.72 -                fi
    1.73 -            fi
    1.74 -            if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
    1.75 -                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
    1.76 -                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
    1.77 -            fi
    1.78          fi
    1.79      fi
    1.80  }
     2.1 --- a/include/SDL_config.h.in	Fri Feb 04 18:05:20 2011 -0800
     2.2 +++ b/include/SDL_config.h.in	Fri Feb 04 19:18:08 2011 -0800
     2.3 @@ -266,20 +266,14 @@
     2.4  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
     2.5  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
     2.6  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
     2.7 -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
     2.8  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
     2.9  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
    2.10 -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE
    2.11 -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
    2.12  #undef SDL_VIDEO_DRIVER_X11_VIDMODE
    2.13  #undef SDL_VIDEO_DRIVER_X11_XINERAMA
    2.14  #undef SDL_VIDEO_DRIVER_X11_XRANDR
    2.15  #undef SDL_VIDEO_DRIVER_X11_XINPUT
    2.16  #undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
    2.17  #undef SDL_VIDEO_DRIVER_X11_XV
    2.18 -#undef SDL_VIDEO_DRIVER_X11_XRENDER
    2.19 -#undef SDL_VIDEO_DRIVER_X11_XDAMAGE
    2.20 -#undef SDL_VIDEO_DRIVER_X11_XFIXES
    2.21  #undef SDL_VIDEO_DRIVER_X11_XSHAPE
    2.22  
    2.23  #undef SDL_VIDEO_RENDER_D3D
     3.1 --- a/src/video/Xext/XmuStdCmap/AllCmap.c	Fri Feb 04 18:05:20 2011 -0800
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,159 +0,0 @@
     3.4 -/* $Xorg: AllCmap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
     3.5 -
     3.6 -/* 
     3.7 - 
     3.8 -Copyright 1989, 1998  The Open Group
     3.9 -
    3.10 -Permission to use, copy, modify, distribute, and sell this software and its
    3.11 -documentation for any purpose is hereby granted without fee, provided that
    3.12 -the above copyright notice appear in all copies and that both that
    3.13 -copyright notice and this permission notice appear in supporting
    3.14 -documentation.
    3.15 -
    3.16 -The above copyright notice and this permission notice shall be included in
    3.17 -all copies or substantial portions of the Software.
    3.18 -
    3.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    3.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    3.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    3.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    3.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    3.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    3.25 -
    3.26 -Except as contained in this notice, the name of The Open Group shall not be
    3.27 -used in advertising or otherwise to promote the sale, use or other dealings
    3.28 -in this Software without prior written authorization from The Open Group.
    3.29 -
    3.30 -*/
    3.31 -/* $XFree86: xc/lib/Xmu/AllCmap.c,v 1.7 2001/01/17 19:42:53 dawes Exp $ */
    3.32 -
    3.33 -#ifdef HAVE_CONFIG_H
    3.34 -#include <config.h>
    3.35 -#endif
    3.36 -#include <stdio.h>
    3.37 -#include <X11/Xlib.h>
    3.38 -#include <X11/Xatom.h>
    3.39 -#include <X11/Xutil.h>
    3.40 -#include "../extensions/StdCmap.h"
    3.41 -
    3.42 -static XVisualInfo *getDeepestVisual(int, XVisualInfo *, int);
    3.43 -
    3.44 -/*
    3.45 - * To create all of the appropriate standard colormaps for every visual of
    3.46 - * every screen on a given display, use XmuAllStandardColormaps.
    3.47 - *
    3.48 - * Define and retain as permanent resources all standard colormaps which are
    3.49 - * meaningful for the visuals of each screen of the display.  Return 0 on
    3.50 - * failure, non-zero on success.  If the property of any standard colormap 
    3.51 - * is already defined, redefine it.
    3.52 - *
    3.53 - * This interface is intended to be used by window managers or a client
    3.54 - * upon start-up of a session.
    3.55 - *
    3.56 - * The standard colormaps of a screen are defined by properties associated
    3.57 - * with the screen's root window.  Each screen has exactly one root window.
    3.58 - * The property names of standard colormaps are predefined, and each property
    3.59 - * name may describe at most one colormap.
    3.60 - * 
    3.61 - * The standard colormaps are
    3.62 - *		RGB_BEST_MAP
    3.63 - *		RGB_RED_MAP
    3.64 - *		RGB_GREEN_MAP
    3.65 - *		RGB_BLUE_MAP
    3.66 - *		RGB_DEFAULT_MAP
    3.67 - *		RGB_GRAY_MAP
    3.68 - *
    3.69 - * Therefore a screen may have at most 6 standard colormap properties defined.
    3.70 - *
    3.71 - * A standard colormap is associated with a particular visual of the screen.
    3.72 - * A screen may have multiple visuals defined, including visuals of the same
    3.73 - * class at different depths.  Note that a visual id might be repeated for
    3.74 - * more than one depth, so the visual id and the depth of a visual identify
    3.75 - * the visual.  The characteristics of the visual will determine which
    3.76 - * standard colormaps are meaningful under that visual, and will determine
    3.77 - * how the standard colormap is defined.  Because a standard colormap is
    3.78 - * associated with a specific visual, there must be a method of determining
    3.79 - * which visuals take precedence in defining standard colormaps.
    3.80 - * 
    3.81 - * The method used here is: for the visual of greatest depth, define all 
    3.82 - * standard colormaps meaningful to that visual class, according to this
    3.83 - * order of (descending) precedence:
    3.84 - *	1. DirectColor
    3.85 - *	2. PseudoColor
    3.86 - *	3. TrueColor and GrayScale
    3.87 - *	4. StaticColor and StaticGray
    3.88 - *
    3.89 - * Allows partial success by screenful.  For example, if a map on screen 1
    3.90 - * fails, the maps on screen 0, created earlier, will remain.  However,
    3.91 - * none on screen 1 will remain.  If a map on 0 fails, none will remain.
    3.92 - *
    3.93 - * See the comments under XmuVisualStandardColormaps() for notes on which
    3.94 - * standard colormaps are meaningful under these classes of visuals.
    3.95 - */
    3.96 -
    3.97 -Status
    3.98 -XmuAllStandardColormaps(Display * dpy)
    3.99 -{
   3.100 -    int nvisuals, scr;
   3.101 -    Status status;
   3.102 -    long vinfo_mask;
   3.103 -    XVisualInfo template, *vinfo, *v1, *v2;
   3.104 -
   3.105 -    status = 0;
   3.106 -    /* for each screen, determine all visuals of this server */
   3.107 -    for (scr = 0; scr < ScreenCount(dpy); scr++) {
   3.108 -        template.screen = scr;
   3.109 -        vinfo_mask = VisualScreenMask;
   3.110 -        vinfo = XGetVisualInfo(dpy, vinfo_mask, &template, &nvisuals);
   3.111 -        if (vinfo == NULL)      /* unexpected: a screen with no visuals */
   3.112 -            continue;
   3.113 -
   3.114 -        v1 = getDeepestVisual(DirectColor, vinfo, nvisuals);
   3.115 -        v2 = getDeepestVisual(PseudoColor, vinfo, nvisuals);
   3.116 -
   3.117 -        if (v2 &&
   3.118 -            (!v1 || (v2->colormap_size >=
   3.119 -                     ((v1->red_mask | v1->green_mask | v1->blue_mask) + 1))))
   3.120 -            status = XmuVisualStandardColormaps(dpy, scr, v2->visualid,
   3.121 -                                                (unsigned) v2->depth, 1, 1);
   3.122 -        else if (v1)
   3.123 -            status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
   3.124 -                                                (unsigned) v1->depth, 1, 1);
   3.125 -
   3.126 -        else {
   3.127 -            if (((v1 = getDeepestVisual(TrueColor, vinfo, nvisuals)) != NULL)
   3.128 -                || ((v1 = getDeepestVisual(StaticColor, vinfo, nvisuals)) !=
   3.129 -                    NULL))
   3.130 -                status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
   3.131 -                                                    (unsigned) v1->depth, 1,
   3.132 -                                                    1);
   3.133 -            if (status
   3.134 -                &&
   3.135 -                (((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
   3.136 -                 || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
   3.137 -                     NULL)))
   3.138 -                status =
   3.139 -                    XmuVisualStandardColormaps(dpy, scr, v1->visualid,
   3.140 -                                               (unsigned) v1->depth, 1, 1);
   3.141 -        }
   3.142 -        XFree((char *) vinfo);
   3.143 -        if (!status)
   3.144 -            break;
   3.145 -    }
   3.146 -    return status;
   3.147 -}
   3.148 -
   3.149 -static XVisualInfo *
   3.150 -getDeepestVisual(int visual_class, XVisualInfo * vinfo, int nvisuals)
   3.151 -{
   3.152 -    register int i;
   3.153 -    register int maxdepth = 0;
   3.154 -    XVisualInfo *v = NULL;
   3.155 -
   3.156 -    for (i = 0; i < nvisuals; i++, vinfo++)
   3.157 -        if (vinfo->class == visual_class && vinfo->depth > maxdepth) {
   3.158 -            maxdepth = vinfo->depth;
   3.159 -            v = vinfo;
   3.160 -        }
   3.161 -    return (v);
   3.162 -}
     4.1 --- a/src/video/Xext/XmuStdCmap/CmapAlloc.c	Fri Feb 04 18:05:20 2011 -0800
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,337 +0,0 @@
     4.4 -/* $Xorg: CmapAlloc.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
     4.5 -
     4.6 -/* 
     4.7 -
     4.8 -Copyright 1989, 1994, 1998  The Open Group
     4.9 -
    4.10 -Permission to use, copy, modify, distribute, and sell this software and its
    4.11 -documentation for any purpose is hereby granted without fee, provided that
    4.12 -the above copyright notice appear in all copies and that both that
    4.13 -copyright notice and this permission notice appear in supporting
    4.14 -documentation.
    4.15 -
    4.16 -The above copyright notice and this permission notice shall be included in
    4.17 -all copies or substantial portions of the Software.
    4.18 -
    4.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    4.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    4.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    4.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    4.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    4.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    4.25 -
    4.26 -Except as contained in this notice, the name of The Open Group shall not be
    4.27 -used in advertising or otherwise to promote the sale, use or other dealings
    4.28 -in this Software without prior written authorization from The Open Group.
    4.29 -
    4.30 -*/
    4.31 -/* $XFree86: xc/lib/Xmu/CmapAlloc.c,v 1.6 2001/01/17 19:42:53 dawes Exp $ */
    4.32 -
    4.33 -/*
    4.34 - * Author:  Donna Converse, MIT X Consortium
    4.35 - */
    4.36 -
    4.37 -#ifdef HAVE_CONFIG_H
    4.38 -#include <config.h>
    4.39 -#endif
    4.40 -#include <X11/Xlib.h>
    4.41 -#include <X11/Xatom.h>
    4.42 -#include <X11/Xutil.h>
    4.43 -#include "../extensions/StdCmap.h"
    4.44 -#include <stdio.h>
    4.45 -
    4.46 -#define lowbit(x) ((x) & (~(x) + 1))
    4.47 -
    4.48 -/*
    4.49 - * Prototypes
    4.50 - */
    4.51 -static void best_allocation(XVisualInfo *, unsigned long *, unsigned long *,
    4.52 -                            unsigned long *);
    4.53 -static int default_allocation(XVisualInfo *, unsigned long *,
    4.54 -                              unsigned long *, unsigned long *);
    4.55 -static void gray_allocation(int, unsigned long *, unsigned long *,
    4.56 -                            unsigned long *);
    4.57 -static int icbrt(int);
    4.58 -static int icbrt_with_bits(int, int);
    4.59 -static int icbrt_with_guess(int, int);
    4.60 -
    4.61 -/* To determine the best allocation of reds, greens, and blues in a 
    4.62 - * standard colormap, use XmuGetColormapAllocation.
    4.63 - * 	vinfo		specifies visual information for a chosen visual
    4.64 - *	property	specifies one of the standard colormap property names
    4.65 - * 	red_max		returns maximum red value 
    4.66 - *      green_max	returns maximum green value
    4.67 - * 	blue_max	returns maximum blue value
    4.68 - *
    4.69 - * XmuGetColormapAllocation returns 0 on failure, non-zero on success.
    4.70 - * It is assumed that the visual is appropriate for the colormap property.
    4.71 - */
    4.72 -
    4.73 -Status
    4.74 -XmuGetColormapAllocation(XVisualInfo * vinfo, Atom property,
    4.75 -                         unsigned long *red_max,
    4.76 -                         unsigned long *green_max, unsigned long *blue_max)
    4.77 -{
    4.78 -    Status status = 1;
    4.79 -
    4.80 -    if (vinfo->colormap_size <= 2)
    4.81 -        return 0;
    4.82 -
    4.83 -    switch (property) {
    4.84 -    case XA_RGB_DEFAULT_MAP:
    4.85 -        status = default_allocation(vinfo, red_max, green_max, blue_max);
    4.86 -        break;
    4.87 -    case XA_RGB_BEST_MAP:
    4.88 -        best_allocation(vinfo, red_max, green_max, blue_max);
    4.89 -        break;
    4.90 -    case XA_RGB_GRAY_MAP:
    4.91 -        gray_allocation(vinfo->colormap_size, red_max, green_max, blue_max);
    4.92 -        break;
    4.93 -    case XA_RGB_RED_MAP:
    4.94 -        *red_max = vinfo->colormap_size - 1;
    4.95 -        *green_max = *blue_max = 0;
    4.96 -        break;
    4.97 -    case XA_RGB_GREEN_MAP:
    4.98 -        *green_max = vinfo->colormap_size - 1;
    4.99 -        *red_max = *blue_max = 0;
   4.100 -        break;
   4.101 -    case XA_RGB_BLUE_MAP:
   4.102 -        *blue_max = vinfo->colormap_size - 1;
   4.103 -        *red_max = *green_max = 0;
   4.104 -        break;
   4.105 -    default:
   4.106 -        status = 0;
   4.107 -    }
   4.108 -    return status;
   4.109 -}
   4.110 -
   4.111 -/****************************************************************************/
   4.112 -/* Determine the appropriate color allocations of a gray scale.
   4.113 - *
   4.114 - * Keith Packard, MIT X Consortium
   4.115 - */
   4.116 -
   4.117 -static void
   4.118 -gray_allocation(int n, unsigned long *red_max, unsigned long *green_max,
   4.119 -                unsigned long *blue_max)
   4.120 -{
   4.121 -    *red_max = (n * 30) / 100;
   4.122 -    *green_max = (n * 59) / 100;
   4.123 -    *blue_max = (n * 11) / 100;
   4.124 -    *green_max += ((n - 1) - (*red_max + *green_max + *blue_max));
   4.125 -}
   4.126 -
   4.127 -/****************************************************************************/
   4.128 -/* Determine an appropriate color allocation for the RGB_DEFAULT_MAP.
   4.129 - * If a map has less than a minimum number of definable entries, we do not
   4.130 - * produce an allocation for an RGB_DEFAULT_MAP.  
   4.131 - *
   4.132 - * For 16 planes, the default colormap will have 27 each RGB; for 12 planes,
   4.133 - * 12 each.  For 8 planes, let n = the number of colormap entries, which may
   4.134 - * be 256 or 254.  Then, maximum red value = floor(cube_root(n - 125)) - 1.
   4.135 - * Maximum green and maximum blue values are identical to maximum red.
   4.136 - * This leaves at least 125 cells which clients can allocate.
   4.137 - *
   4.138 - * Return 0 if an allocation has been determined, non-zero otherwise.
   4.139 - */
   4.140 -
   4.141 -static int
   4.142 -default_allocation(XVisualInfo * vinfo, unsigned long *red,
   4.143 -                   unsigned long *green, unsigned long *blue)
   4.144 -{
   4.145 -    int ngrays;                 /* number of gray cells */
   4.146 -
   4.147 -    switch (vinfo->class) {
   4.148 -    case PseudoColor:
   4.149 -
   4.150 -        if (vinfo->colormap_size > 65000)
   4.151 -            /* intended for displays with 16 planes */
   4.152 -            *red = *green = *blue = (unsigned long) 27;
   4.153 -        else if (vinfo->colormap_size > 4000)
   4.154 -            /* intended for displays with 12 planes */
   4.155 -            *red = *green = *blue = (unsigned long) 12;
   4.156 -        else if (vinfo->colormap_size < 250)
   4.157 -            return 0;
   4.158 -        else
   4.159 -            /* intended for displays with 8 planes */
   4.160 -            *red = *green = *blue = (unsigned long)
   4.161 -                (icbrt(vinfo->colormap_size - 125) - 1);
   4.162 -        break;
   4.163 -
   4.164 -    case DirectColor:
   4.165 -
   4.166 -        if (vinfo->colormap_size < 10)
   4.167 -            return 0;
   4.168 -        *red = *green = *blue = vinfo->colormap_size / 2 - 1;
   4.169 -        break;
   4.170 -
   4.171 -    case TrueColor:
   4.172 -
   4.173 -        *red = vinfo->red_mask / lowbit(vinfo->red_mask);
   4.174 -        *green = vinfo->green_mask / lowbit(vinfo->green_mask);
   4.175 -        *blue = vinfo->blue_mask / lowbit(vinfo->blue_mask);
   4.176 -        break;
   4.177 -
   4.178 -    case GrayScale:
   4.179 -
   4.180 -        if (vinfo->colormap_size > 65000)
   4.181 -            ngrays = 4096;
   4.182 -        else if (vinfo->colormap_size > 4000)
   4.183 -            ngrays = 512;
   4.184 -        else if (vinfo->colormap_size < 250)
   4.185 -            return 0;
   4.186 -        else
   4.187 -            ngrays = 12;
   4.188 -        gray_allocation(ngrays, red, green, blue);
   4.189 -        break;
   4.190 -
   4.191 -    default:
   4.192 -        return 0;
   4.193 -    }
   4.194 -    return 1;
   4.195 -}
   4.196 -
   4.197 -/****************************************************************************/
   4.198 -/* Determine an appropriate color allocation for the RGB_BEST_MAP.
   4.199 - *
   4.200 - * For a DirectColor or TrueColor visual, the allocation is determined
   4.201 - * by the red_mask, green_mask, and blue_mask members of the visual info.
   4.202 - *
   4.203 - * Otherwise, if the colormap size is an integral power of 2, determine
   4.204 - * the allocation according to the number of bits given to each color,
   4.205 - * with green getting more than red, and red more than blue, if there
   4.206 - * are to be inequities in the distribution.  If the colormap size is
   4.207 - * not an integral power of 2, let n = the number of colormap entries.
   4.208 - * Then maximum red value = floor(cube_root(n)) - 1;
   4.209 - * 	maximum blue value = floor(cube_root(n)) - 1;
   4.210 - *	maximum green value = n / ((# red values) * (# blue values)) - 1;
   4.211 - * Which, on a GPX, allows for 252 entries in the best map, out of 254
   4.212 - * defineable colormap entries.
   4.213 - */
   4.214 -
   4.215 -static void
   4.216 -best_allocation(XVisualInfo * vinfo, unsigned long *red, unsigned long *green,
   4.217 -                unsigned long *blue)
   4.218 -{
   4.219 -
   4.220 -    if (vinfo->class == DirectColor || vinfo->class == TrueColor) {
   4.221 -        *red = vinfo->red_mask;
   4.222 -        while ((*red & 01) == 0)
   4.223 -            *red >>= 1;
   4.224 -        *green = vinfo->green_mask;
   4.225 -        while ((*green & 01) == 0)
   4.226 -            *green >>= 1;
   4.227 -        *blue = vinfo->blue_mask;
   4.228 -        while ((*blue & 01) == 0)
   4.229 -            *blue >>= 1;
   4.230 -    } else {
   4.231 -        register int bits, n;
   4.232 -
   4.233 -        /* Determine n such that n is the least integral power of 2 which is
   4.234 -         * greater than or equal to the number of entries in the colormap.
   4.235 -         */
   4.236 -        n = 1;
   4.237 -        bits = 0;
   4.238 -        while (vinfo->colormap_size > n) {
   4.239 -            n = n << 1;
   4.240 -            bits++;
   4.241 -        }
   4.242 -
   4.243 -        /* If the number of entries in the colormap is a power of 2, determine
   4.244 -         * the allocation by "dealing" the bits, first to green, then red, then
   4.245 -         * blue.  If not, find the maximum integral red, green, and blue values
   4.246 -         * which, when multiplied together, do not exceed the number of 
   4.247 -
   4.248 -         * colormap entries.
   4.249 -         */
   4.250 -        if (n == vinfo->colormap_size) {
   4.251 -            register int r, g, b;
   4.252 -            b = bits / 3;
   4.253 -            g = b + ((bits % 3) ? 1 : 0);
   4.254 -            r = b + (((bits % 3) == 2) ? 1 : 0);
   4.255 -            *red = 1 << r;
   4.256 -            *green = 1 << g;
   4.257 -            *blue = 1 << b;
   4.258 -        } else {
   4.259 -            *red = icbrt_with_bits(vinfo->colormap_size, bits);
   4.260 -            *blue = *red;
   4.261 -            *green = (vinfo->colormap_size / ((*red) * (*blue)));
   4.262 -        }
   4.263 -        (*red)--;
   4.264 -        (*green)--;
   4.265 -        (*blue)--;
   4.266 -    }
   4.267 -    return;
   4.268 -}
   4.269 -
   4.270 -/*
   4.271 - * integer cube roots by Newton's method
   4.272 - *
   4.273 - * Stephen Gildea, MIT X Consortium, July 1991
   4.274 - */
   4.275 -
   4.276 -static int
   4.277 -icbrt(int a)
   4.278 -{
   4.279 -    register int bits = 0;
   4.280 -    register unsigned n = a;
   4.281 -
   4.282 -    while (n) {
   4.283 -        bits++;
   4.284 -        n >>= 1;
   4.285 -    }
   4.286 -    return icbrt_with_bits(a, bits);
   4.287 -}
   4.288 -
   4.289 -
   4.290 -static int
   4.291 -icbrt_with_bits(int a, int bits)
   4.292 -     /* bits - log 2 of a */
   4.293 -{
   4.294 -    return icbrt_with_guess(a, a >> 2 * bits / 3);
   4.295 -}
   4.296 -
   4.297 -#ifdef _X_ROOT_STATS
   4.298 -int icbrt_loopcount;
   4.299 -#endif
   4.300 -
   4.301 -/* Newton's Method:  x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */
   4.302 -
   4.303 -/* for cube roots, x^3 - a = 0,  x_new = x - 1/3 (x - a/x^2) */
   4.304 -
   4.305 -/*
   4.306 - * Quick and dirty cube roots.  Nothing fancy here, just Newton's method.
   4.307 - * Only works for positive integers (since that's all we need).
   4.308 - * We actually return floor(cbrt(a)) because that's what we need here, too.
   4.309 - */
   4.310 -
   4.311 -static int
   4.312 -icbrt_with_guess(int a, int guess)
   4.313 -{
   4.314 -    register int delta;
   4.315 -
   4.316 -#ifdef _X_ROOT_STATS
   4.317 -    icbrt_loopcount = 0;
   4.318 -#endif
   4.319 -    if (a <= 0)
   4.320 -        return 0;
   4.321 -    if (guess < 1)
   4.322 -        guess = 1;
   4.323 -
   4.324 -    do {
   4.325 -#ifdef _X_ROOT_STATS
   4.326 -        icbrt_loopcount++;
   4.327 -#endif
   4.328 -        delta = (guess - a / (guess * guess)) / 3;
   4.329 -#ifdef DEBUG
   4.330 -        printf("pass %d: guess=%d, delta=%d\n", icbrt_loopcount, guess,
   4.331 -               delta);
   4.332 -#endif
   4.333 -        guess -= delta;
   4.334 -    } while (delta != 0);
   4.335 -
   4.336 -    if (guess * guess * guess > a)
   4.337 -        guess--;
   4.338 -
   4.339 -    return guess;
   4.340 -}
     5.1 --- a/src/video/Xext/XmuStdCmap/CrCmap.c	Fri Feb 04 18:05:20 2011 -0800
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,531 +0,0 @@
     5.4 -/* $Xorg: CrCmap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
     5.5 -
     5.6 -/* 
     5.7 -
     5.8 -Copyright 1989, 1998  The Open Group
     5.9 -
    5.10 -Permission to use, copy, modify, distribute, and sell this software and its
    5.11 -documentation for any purpose is hereby granted without fee, provided that
    5.12 -the above copyright notice appear in all copies and that both that
    5.13 -copyright notice and this permission notice appear in supporting
    5.14 -documentation.
    5.15 -
    5.16 -The above copyright notice and this permission notice shall be included in
    5.17 -all copies or substantial portions of the Software.
    5.18 -
    5.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    5.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    5.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    5.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    5.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    5.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    5.25 -
    5.26 -Except as contained in this notice, the name of The Open Group shall not be
    5.27 -used in advertising or otherwise to promote the sale, use or other dealings
    5.28 -in this Software without prior written authorization from The Open Group.
    5.29 -
    5.30 -*/
    5.31 -/* $XFree86: xc/lib/Xmu/CrCmap.c,v 3.6 2001/01/17 19:42:53 dawes Exp $ */
    5.32 -
    5.33 -/*
    5.34 - * Author:  Donna Converse, MIT X Consortium
    5.35 - */
    5.36 -
    5.37 -/*
    5.38 - * CreateCmap.c - given a standard colormap description, make the map.
    5.39 - */
    5.40 -
    5.41 -#ifdef HAVE_CONFIG_H
    5.42 -#include <config.h>
    5.43 -#endif
    5.44 -#include <stdio.h>
    5.45 -#include <stdlib.h>
    5.46 -#include <X11/Xlib.h>
    5.47 -#include <X11/Xutil.h>
    5.48 -#include "../extensions/StdCmap.h"
    5.49 -
    5.50 -/*
    5.51 - * Prototypes
    5.52 - */
    5.53 -/* allocate entire map Read Only */
    5.54 -static int ROmap(Display *, Colormap, unsigned long[], int, int);
    5.55 -
    5.56 -/* allocate a cell, prefer Read Only */
    5.57 -static Status ROorRWcell(Display *, Colormap, unsigned long[], int,
    5.58 -                         XColor *, unsigned long);
    5.59 -
    5.60 -/* allocate a cell Read Write */
    5.61 -static Status RWcell(Display *, Colormap, XColor *, XColor *,
    5.62 -                     unsigned long *);
    5.63 -
    5.64 -/* for quicksort */
    5.65 -static int compare(_Xconst void *, _Xconst void *);
    5.66 -
    5.67 -/* find contiguous sequence of cells */
    5.68 -static Status contiguous(unsigned long[], int, int, unsigned long, int *,
    5.69 -                         int *);
    5.70 -
    5.71 -/* frees resources before quitting */
    5.72 -static void free_cells(Display *, Colormap, unsigned long[], int, int);
    5.73 -
    5.74 -/* create a map in a RO visual type */
    5.75 -static Status readonly_map(Display *, XVisualInfo *, XStandardColormap *);
    5.76 -
    5.77 -/* create a map in a RW visual type */
    5.78 -static Status readwrite_map(Display *, XVisualInfo *, XStandardColormap *);
    5.79 -
    5.80 -#define lowbit(x) ((x) & (~(x) + 1))
    5.81 -#define TRUEMATCH(mult,max,mask) \
    5.82 -    (colormap->max * colormap->mult <= vinfo->mask && \
    5.83 -     lowbit(vinfo->mask) == colormap->mult)
    5.84 -
    5.85 -/*
    5.86 - * To create any one colormap which is described by an XStandardColormap
    5.87 - * structure, use XmuCreateColormap().
    5.88 - *
    5.89 - * Return 0 on failure, non-zero on success.
    5.90 - * Resources created by this function are not made permanent.
    5.91 - * No argument error checking is provided.  Use at your own risk.
    5.92 - *
    5.93 - * All colormaps are created with read only allocations, with the exception
    5.94 - * of read only allocations of colors in the default map or otherwise
    5.95 - * which fail to return the expected pixel value, and these are individually 
    5.96 - * defined as read/write allocations.  This is done so that all the cells
    5.97 - * defined in the default map are contiguous, for use in image processing.
    5.98 - * This typically happens with White and Black in the default map.
    5.99 - *
   5.100 - * Colormaps of static visuals are considered to be successfully created if
   5.101 - * the map of the static visual matches the definition given in the
   5.102 - * standard colormap structure.
   5.103 - */
   5.104 -
   5.105 -Status
   5.106 -XmuCreateColormap(Display * dpy, XStandardColormap * colormap)
   5.107 -     /* dpy      - specifies the connection under which the map is created
   5.108 -      * colormap - specifies the map to be created, and returns, particularly
   5.109 -      *            if the map is created as a subset of the default colormap
   5.110 -      *            of the screen, the base_pixel of the map.
   5.111 -      */
   5.112 -{
   5.113 -    XVisualInfo vinfo_template; /* template visual information */
   5.114 -    XVisualInfo *vinfo;         /* matching visual information */
   5.115 -    XVisualInfo *vpointer;      /* for freeing the entire list */
   5.116 -    long vinfo_mask;            /* specifies the visual mask value */
   5.117 -    int n;                      /* number of matching visuals */
   5.118 -    int status;
   5.119 -
   5.120 -    vinfo_template.visualid = colormap->visualid;
   5.121 -    vinfo_mask = VisualIDMask;
   5.122 -    if ((vinfo =
   5.123 -         XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
   5.124 -        return 0;
   5.125 -
   5.126 -    /* A visual id may be valid on multiple screens.  Also, there may 
   5.127 -     * be multiple visuals with identical visual ids at different depths.  
   5.128 -     * If the colormap is the Default Colormap, use the Default Visual.
   5.129 -     * Otherwise, arbitrarily, use the deepest visual.
   5.130 -     */
   5.131 -    vpointer = vinfo;
   5.132 -    if (n > 1) {
   5.133 -        register int i;
   5.134 -        register int screen_number;
   5.135 -        Bool def_cmap;
   5.136 -
   5.137 -        def_cmap = False;
   5.138 -        for (screen_number = ScreenCount(dpy); --screen_number >= 0;)
   5.139 -            if (colormap->colormap == DefaultColormap(dpy, screen_number)) {
   5.140 -                def_cmap = True;
   5.141 -                break;
   5.142 -            }
   5.143 -
   5.144 -        if (def_cmap) {
   5.145 -            for (i = 0; i < n; i++, vinfo++) {
   5.146 -                if (vinfo->visual == DefaultVisual(dpy, screen_number))
   5.147 -                    break;
   5.148 -            }
   5.149 -        } else {
   5.150 -            int maxdepth = 0;
   5.151 -            XVisualInfo *v = NULL;
   5.152 -
   5.153 -            for (i = 0; i < n; i++, vinfo++)
   5.154 -                if (vinfo->depth > maxdepth) {
   5.155 -                    maxdepth = vinfo->depth;
   5.156 -                    v = vinfo;
   5.157 -                }
   5.158 -            vinfo = v;
   5.159 -        }
   5.160 -    }
   5.161 -
   5.162 -    if (vinfo->class == PseudoColor || vinfo->class == DirectColor ||
   5.163 -        vinfo->class == GrayScale)
   5.164 -        status = readwrite_map(dpy, vinfo, colormap);
   5.165 -    else if (vinfo->class == TrueColor)
   5.166 -        status = TRUEMATCH(red_mult, red_max, red_mask) &&
   5.167 -            TRUEMATCH(green_mult, green_max, green_mask) &&
   5.168 -            TRUEMATCH(blue_mult, blue_max, blue_mask);
   5.169 -    else
   5.170 -        status = readonly_map(dpy, vinfo, colormap);
   5.171 -
   5.172 -    XFree((char *) vpointer);
   5.173 -    return status;
   5.174 -}
   5.175 -
   5.176 -/****************************************************************************/
   5.177 -static Status
   5.178 -readwrite_map(Display * dpy, XVisualInfo * vinfo,
   5.179 -              XStandardColormap * colormap)
   5.180 -{
   5.181 -    register unsigned long i, n;        /* index counters */
   5.182 -    unsigned long ncolors;      /* number of colors to be defined */
   5.183 -    int npixels;                /* number of pixels allocated R/W */
   5.184 -    int first_index;            /* first index of pixels to use */
   5.185 -    int remainder;              /* first index of remainder */
   5.186 -    XColor color;               /* the definition of a color */
   5.187 -    unsigned long *pixels;      /* array of colormap pixels */
   5.188 -    unsigned long delta;
   5.189 -
   5.190 -
   5.191 -    /* Determine ncolors, the number of colors to be defined.
   5.192 -     * Insure that 1 < ncolors <= the colormap size.
   5.193 -     */
   5.194 -    if (vinfo->class == DirectColor) {
   5.195 -        ncolors = colormap->red_max;
   5.196 -        if (colormap->green_max > ncolors)
   5.197 -            ncolors = colormap->green_max;
   5.198 -        if (colormap->blue_max > ncolors)
   5.199 -            ncolors = colormap->blue_max;
   5.200 -        ncolors++;
   5.201 -        delta = lowbit(vinfo->red_mask) +
   5.202 -            lowbit(vinfo->green_mask) + lowbit(vinfo->blue_mask);
   5.203 -    } else {
   5.204 -        ncolors = colormap->red_max * colormap->red_mult +
   5.205 -            colormap->green_max * colormap->green_mult +
   5.206 -            colormap->blue_max * colormap->blue_mult + 1;
   5.207 -        delta = 1;
   5.208 -    }
   5.209 -    if (ncolors <= 1 || (int) ncolors > vinfo->colormap_size)
   5.210 -        return 0;
   5.211 -
   5.212 -    /* Allocate Read/Write as much of the colormap as we can possibly get.
   5.213 -     * Then insure that the pixels we were allocated are given in 
   5.214 -     * monotonically increasing order, using a quicksort.  Next, insure
   5.215 -     * that our allocation includes a subset of contiguous pixels at least
   5.216 -     * as long as the number of colors to be defined.  Now we know that 
   5.217 -     * these conditions are met:
   5.218 -     *  1) There are no free cells in the colormap.
   5.219 -     *  2) We have a contiguous sequence of pixels, monotonically 
   5.220 -     *     increasing, of length >= the number of colors requested.
   5.221 -     *
   5.222 -     * One cell at a time, we will free, compute the next color value, 
   5.223 -     * then allocate read only.  This takes a long time.
   5.224 -     * This is done to insure that cells are allocated read only in the
   5.225 -     * contiguous order which we prefer.  If the server has a choice of
   5.226 -     * cells to grant to an allocation request, the server may give us any
   5.227 -     * cell, so that is why we do these slow gymnastics.
   5.228 -     */
   5.229 -
   5.230 -    if ((pixels = (unsigned long *) calloc((unsigned) vinfo->colormap_size,
   5.231 -                                           sizeof(unsigned long))) == NULL)
   5.232 -        return 0;
   5.233 -
   5.234 -    if ((npixels = ROmap(dpy, colormap->colormap, pixels,
   5.235 -                         vinfo->colormap_size, ncolors)) == 0) {
   5.236 -        free((char *) pixels);
   5.237 -        return 0;
   5.238 -    }
   5.239 -
   5.240 -    qsort((char *) pixels, npixels, sizeof(unsigned long), compare);
   5.241 -
   5.242 -    if (!contiguous
   5.243 -        (pixels, npixels, ncolors, delta, &first_index, &remainder)) {
   5.244 -        /* can't find enough contiguous cells, give up */
   5.245 -        XFreeColors(dpy, colormap->colormap, pixels, npixels,
   5.246 -                    (unsigned long) 0);
   5.247 -        free((char *) pixels);
   5.248 -        return 0;
   5.249 -    }
   5.250 -    colormap->base_pixel = pixels[first_index];
   5.251 -
   5.252 -    /* construct a gray map */
   5.253 -    if (colormap->red_mult == 1 && colormap->green_mult == 1 &&
   5.254 -        colormap->blue_mult == 1)
   5.255 -        for (n = colormap->base_pixel, i = 0; i < ncolors; i++, n += delta) {
   5.256 -            color.pixel = n;
   5.257 -            color.blue = color.green = color.red =
   5.258 -                (unsigned short) ((i * 65535) / (colormap->red_max +
   5.259 -                                                 colormap->green_max +
   5.260 -                                                 colormap->blue_max));
   5.261 -
   5.262 -            if (!ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
   5.263 -                            first_index + i))
   5.264 -                return 0;
   5.265 -        }
   5.266 -
   5.267 -    /* construct a red ramp map */
   5.268 -    else if (colormap->green_max == 0 && colormap->blue_max == 0)
   5.269 -        for (n = colormap->base_pixel, i = 0; i < ncolors; i++, n += delta) {
   5.270 -            color.pixel = n;
   5.271 -            color.red = (unsigned short) ((i * 65535) / colormap->red_max);
   5.272 -            color.green = color.blue = 0;
   5.273 -
   5.274 -            if (!ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
   5.275 -                            first_index + i))
   5.276 -                return 0;
   5.277 -        }
   5.278 -
   5.279 -    /* construct a green ramp map */
   5.280 -    else if (colormap->red_max == 0 && colormap->blue_max == 0)
   5.281 -        for (n = colormap->base_pixel, i = 0; i < ncolors; i++, n += delta) {
   5.282 -            color.pixel = n;
   5.283 -            color.green =
   5.284 -                (unsigned short) ((i * 65535) / colormap->green_max);
   5.285 -            color.red = color.blue = 0;
   5.286 -
   5.287 -            if (!ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
   5.288 -                            first_index + i))
   5.289 -                return 0;
   5.290 -        }
   5.291 -
   5.292 -    /* construct a blue ramp map */
   5.293 -    else if (colormap->red_max == 0 && colormap->green_max == 0)
   5.294 -        for (n = colormap->base_pixel, i = 0; i < ncolors; i++, n += delta) {
   5.295 -            color.pixel = n;
   5.296 -            color.blue = (unsigned short) ((i * 65535) / colormap->blue_max);
   5.297 -            color.red = color.green = 0;
   5.298 -
   5.299 -            if (!ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
   5.300 -                            first_index + i))
   5.301 -                return 0;
   5.302 -        }
   5.303 -
   5.304 -    /* construct a standard red green blue cube map */
   5.305 -    else {
   5.306 -#define calc(max,mult) (((n / colormap->mult) % \
   5.307 -			 (colormap->max + 1)) * 65535) / colormap->max
   5.308 -
   5.309 -        for (n = 0, i = 0; i < ncolors; i++, n += delta) {
   5.310 -            color.pixel = n + colormap->base_pixel;
   5.311 -            color.red = calc(red_max, red_mult);
   5.312 -            color.green = calc(green_max, green_mult);
   5.313 -            color.blue = calc(blue_max, blue_mult);
   5.314 -            if (!ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
   5.315 -                            first_index + i))
   5.316 -                return 0;
   5.317 -        }
   5.318 -#undef calc
   5.319 -    }
   5.320 -    /* We have a read-only map defined.  Now free unused cells,
   5.321 -     * first those occuring before the contiguous sequence begins,
   5.322 -     * then any following the contiguous sequence.
   5.323 -     */
   5.324 -
   5.325 -    if (first_index)
   5.326 -        XFreeColors(dpy, colormap->colormap, pixels, first_index,
   5.327 -                    (unsigned long) 0);
   5.328 -    if (remainder)
   5.329 -        XFreeColors(dpy, colormap->colormap,
   5.330 -                    &(pixels[first_index + ncolors]), remainder,
   5.331 -                    (unsigned long) 0);
   5.332 -
   5.333 -    free((char *) pixels);
   5.334 -    return 1;
   5.335 -}
   5.336 -
   5.337 -
   5.338 -/****************************************************************************/
   5.339 -static int
   5.340 -ROmap(Display * dpy, Colormap cmap, unsigned long pixels[], int m, int n)
   5.341 -     /*
   5.342 -      * dpy     - the X server connection
   5.343 -      * cmap    - specifies colormap ID
   5.344 -      * pixels  - returns pixel allocations
   5.345 -      * m       - specifies colormap size
   5.346 -      * n       - specifies number of colors
   5.347 -      */
   5.348 -{
   5.349 -    register int p;
   5.350 -
   5.351 -    /* first try to allocate the entire colormap */
   5.352 -    if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
   5.353 -                         (unsigned) 0, pixels, (unsigned) m))
   5.354 -        return m;
   5.355 -
   5.356 -    /* Allocate all available cells in the colormap, using a binary
   5.357 -     * algorithm to discover how many cells we can allocate in the colormap.
   5.358 -     */
   5.359 -    m--;
   5.360 -    while (n <= m) {
   5.361 -        p = n + ((m - n + 1) / 2);
   5.362 -        if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
   5.363 -                             (unsigned) 0, pixels, (unsigned) p)) {
   5.364 -            if (p == m)
   5.365 -                return p;
   5.366 -            else {
   5.367 -                XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
   5.368 -                n = p;
   5.369 -            }
   5.370 -        } else
   5.371 -            m = p - 1;
   5.372 -    }
   5.373 -    return 0;
   5.374 -}
   5.375 -
   5.376 -
   5.377 -/****************************************************************************/
   5.378 -static Status
   5.379 -contiguous(unsigned long pixels[], int npixels, int ncolors,
   5.380 -           unsigned long delta, int *first, int *rem)
   5.381 -     /* pixels  - specifies allocated pixels
   5.382 -      * npixels - specifies count of alloc'd pixels
   5.383 -      * ncolors - specifies needed sequence length
   5.384 -      * delta   - between pixels
   5.385 -      * first   - returns first index of sequence
   5.386 -      * rem     - returns first index after sequence, or 0, if none follow
   5.387 -      */
   5.388 -{
   5.389 -    register int i = 1;         /* walking index into the pixel array */
   5.390 -    register int count = 1;     /* length of sequence discovered so far */
   5.391 -
   5.392 -    *first = 0;
   5.393 -    if (npixels == ncolors) {
   5.394 -        *rem = 0;
   5.395 -        return 1;
   5.396 -    }
   5.397 -    *rem = npixels - 1;
   5.398 -    while (count < ncolors && ncolors - count <= *rem) {
   5.399 -        if (pixels[i - 1] + delta == pixels[i])
   5.400 -            count++;
   5.401 -        else {
   5.402 -            count = 1;
   5.403 -            *first = i;
   5.404 -        }
   5.405 -        i++;
   5.406 -        (*rem)--;
   5.407 -    }
   5.408 -    if (count != ncolors)
   5.409 -        return 0;
   5.410 -    return 1;
   5.411 -}
   5.412 -
   5.413 -
   5.414 -/****************************************************************************/
   5.415 -static Status
   5.416 -ROorRWcell(Display * dpy, Colormap cmap, unsigned long pixels[],
   5.417 -           int npixels, XColor * color, unsigned long p)
   5.418 -{
   5.419 -    unsigned long pixel;
   5.420 -    XColor request;
   5.421 -
   5.422 -    /* Free the read/write allocation of one cell in the colormap.
   5.423 -     * Request a read only allocation of one cell in the colormap.
   5.424 -     * If the read only allocation cannot be granted, give up, because
   5.425 -     * there must be no free cells in the colormap.
   5.426 -     * If the read only allocation is granted, but gives us a cell which
   5.427 -     * is not the one that we just freed, it is probably the case that
   5.428 -     * we are trying allocate White or Black or some other color which
   5.429 -     * already has a read-only allocation in the map.  So we try to 
   5.430 -     * allocate the previously freed cell with a read/write allocation,
   5.431 -     * because we want contiguous cells for image processing algorithms.
   5.432 -     */
   5.433 -
   5.434 -    pixel = color->pixel;
   5.435 -    request.red = color->red;
   5.436 -    request.green = color->green;
   5.437 -    request.blue = color->blue;
   5.438 -
   5.439 -    XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
   5.440 -    if (!XAllocColor(dpy, cmap, color)
   5.441 -        || (color->pixel != pixel &&
   5.442 -            (!RWcell(dpy, cmap, color, &request, &pixel)))) {
   5.443 -        free_cells(dpy, cmap, pixels, npixels, (int) p);
   5.444 -        return 0;
   5.445 -    }
   5.446 -    return 1;
   5.447 -}
   5.448 -
   5.449 -
   5.450 -/****************************************************************************/
   5.451 -static void
   5.452 -free_cells(Display * dpy, Colormap cmap, unsigned long pixels[],
   5.453 -           int npixels, int p)
   5.454 -     /*
   5.455 -      * pixels  - to be freed
   5.456 -      * npixels - original number allocated
   5.457 -      */
   5.458 -{
   5.459 -    /* One of the npixels allocated has already been freed.
   5.460 -     * p is the index of the freed pixel.
   5.461 -     * First free the pixels preceeding p, and there are p of them;
   5.462 -     * then free the pixels following p, there are npixels - p - 1 of them.
   5.463 -     */
   5.464 -    XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
   5.465 -    XFreeColors(dpy, cmap, &(pixels[p + 1]), npixels - p - 1,
   5.466 -                (unsigned long) 0);
   5.467 -    free((char *) pixels);
   5.468 -}
   5.469 -
   5.470 -
   5.471 -/****************************************************************************/
   5.472 -static Status
   5.473 -RWcell(Display * dpy, Colormap cmap, XColor * color, XColor * request,
   5.474 -       unsigned long *pixel)
   5.475 -{
   5.476 -    unsigned long n = *pixel;
   5.477 -
   5.478 -    XFreeColors(dpy, cmap, &(color->pixel), 1, (unsigned long) 0);
   5.479 -    if (!XAllocColorCells(dpy, cmap, (Bool) 0, (unsigned long *) NULL,
   5.480 -                          (unsigned) 0, pixel, (unsigned) 1))
   5.481 -        return 0;
   5.482 -    if (*pixel != n) {
   5.483 -        XFreeColors(dpy, cmap, pixel, 1, (unsigned long) 0);
   5.484 -        return 0;
   5.485 -    }
   5.486 -    color->pixel = *pixel;
   5.487 -    color->flags = DoRed | DoGreen | DoBlue;
   5.488 -    color->red = request->red;
   5.489 -    color->green = request->green;
   5.490 -    color->blue = request->blue;
   5.491 -    XStoreColors(dpy, cmap, color, 1);
   5.492 -    return 1;
   5.493 -}
   5.494 -
   5.495 -
   5.496 -/****************************************************************************/
   5.497 -static int
   5.498 -compare(_Xconst void *e1, _Xconst void *e2)
   5.499 -{
   5.500 -    return ((int) (*(long *) e1 - *(long *) e2));
   5.501 -}
   5.502 -
   5.503 -
   5.504 -/****************************************************************************/
   5.505 -static Status
   5.506 -readonly_map(Display * dpy, XVisualInfo * vinfo, XStandardColormap * colormap)
   5.507 -{
   5.508 -    int i, last_pixel;
   5.509 -    XColor color;
   5.510 -
   5.511 -    last_pixel = (colormap->red_max + 1) * (colormap->green_max + 1) *
   5.512 -        (colormap->blue_max + 1) + colormap->base_pixel - 1;
   5.513 -
   5.514 -    for (i = colormap->base_pixel; i <= last_pixel; i++) {
   5.515 -
   5.516 -        color.pixel = (unsigned long) i;
   5.517 -        color.red = (unsigned short)
   5.518 -            (((i / colormap->red_mult) * 65535) / colormap->red_max);
   5.519 -
   5.520 -        if (vinfo->class == StaticColor) {
   5.521 -            color.green = (unsigned short)
   5.522 -                ((((i / colormap->green_mult) % (colormap->green_max + 1)) *
   5.523 -                  65535) / colormap->green_max);
   5.524 -            color.blue = (unsigned short)
   5.525 -                (((i % colormap->green_mult) * 65535) / colormap->blue_max);
   5.526 -        } else                  /* vinfo->class == GrayScale, old style allocation XXX */
   5.527 -            color.green = color.blue = color.red;
   5.528 -
   5.529 -        XAllocColor(dpy, colormap->colormap, &color);
   5.530 -        if (color.pixel != (unsigned long) i)
   5.531 -            return 0;
   5.532 -    }
   5.533 -    return 1;
   5.534 -}
     6.1 --- a/src/video/Xext/XmuStdCmap/DelCmap.c	Fri Feb 04 18:05:20 2011 -0800
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,71 +0,0 @@
     6.4 -/* $Xorg: DelCmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
     6.5 -
     6.6 -/* 
     6.7 - 
     6.8 -Copyright 1989, 1998  The Open Group
     6.9 -
    6.10 -Permission to use, copy, modify, distribute, and sell this software and its
    6.11 -documentation for any purpose is hereby granted without fee, provided that
    6.12 -the above copyright notice appear in all copies and that both that
    6.13 -copyright notice and this permission notice appear in supporting
    6.14 -documentation.
    6.15 -
    6.16 -The above copyright notice and this permission notice shall be included in
    6.17 -all copies or substantial portions of the Software.
    6.18 -
    6.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    6.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    6.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    6.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    6.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    6.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    6.25 -
    6.26 -Except as contained in this notice, the name of The Open Group shall not be
    6.27 -used in advertising or otherwise to promote the sale, use or other dealings
    6.28 -in this Software without prior written authorization from The Open Group.
    6.29 -
    6.30 -*/
    6.31 -/* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.6 2001/01/17 19:42:54 dawes Exp $ */
    6.32 -
    6.33 -/*
    6.34 - * Author:  Donna Converse, MIT X Consortium
    6.35 - */
    6.36 -
    6.37 -#ifdef HAVE_CONFIG_H
    6.38 -#include <config.h>
    6.39 -#endif
    6.40 -#include <X11/Xlib.h>
    6.41 -#include <X11/Xutil.h>
    6.42 -#include "../extensions/StdCmap.h"
    6.43 -
    6.44 -/* To remove any standard colormap property, use XmuDeleteStandardColormap().
    6.45 - * XmuDeleteStandardColormap() will remove the specified property from the
    6.46 - * specified screen, releasing any resources used by the colormap(s) of the
    6.47 - * property if possible.
    6.48 - */
    6.49 -
    6.50 -void
    6.51 -XmuDeleteStandardColormap(Display * dpy, int screen, Atom property)
    6.52 -     /* dpy;            - specifies the X server to connect to
    6.53 -      * screen          - specifies the screen of the display
    6.54 -      * property        - specifies the standard colormap property
    6.55 -      */
    6.56 -{
    6.57 -    XStandardColormap *stdcmaps, *s;
    6.58 -    int count = 0;
    6.59 -
    6.60 -    if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
    6.61 -                         property)) {
    6.62 -        for (s = stdcmaps; count > 0; count--, s++) {
    6.63 -            if ((s->killid == ReleaseByFreeingColormap) &&
    6.64 -                (s->colormap != None) &&
    6.65 -                (s->colormap != DefaultColormap(dpy, screen)))
    6.66 -                XFreeColormap(dpy, s->colormap);
    6.67 -            else if (s->killid != None)
    6.68 -                XKillClient(dpy, s->killid);
    6.69 -        }
    6.70 -        XDeleteProperty(dpy, RootWindow(dpy, screen), property);
    6.71 -        XFree((char *) stdcmaps);
    6.72 -        XSync(dpy, False);
    6.73 -    }
    6.74 -}
     7.1 --- a/src/video/Xext/XmuStdCmap/Distinct.c	Fri Feb 04 18:05:20 2011 -0800
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,90 +0,0 @@
     7.4 -/* $Xorg: Distinct.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
     7.5 -
     7.6 -/*
     7.7 -
     7.8 -Copyright 1990, 1998  The Open Group
     7.9 -
    7.10 -Permission to use, copy, modify, distribute, and sell this software and its
    7.11 -documentation for any purpose is hereby granted without fee, provided that
    7.12 -the above copyright notice appear in all copies and that both that
    7.13 -copyright notice and this permission notice appear in supporting
    7.14 -documentation.
    7.15 -
    7.16 -The above copyright notice and this permission notice shall be included in
    7.17 -all copies or substantial portions of the Software.
    7.18 -
    7.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    7.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    7.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    7.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    7.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    7.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    7.25 -
    7.26 -Except as contained in this notice, the name of The Open Group shall not be
    7.27 -used in advertising or otherwise to promote the sale, use or other dealings
    7.28 -in this Software without prior written authorization from The Open Group.
    7.29 -
    7.30 -*/
    7.31 -/* $XFree86: xc/lib/Xmu/Distinct.c,v 3.5 2001/07/25 15:04:50 dawes Exp $ */
    7.32 -
    7.33 -/*
    7.34 - * Author:  Keith Packard, MIT X Consortium
    7.35 - */
    7.36 -
    7.37 -#ifdef HAVE_CONFIG_H
    7.38 -#include <config.h>
    7.39 -#endif
    7.40 -#include <X11/Xlib.h>
    7.41 -#include <stdlib.h>
    7.42 -#include <X11/Xutil.h>
    7.43 -#include "../extensions/StdCmap.h"
    7.44 -
    7.45 -/*
    7.46 - * Distinguishable colors routine.  Determines if two colors are
    7.47 - * distinguishable or not.  Somewhat arbitrary meaning.
    7.48 - */
    7.49 -
    7.50 -#define MIN_DISTINGUISH	10000.0
    7.51 -
    7.52 -Bool
    7.53 -XmuDistinguishableColors(XColor * colors, int count)
    7.54 -{
    7.55 -    double deltaRed, deltaGreen, deltaBlue;
    7.56 -    double dist;
    7.57 -    int i, j;
    7.58 -
    7.59 -    for (i = 0; i < count - 1; i++)
    7.60 -        for (j = i + 1; j < count; j++) {
    7.61 -            deltaRed = (double) colors[i].red - (double) colors[j].red;
    7.62 -            deltaGreen = (double) colors[i].green - (double) colors[j].green;
    7.63 -            deltaBlue = (double) colors[i].blue - (double) colors[j].blue;
    7.64 -            dist = deltaRed * deltaRed +
    7.65 -                deltaGreen * deltaGreen + deltaBlue * deltaBlue;
    7.66 -            if (dist <= MIN_DISTINGUISH * MIN_DISTINGUISH)
    7.67 -                return False;
    7.68 -        }
    7.69 -    return True;
    7.70 -}
    7.71 -
    7.72 -Bool
    7.73 -XmuDistinguishablePixels(Display * dpy, Colormap cmap,
    7.74 -                         unsigned long *pixels, int count)
    7.75 -{
    7.76 -    XColor *defs;
    7.77 -    int i, j;
    7.78 -    Bool ret;
    7.79 -
    7.80 -    for (i = 0; i < count - 1; i++)
    7.81 -        for (j = i + 1; j < count; j++)
    7.82 -            if (pixels[i] == pixels[j])
    7.83 -                return False;
    7.84 -    defs = (XColor *) malloc(count * sizeof(XColor));
    7.85 -    if (!defs)
    7.86 -        return False;
    7.87 -    for (i = 0; i < count; i++)
    7.88 -        defs[i].pixel = pixels[i];
    7.89 -    XQueryColors(dpy, cmap, defs, count);
    7.90 -    ret = XmuDistinguishableColors(defs, count);
    7.91 -    free((char *) defs);
    7.92 -    return ret;
    7.93 -}
     8.1 --- a/src/video/Xext/XmuStdCmap/LookupCmap.c	Fri Feb 04 18:05:20 2011 -0800
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,323 +0,0 @@
     8.4 -/* $Xorg: LookupCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
     8.5 -
     8.6 -/* 
     8.7 - 
     8.8 -Copyright 1989, 1998  The Open Group
     8.9 -
    8.10 -Permission to use, copy, modify, distribute, and sell this software and its
    8.11 -documentation for any purpose is hereby granted without fee, provided that
    8.12 -the above copyright notice appear in all copies and that both that
    8.13 -copyright notice and this permission notice appear in supporting
    8.14 -documentation.
    8.15 -
    8.16 -The above copyright notice and this permission notice shall be included in
    8.17 -all copies or substantial portions of the Software.
    8.18 -
    8.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    8.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    8.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    8.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    8.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    8.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    8.25 -
    8.26 -Except as contained in this notice, the name of The Open Group shall not be
    8.27 -used in advertising or otherwise to promote the sale, use or other dealings
    8.28 -in this Software without prior written authorization from The Open Group.
    8.29 -
    8.30 -*/
    8.31 -/* $XFree86: xc/lib/Xmu/LookupCmap.c,v 1.7 2001/07/25 15:04:50 dawes Exp $ */
    8.32 -
    8.33 -/*
    8.34 - * Author:  Donna Converse, MIT X Consortium
    8.35 - */
    8.36 -
    8.37 -#ifdef HAVE_CONFIG_H
    8.38 -#include <config.h>
    8.39 -#endif
    8.40 -#include <stdio.h>
    8.41 -#include <X11/Xlib.h>
    8.42 -#include <X11/Xatom.h>
    8.43 -#include <X11/Xutil.h>
    8.44 -#include "../extensions/StdCmap.h"
    8.45 -#include <stdlib.h>
    8.46 -
    8.47 -/*
    8.48 - * Prototypes
    8.49 - */
    8.50 -static Status lookup(Display *, int, VisualID, Atom, XStandardColormap *,
    8.51 -                     Bool);
    8.52 -
    8.53 -/*
    8.54 - * To create a standard colormap if one does not currently exist, or
    8.55 - * replace the currently existing standard colormap, use 
    8.56 - * XmuLookupStandardColormap().
    8.57 - *
    8.58 - * Given a screen, a visual, and a property, XmuLookupStandardColormap()
    8.59 - * will determine the best allocation for the property under the specified
    8.60 - * visual, and determine the whether to create a new colormap or to use
    8.61 - * the default colormap of the screen.  It will call XmuStandardColormap()
    8.62 - * to create the standard colormap.
    8.63 - *
    8.64 - * If replace is true, any previous definition of the property will be 
    8.65 - * replaced.  If retain is true, the property and the colormap will be
    8.66 - * made permanent for the duration of the server session.  However,
    8.67 - * pre-existing property definitions which are not replaced cannot be made
    8.68 - * permanent by a call to XmuLookupStandardColormap(); a request to retain 
    8.69 - * resources pertains to newly created resources.
    8.70 - *
    8.71 - * Returns 0 on failure, non-zero on success.  A request to create a 
    8.72 - * standard colormap upon a visual which cannot support such a map is
    8.73 - * considered a failure.  An example of this would be requesting any
    8.74 - * standard colormap property on a monochrome visual, or, requesting an
    8.75 - * RGB_BEST_MAP on a display whose colormap size is 16.
    8.76 - */
    8.77 -
    8.78 -Status
    8.79 -XmuLookupStandardColormap(Display * dpy, int screen, VisualID visualid,
    8.80 -                          unsigned int depth, Atom property,
    8.81 -                          Bool replace, Bool retain)
    8.82 -     /*
    8.83 -      * dpy             - specifies X server connection
    8.84 -      * screen          - specifies screen of display
    8.85 -      * visualid        - specifies the visual type
    8.86 -      * depth           - specifies  the visual type
    8.87 -      * property        - a standard colormap property
    8.88 -      * replace         - specifies whether to replace
    8.89 -      * retain          - specifies whether to retain
    8.90 -      */
    8.91 -{
    8.92 -    Display *odpy;              /* original display connection */
    8.93 -    XStandardColormap *colormap;
    8.94 -    XVisualInfo vinfo_template, *vinfo; /* visual */
    8.95 -    long vinfo_mask;
    8.96 -    unsigned long r_max, g_max, b_max;  /* allocation */
    8.97 -    int count;
    8.98 -    Colormap cmap;              /* colormap ID */
    8.99 -    Status status = 0;
   8.100 -
   8.101 -
   8.102 -    /* Match the requested visual */
   8.103 -
   8.104 -    vinfo_template.visualid = visualid;
   8.105 -    vinfo_template.screen = screen;
   8.106 -    vinfo_template.depth = depth;
   8.107 -    vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
   8.108 -    if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &count)) ==
   8.109 -        NULL)
   8.110 -        return 0;
   8.111 -
   8.112 -    /* Monochrome visuals have no standard maps */
   8.113 -
   8.114 -    if (vinfo->colormap_size <= 2) {
   8.115 -        XFree((char *) vinfo);
   8.116 -        return 0;
   8.117 -    }
   8.118 -
   8.119 -    /* If the requested property already exists on this screen, and, 
   8.120 -     * if the replace flag has not been set to true, return success.
   8.121 -     * lookup() will remove a pre-existing map if replace is true.
   8.122 -     */
   8.123 -
   8.124 -    if (lookup(dpy, screen, visualid, property, (XStandardColormap *) NULL,
   8.125 -               replace) && !replace) {
   8.126 -        XFree((char *) vinfo);
   8.127 -        return 1;
   8.128 -    }
   8.129 -
   8.130 -    /* Determine the best allocation for this property under the requested
   8.131 -     * visualid and depth, and determine whether or not to use the default
   8.132 -     * colormap of the screen.
   8.133 -     */
   8.134 -
   8.135 -    if (!XmuGetColormapAllocation(vinfo, property, &r_max, &g_max, &b_max)) {
   8.136 -        XFree((char *) vinfo);
   8.137 -        return 0;
   8.138 -    }
   8.139 -
   8.140 -    cmap = (property == XA_RGB_DEFAULT_MAP &&
   8.141 -            visualid == XVisualIDFromVisual(DefaultVisual(dpy, screen)))
   8.142 -        ? DefaultColormap(dpy, screen) : None;
   8.143 -
   8.144 -    /* If retaining resources, open a new connection to the same server */
   8.145 -
   8.146 -    if (retain) {
   8.147 -        odpy = dpy;
   8.148 -        if ((dpy = XOpenDisplay(XDisplayString(odpy))) == NULL) {
   8.149 -            XFree((char *) vinfo);
   8.150 -            return 0;
   8.151 -        }
   8.152 -    }
   8.153 -
   8.154 -    /* Create the standard colormap */
   8.155 -
   8.156 -    colormap = XmuStandardColormap(dpy, screen, visualid, depth, property,
   8.157 -                                   cmap, r_max, g_max, b_max);
   8.158 -
   8.159 -    /* Set the standard colormap property */
   8.160 -
   8.161 -    if (colormap) {
   8.162 -        XGrabServer(dpy);
   8.163 -
   8.164 -        if (lookup(dpy, screen, visualid, property, colormap, replace) &&
   8.165 -            !replace) {
   8.166 -            /* Someone has defined the property since we last looked.
   8.167 -             * Since we will not replace it, release our own resources.
   8.168 -             * If this is the default map, our allocations will be freed 
   8.169 -             * when this connection closes.
   8.170 -             */
   8.171 -            if (colormap->killid == ReleaseByFreeingColormap)
   8.172 -                XFreeColormap(dpy, colormap->colormap);
   8.173 -        } else if (retain) {
   8.174 -            XSetCloseDownMode(dpy, RetainPermanent);
   8.175 -        }
   8.176 -        XUngrabServer(dpy);
   8.177 -        XFree((char *) colormap);
   8.178 -        status = 1;
   8.179 -    }
   8.180 -
   8.181 -    if (retain)
   8.182 -        XCloseDisplay(dpy);
   8.183 -    XFree((char *) vinfo);
   8.184 -    return status;
   8.185 -}
   8.186 -
   8.187 -/***************************************************************************/
   8.188 -
   8.189 -/* Lookup a standard colormap property.  If the property is RGB_DEFAULT_MAP,
   8.190 - * the visualid is used to determine whether the indicated standard colormap
   8.191 - * exists.  If the map exists and replace is true, delete the resources used
   8.192 - * by the map and remove the property.  Return true if the map exists,
   8.193 - * or did exist and was deleted; return false if the map was not found.
   8.194 - *
   8.195 - * Note that this is not the way that a Status return is normally used.
   8.196 - *
   8.197 - * If new is not NULL, new points to an XStandardColormap structure which
   8.198 - * describes a standard colormap of the specified property.  It will be made
   8.199 - * a standard colormap of the screen if none already exists, or if replace 
   8.200 - * is true.
   8.201 - */
   8.202 -
   8.203 -static Status
   8.204 -lookup(Display * dpy, int screen, VisualID visualid, Atom property,
   8.205 -       XStandardColormap * cnew, Bool replace)
   8.206 -     /*
   8.207 -      * dpy             - specifies display connection
   8.208 -      * screen          - specifies screen number
   8.209 -      * visualid        - specifies visualid for std map
   8.210 -      * property        - specifies colormap property name
   8.211 -      * cnew            - specifies a standard colormap
   8.212 -      * replace         - specifies whether to replace
   8.213 -      */
   8.214 -{
   8.215 -    register int i;
   8.216 -    int count;
   8.217 -    XStandardColormap *stdcmaps, *s;
   8.218 -    Window win = RootWindow(dpy, screen);
   8.219 -
   8.220 -    /* The property does not already exist */
   8.221 -
   8.222 -    if (!XGetRGBColormaps(dpy, win, &stdcmaps, &count, property)) {
   8.223 -        if (cnew)
   8.224 -            XSetRGBColormaps(dpy, win, cnew, 1, property);
   8.225 -        return 0;
   8.226 -    }
   8.227 -
   8.228 -    /* The property exists and is not describing the RGB_DEFAULT_MAP */
   8.229 -
   8.230 -    if (property != XA_RGB_DEFAULT_MAP) {
   8.231 -        if (replace) {
   8.232 -            XmuDeleteStandardColormap(dpy, screen, property);
   8.233 -            if (cnew)
   8.234 -                XSetRGBColormaps(dpy, win, cnew, 1, property);
   8.235 -        }
   8.236 -        XFree((char *) stdcmaps);
   8.237 -        return 1;
   8.238 -    }
   8.239 -
   8.240 -    /* The property exists and is RGB_DEFAULT_MAP */
   8.241 -
   8.242 -    for (i = 0, s = stdcmaps; (i < count) && (s->visualid != visualid);
   8.243 -         i++, s++);
   8.244 -
   8.245 -    /* No RGB_DEFAULT_MAP property matches the given visualid */
   8.246 -
   8.247 -    if (i == count) {
   8.248 -        if (cnew) {
   8.249 -            XStandardColormap *m, *maps;
   8.250 -
   8.251 -            s = (XStandardColormap *) malloc((unsigned) ((count + 1) * sizeof
   8.252 -                                                         (XStandardColormap)));
   8.253 -
   8.254 -            for (i = 0, m = s, maps = stdcmaps; i < count; i++, m++, maps++) {
   8.255 -                m->colormap = maps->colormap;
   8.256 -                m->red_max = maps->red_max;
   8.257 -                m->red_mult = maps->red_mult;
   8.258 -                m->green_max = maps->green_max;
   8.259 -                m->green_mult = maps->green_mult;
   8.260 -                m->blue_max = maps->blue_max;
   8.261 -                m->blue_mult = maps->blue_mult;
   8.262 -                m->base_pixel = maps->base_pixel;
   8.263 -                m->visualid = maps->visualid;
   8.264 -                m->killid = maps->killid;
   8.265 -            }
   8.266 -            m->colormap = cnew->colormap;
   8.267 -            m->red_max = cnew->red_max;
   8.268 -            m->red_mult = cnew->red_mult;
   8.269 -            m->green_max = cnew->green_max;
   8.270 -            m->green_mult = cnew->green_mult;
   8.271 -            m->blue_max = cnew->blue_max;
   8.272 -            m->blue_mult = cnew->blue_mult;
   8.273 -            m->base_pixel = cnew->base_pixel;
   8.274 -            m->visualid = cnew->visualid;
   8.275 -            m->killid = cnew->killid;
   8.276 -
   8.277 -            XSetRGBColormaps(dpy, win, s, ++count, property);
   8.278 -            free((char *) s);
   8.279 -        }
   8.280 -        XFree((char *) stdcmaps);
   8.281 -        return 0;
   8.282 -    }
   8.283 -
   8.284 -    /* Found an RGB_DEFAULT_MAP property with a matching visualid */
   8.285 -
   8.286 -    if (replace) {
   8.287 -        /* Free old resources first - we may need them, particularly in 
   8.288 -         * the default colormap of the screen.  However, because of this,
   8.289 -         * it is possible that we will destroy the old resource and fail 
   8.290 -         * to create a new one if XmuStandardColormap() fails.
   8.291 -         */
   8.292 -
   8.293 -        if (count == 1) {
   8.294 -            XmuDeleteStandardColormap(dpy, screen, property);
   8.295 -            if (cnew)
   8.296 -                XSetRGBColormaps(dpy, win, cnew, 1, property);
   8.297 -        } else {
   8.298 -            XStandardColormap *map;
   8.299 -
   8.300 -            /* s still points to the matching standard colormap */
   8.301 -
   8.302 -            if (s->killid == ReleaseByFreeingColormap) {
   8.303 -                if ((s->colormap != None) &&
   8.304 -                    (s->colormap != DefaultColormap(dpy, screen)))
   8.305 -                    XFreeColormap(dpy, s->colormap);
   8.306 -            } else if (s->killid != None)
   8.307 -                XKillClient(dpy, s->killid);
   8.308 -
   8.309 -            map = (cnew) ? cnew : stdcmaps + --count;
   8.310 -
   8.311 -            s->colormap = map->colormap;
   8.312 -            s->red_max = map->red_max;
   8.313 -            s->red_mult = map->red_mult;
   8.314 -            s->green_max = map->green_max;
   8.315 -            s->green_mult = map->green_mult;
   8.316 -            s->blue_max = map->blue_max;
   8.317 -            s->blue_mult = map->blue_mult;
   8.318 -            s->visualid = map->visualid;
   8.319 -            s->killid = map->killid;
   8.320 -
   8.321 -            XSetRGBColormaps(dpy, win, stdcmaps, count, property);
   8.322 -        }
   8.323 -    }
   8.324 -    XFree((char *) stdcmaps);
   8.325 -    return 1;
   8.326 -}
     9.1 --- a/src/video/Xext/XmuStdCmap/StdCmap.c	Fri Feb 04 18:05:20 2011 -0800
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,236 +0,0 @@
     9.4 -/* $Xorg: StdCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
     9.5 -
     9.6 -/* 
     9.7 -
     9.8 -Copyright 1989, 1998  The Open Group
     9.9 -
    9.10 -Permission to use, copy, modify, distribute, and sell this software and its
    9.11 -documentation for any purpose is hereby granted without fee, provided that
    9.12 -the above copyright notice appear in all copies and that both that
    9.13 -copyright notice and this permission notice appear in supporting
    9.14 -documentation.
    9.15 -
    9.16 -The above copyright notice and this permission notice shall be included in
    9.17 -all copies or substantial portions of the Software.
    9.18 -
    9.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    9.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    9.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    9.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    9.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    9.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    9.25 -
    9.26 -Except as contained in this notice, the name of The Open Group shall not be
    9.27 -used in advertising or otherwise to promote the sale, use or other dealings
    9.28 -in this Software without prior written authorization from The Open Group.
    9.29 -
    9.30 -*/
    9.31 -/* $XFree86: xc/lib/Xmu/StdCmap.c,v 1.5 2001/01/17 19:42:56 dawes Exp $ */
    9.32 -
    9.33 -/*
    9.34 - * Author:  Donna Converse, MIT X Consortium
    9.35 - */
    9.36 -
    9.37 -#ifdef HAVE_CONFIG_H
    9.38 -#include <config.h>
    9.39 -#endif
    9.40 -#include <stdio.h>
    9.41 -#include <X11/Xlib.h>
    9.42 -#include <X11/Xatom.h>
    9.43 -#include <X11/Xutil.h>
    9.44 -#include "../extensions/StdCmap.h"
    9.45 -
    9.46 -#define lowbit(x) ((x) & (~(x) + 1))
    9.47 -
    9.48 -/*
    9.49 - * Prototypes
    9.50 - */
    9.51 -/* argument restrictions */
    9.52 -static Status valid_args(XVisualInfo *, unsigned long, unsigned long,
    9.53 -                         unsigned long, Atom);
    9.54 -
    9.55 -/*
    9.56 - * To create any one standard colormap, use XmuStandardColormap().
    9.57 - *
    9.58 - * Create a standard colormap for the given screen, visualid, and visual
    9.59 - * depth, with the given red, green, and blue maximum values, with the
    9.60 - * given standard property name.  Return a pointer to an XStandardColormap
    9.61 - * structure which describes the newly created colormap, upon success.
    9.62 - * Upon failure, return NULL.
    9.63 - * 
    9.64 - * XmuStandardColormap() calls XmuCreateColormap() to create the map.
    9.65 - *
    9.66 - * Resources created by this function are not made permanent; that is the
    9.67 - * caller's responsibility.
    9.68 - */
    9.69 -
    9.70 -XStandardColormap *
    9.71 -XmuStandardColormap(Display * dpy, int screen, VisualID visualid,
    9.72 -                    unsigned int depth, Atom property, Colormap cmap,
    9.73 -                    unsigned long red_max, unsigned long green_max,
    9.74 -                    unsigned long blue_max)
    9.75 -     /*
    9.76 -      * dpy                             - specifies X server connection
    9.77 -      * screen                          - specifies display screen
    9.78 -      * visualid                        - identifies the visual type
    9.79 -      * depth                           - identifies the visual type
    9.80 -      * property                        - a standard colormap property
    9.81 -      * cmap                            - specifies colormap ID or None
    9.82 -      * red_max, green_max, blue_max    - allocations
    9.83 -      */
    9.84 -{
    9.85 -    XStandardColormap *stdcmap;
    9.86 -    Status status;
    9.87 -    XVisualInfo vinfo_template, *vinfo;
    9.88 -    long vinfo_mask;
    9.89 -    int n;
    9.90 -
    9.91 -    /* Match the required visual information to an actual visual */
    9.92 -    vinfo_template.visualid = visualid;
    9.93 -    vinfo_template.screen = screen;
    9.94 -    vinfo_template.depth = depth;
    9.95 -    vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
    9.96 -    if ((vinfo =
    9.97 -         XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
    9.98 -        return 0;
    9.99 -
   9.100 -    /* Check the validity of the combination of visual characteristics,
   9.101 -     * allocation, and colormap property.  Create an XStandardColormap
   9.102 -     * structure.
   9.103 -     */
   9.104 -
   9.105 -    if (!valid_args(vinfo, red_max, green_max, blue_max, property)
   9.106 -        || ((stdcmap = XAllocStandardColormap()) == NULL)) {
   9.107 -        XFree((char *) vinfo);
   9.108 -        return 0;
   9.109 -    }
   9.110 -
   9.111 -    /* Fill in the XStandardColormap structure */
   9.112 -
   9.113 -    if (cmap == DefaultColormap(dpy, screen)) {
   9.114 -        /* Allocating out of the default map, cannot use XFreeColormap() */
   9.115 -        Window win = XCreateWindow(dpy, RootWindow(dpy, screen), 1, 1, 1, 1,
   9.116 -                                   0, 0, InputOnly, vinfo->visual,
   9.117 -                                   (unsigned long) 0,
   9.118 -                                   (XSetWindowAttributes *) NULL);
   9.119 -        stdcmap->killid = (XID) XCreatePixmap(dpy, win, 1, 1, depth);
   9.120 -        XDestroyWindow(dpy, win);
   9.121 -        stdcmap->colormap = cmap;
   9.122 -    } else {
   9.123 -        stdcmap->killid = ReleaseByFreeingColormap;
   9.124 -        stdcmap->colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
   9.125 -                                            vinfo->visual, AllocNone);
   9.126 -    }
   9.127 -    stdcmap->red_max = red_max;
   9.128 -    stdcmap->green_max = green_max;
   9.129 -    stdcmap->blue_max = blue_max;
   9.130 -    if (property == XA_RGB_GRAY_MAP)
   9.131 -        stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
   9.132 -    else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
   9.133 -        stdcmap->red_mult = lowbit(vinfo->red_mask);
   9.134 -        stdcmap->green_mult = lowbit(vinfo->green_mask);
   9.135 -        stdcmap->blue_mult = lowbit(vinfo->blue_mask);
   9.136 -    } else {
   9.137 -        stdcmap->red_mult = (red_max > 0)
   9.138 -            ? (green_max + 1) * (blue_max + 1) : 0;
   9.139 -        stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
   9.140 -        stdcmap->blue_mult = (blue_max > 0) ? 1 : 0;
   9.141 -    }
   9.142 -    stdcmap->base_pixel = 0;    /* base pixel may change */
   9.143 -    stdcmap->visualid = vinfo->visualid;
   9.144 -
   9.145 -    /* Make the colormap */
   9.146 -
   9.147 -    status = XmuCreateColormap(dpy, stdcmap);
   9.148 -
   9.149 -    /* Clean up */
   9.150 -
   9.151 -    XFree((char *) vinfo);
   9.152 -    if (!status) {
   9.153 -
   9.154 -        /* Free the colormap or the pixmap, if we created one */
   9.155 -        if (stdcmap->killid == ReleaseByFreeingColormap)
   9.156 -            XFreeColormap(dpy, stdcmap->colormap);
   9.157 -        else if (stdcmap->killid != None)
   9.158 -            XFreePixmap(dpy, stdcmap->killid);
   9.159 -
   9.160 -        XFree((char *) stdcmap);
   9.161 -        return (XStandardColormap *) NULL;
   9.162 -    }
   9.163 -    return stdcmap;
   9.164 -}
   9.165 -
   9.166 -/****************************************************************************/
   9.167 -static Status
   9.168 -valid_args(XVisualInfo * vinfo, unsigned long red_max,
   9.169 -           unsigned long green_max, unsigned long blue_max, Atom property)
   9.170 -     /*
   9.171 -      * vinfo                           - specifies visual
   9.172 -      * red_max, green_max, blue_max    - specifies alloc
   9.173 -      * property                        - specifies property name
   9.174 -      */
   9.175 -{
   9.176 -    unsigned long ncolors;      /* number of colors requested */
   9.177 -
   9.178 -    /* Determine that the number of colors requested is <= map size */
   9.179 -
   9.180 -    if ((vinfo->class == DirectColor) || (vinfo->class == TrueColor)) {
   9.181 -        unsigned long mask;
   9.182 -
   9.183 -        mask = vinfo->red_mask;
   9.184 -        while (!(mask & 1))
   9.185 -            mask >>= 1;
   9.186 -        if (red_max > mask)
   9.187 -            return 0;
   9.188 -        mask = vinfo->green_mask;
   9.189 -        while (!(mask & 1))
   9.190 -            mask >>= 1;
   9.191 -        if (green_max > mask)
   9.192 -            return 0;
   9.193 -        mask = vinfo->blue_mask;
   9.194 -        while (!(mask & 1))
   9.195 -            mask >>= 1;
   9.196 -        if (blue_max > mask)
   9.197 -            return 0;
   9.198 -    } else if (property == XA_RGB_GRAY_MAP) {
   9.199 -        ncolors = red_max + green_max + blue_max + 1;
   9.200 -        if (ncolors > vinfo->colormap_size)
   9.201 -            return 0;
   9.202 -    } else {
   9.203 -        ncolors = (red_max + 1) * (green_max + 1) * (blue_max + 1);
   9.204 -        if (ncolors > vinfo->colormap_size)
   9.205 -            return 0;
   9.206 -    }
   9.207 -
   9.208 -    /* Determine that the allocation and visual make sense for the property */
   9.209 -
   9.210 -    switch (property) {
   9.211 -    case XA_RGB_DEFAULT_MAP:
   9.212 -        if (red_max == 0 || green_max == 0 || blue_max == 0)
   9.213 -            return 0;
   9.214 -        break;
   9.215 -    case XA_RGB_RED_MAP:
   9.216 -        if (red_max == 0)
   9.217 -            return 0;
   9.218 -        break;
   9.219 -    case XA_RGB_GREEN_MAP:
   9.220 -        if (green_max == 0)
   9.221 -            return 0;
   9.222 -        break;
   9.223 -    case XA_RGB_BLUE_MAP:
   9.224 -        if (blue_max == 0)
   9.225 -            return 0;
   9.226 -        break;
   9.227 -    case XA_RGB_BEST_MAP:
   9.228 -        if (red_max == 0 || green_max == 0 || blue_max == 0)
   9.229 -            return 0;
   9.230 -        break;
   9.231 -    case XA_RGB_GRAY_MAP:
   9.232 -        if (red_max == 0 || blue_max == 0 || green_max == 0)
   9.233 -            return 0;
   9.234 -        break;
   9.235 -    default:
   9.236 -        return 0;
   9.237 -    }
   9.238 -    return 1;
   9.239 -}
    10.1 --- a/src/video/Xext/XmuStdCmap/VisCmap.c	Fri Feb 04 18:05:20 2011 -0800
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,184 +0,0 @@
    10.4 -/* $Xorg: VisCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
    10.5 -
    10.6 -/* 
    10.7 -
    10.8 -Copyright 1989, 1998  The Open Group
    10.9 -
   10.10 -Permission to use, copy, modify, distribute, and sell this software and its
   10.11 -documentation for any purpose is hereby granted without fee, provided that
   10.12 -the above copyright notice appear in all copies and that both that
   10.13 -copyright notice and this permission notice appear in supporting
   10.14 -documentation.
   10.15 -
   10.16 -The above copyright notice and this permission notice shall be included in
   10.17 -all copies or substantial portions of the Software.
   10.18 -
   10.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   10.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   10.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
   10.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
   10.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   10.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   10.25 -
   10.26 -Except as contained in this notice, the name of The Open Group shall not be
   10.27 -used in advertising or otherwise to promote the sale, use or other dealings
   10.28 -in this Software without prior written authorization from The Open Group.
   10.29 -
   10.30 -*/
   10.31 -/* $XFree86: xc/lib/Xmu/VisCmap.c,v 1.6 2001/01/17 19:42:57 dawes Exp $ */
   10.32 -
   10.33 -/*
   10.34 - * Author:  Donna Converse, MIT X Consortium
   10.35 - */
   10.36 -
   10.37 -#ifdef HAVE_CONFIG_H
   10.38 -#include <config.h>
   10.39 -#endif
   10.40 -#include <stdio.h>
   10.41 -#include <math.h>
   10.42 -#include <X11/Xlib.h>
   10.43 -#include <X11/Xatom.h>
   10.44 -#include <X11/Xutil.h>
   10.45 -#include "../extensions/StdCmap.h"
   10.46 -
   10.47 -/*
   10.48 - * To create all of the appropriate standard colormaps for a given visual on
   10.49 - * a given screen, use XmuVisualStandardColormaps.
   10.50 - * 
   10.51 - * Define all appropriate standard colormap properties for the given visual.
   10.52 - * If replace is true, any previous definition will be removed.
   10.53 - * If retain is true, new properties will be retained for the duration of
   10.54 - * the server session.  Return 0 on failure, non-zero on success.
   10.55 - * On failure, no new properties will be defined, and, old ones may have
   10.56 - * been removed if replace was True.
   10.57 - *
   10.58 - * Not all standard colormaps are meaningful to all visual classes.  This
   10.59 - * routine will check and define the following properties for the following
   10.60 - * classes, provided that the size of the colormap is not too small.
   10.61 - *
   10.62 - *	DirectColor and PseudoColor
   10.63 - *	    RGB_DEFAULT_MAP
   10.64 - *	    RGB_BEST_MAP
   10.65 - *	    RGB_RED_MAP
   10.66 - *	    RGB_GREEN_MAP
   10.67 - * 	    RGB_BLUE_MAP
   10.68 - *          RGB_GRAY_MAP
   10.69 - *
   10.70 - *	TrueColor and StaticColor
   10.71 - *	    RGB_BEST_MAP
   10.72 - *
   10.73 - *	GrayScale and StaticGray
   10.74 - *	    RGB_GRAY_MAP
   10.75 - */
   10.76 -
   10.77 -Status
   10.78 -XmuVisualStandardColormaps(Display * dpy, int screen, VisualID visualid,
   10.79 -                           unsigned int depth, Bool replace, Bool retain)
   10.80 -     /*
   10.81 -      * dpy                     - specifies server connection
   10.82 -      * screen                  - specifies screen number
   10.83 -      * visualid                - specifies the visual
   10.84 -      * depth                   - specifies the visual
   10.85 -      * replace specifies       - whether to replace
   10.86 -      * retain                  - specifies whether to retain
   10.87 -      */
   10.88 -{
   10.89 -    Status status;
   10.90 -    int n;
   10.91 -    long vinfo_mask;
   10.92 -    XVisualInfo vinfo_template, *vinfo;
   10.93 -
   10.94 -    status = 0;
   10.95 -    vinfo_template.screen = screen;
   10.96 -    vinfo_template.visualid = visualid;
   10.97 -    vinfo_template.depth = depth;
   10.98 -    vinfo_mask = VisualScreenMask | VisualIDMask | VisualDepthMask;
   10.99 -    if ((vinfo =
  10.100 -         XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
  10.101 -        return 0;
  10.102 -
  10.103 -    if (vinfo->colormap_size <= 2) {
  10.104 -        /* Monochrome visuals have no standard maps; considered successful */
  10.105 -        XFree((char *) vinfo);
  10.106 -        return 1;
  10.107 -    }
  10.108 -
  10.109 -    switch (vinfo->class) {
  10.110 -    case PseudoColor:
  10.111 -    case DirectColor:
  10.112 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.113 -                                           XA_RGB_DEFAULT_MAP, replace,
  10.114 -                                           retain);
  10.115 -        if (!status)
  10.116 -            break;
  10.117 -
  10.118 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.119 -                                           XA_RGB_GRAY_MAP, replace, retain);
  10.120 -        if (!status) {
  10.121 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.122 -            break;
  10.123 -        }
  10.124 -
  10.125 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.126 -                                           XA_RGB_RED_MAP, replace, retain);
  10.127 -        if (!status) {
  10.128 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.129 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
  10.130 -            break;
  10.131 -        }
  10.132 -
  10.133 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.134 -                                           XA_RGB_GREEN_MAP, replace, retain);
  10.135 -        if (!status) {
  10.136 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.137 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
  10.138 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
  10.139 -            break;
  10.140 -        }
  10.141 -
  10.142 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.143 -                                           XA_RGB_BLUE_MAP, replace, retain);
  10.144 -        if (!status) {
  10.145 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.146 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
  10.147 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
  10.148 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
  10.149 -            break;
  10.150 -        }
  10.151 -        /* fall through */
  10.152 -
  10.153 -    case StaticColor:
  10.154 -    case TrueColor:
  10.155 -
  10.156 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.157 -                                           XA_RGB_BEST_MAP, replace, retain);
  10.158 -        if (!status && (vinfo->class == PseudoColor ||
  10.159 -                        vinfo->class == DirectColor)) {
  10.160 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.161 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
  10.162 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
  10.163 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
  10.164 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_BLUE_MAP);
  10.165 -        }
  10.166 -        break;
  10.167 -        /* the end for PseudoColor, DirectColor, StaticColor, and TrueColor */
  10.168 -
  10.169 -    case GrayScale:
  10.170 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.171 -                                           XA_RGB_DEFAULT_MAP, replace,
  10.172 -                                           retain);
  10.173 -        if (!status)
  10.174 -            break;
  10.175 -     /*FALLTHROUGH*/ case StaticGray:
  10.176 -
  10.177 -        status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
  10.178 -                                           XA_RGB_GRAY_MAP, replace, retain);
  10.179 -        if (!status && vinfo->class == GrayScale) {
  10.180 -            XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
  10.181 -            break;
  10.182 -        }
  10.183 -    }
  10.184 -
  10.185 -    XFree((char *) vinfo);
  10.186 -    return status;
  10.187 -}
    11.1 --- a/src/video/Xext/extensions/StdCmap.h	Fri Feb 04 18:05:20 2011 -0800
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,80 +0,0 @@
    11.4 -/* $Xorg: StdCmap.h,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */
    11.5 -
    11.6 -/*
    11.7 - 
    11.8 -Copyright 1988, 1998  The Open Group
    11.9 -
   11.10 -Permission to use, copy, modify, distribute, and sell this software and its
   11.11 -documentation for any purpose is hereby granted without fee, provided that
   11.12 -the above copyright notice appear in all copies and that both that
   11.13 -copyright notice and this permission notice appear in supporting
   11.14 -documentation.
   11.15 -
   11.16 -The above copyright notice and this permission notice shall be included in
   11.17 -all copies or substantial portions of the Software.
   11.18 -
   11.19 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   11.20 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   11.21 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
   11.22 -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
   11.23 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   11.24 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   11.25 -
   11.26 -Except as contained in this notice, the name of The Open Group shall not be
   11.27 -used in advertising or otherwise to promote the sale, use or other dealings
   11.28 -in this Software without prior written authorization from The Open Group.
   11.29 -
   11.30 -*/
   11.31 -/* $XFree86: xc/lib/Xmu/StdCmap.h,v 1.8 2001/01/23 17:38:14 keithp Exp $ */
   11.32 -
   11.33 -/*
   11.34 - * The interfaces described by this header file are for miscellaneous utilities
   11.35 - * and are not part of the Xlib standard.
   11.36 - */
   11.37 -
   11.38 -#ifndef _XMU_STDCMAP_H_
   11.39 -#define _XMU_STDCMAP_H_
   11.40 -
   11.41 -#include <X11/Xfuncproto.h>
   11.42 -#include "SDL_name.h"
   11.43 -
   11.44 -_XFUNCPROTOBEGIN extern Status XmuAllStandardColormaps(Display * dpy);
   11.45 -
   11.46 -extern Status XmuCreateColormap(Display * dpy, XStandardColormap * colormap);
   11.47 -
   11.48 -extern void XmuDeleteStandardColormap
   11.49 -    (Display * dpy, int screen, Atom property);
   11.50 -
   11.51 -extern Status XmuGetColormapAllocation
   11.52 -    (XVisualInfo * vinfo,
   11.53 -     Atom property,
   11.54 -     unsigned long *red_max_return,
   11.55 -     unsigned long *green_max_return, unsigned long *blue_max_return);
   11.56 -
   11.57 -extern Status XmuLookupStandardColormap
   11.58 -    (Display * dpy,
   11.59 -     int screen,
   11.60 -     VisualID visualid,
   11.61 -     unsigned int depth, Atom property, Bool replace, Bool retain);
   11.62 -
   11.63 -extern XStandardColormap *XmuStandardColormap
   11.64 -    (Display * dpy,
   11.65 -     int screen,
   11.66 -     VisualID visualid,
   11.67 -     unsigned int depth,
   11.68 -     Atom property,
   11.69 -     Colormap cmap,
   11.70 -     unsigned long red_max, unsigned long green_max, unsigned long blue_max);
   11.71 -
   11.72 -extern Status XmuVisualStandardColormaps
   11.73 -    (Display * dpy,
   11.74 -     int screen,
   11.75 -     VisualID visualid, unsigned int depth, Bool replace, Bool retain);
   11.76 -
   11.77 -extern Bool XmuDistinguishableColors(XColor * colors, int count);
   11.78 -
   11.79 -extern Bool XmuDistinguishablePixels
   11.80 -    (Display * dpy, Colormap cmap, unsigned long *pixels, int count);
   11.81 -
   11.82 -_XFUNCPROTOEND
   11.83 -#endif /* _XMU_STDCMAP_H_ */
    12.1 --- a/src/video/x11/SDL_x11dyn.h	Fri Feb 04 18:05:20 2011 -0800
    12.2 +++ b/src/video/x11/SDL_x11dyn.h	Fri Feb 04 19:18:08 2011 -0800
    12.3 @@ -52,18 +52,6 @@
    12.4  #include <X11/extensions/XInput.h>
    12.5  #endif
    12.6  
    12.7 -#if SDL_VIDEO_DRIVER_X11_XRENDER
    12.8 -#include <X11/extensions/Xrender.h>
    12.9 -#endif
   12.10 -
   12.11 -#if SDL_VIDEO_DRIVER_X11_XDAMAGE
   12.12 -#include <X11/extensions/Xdamage.h>
   12.13 -#endif
   12.14 -
   12.15 -#if SDL_VIDEO_DRIVER_X11_XFIXES
   12.16 -#include <X11/extensions/Xfixes.h>
   12.17 -#endif
   12.18 -
   12.19  /*
   12.20   * When using the "dynamic X11" functionality, we duplicate all the Xlib
   12.21   *  symbols that would be referenced by SDL inside of SDL itself.
    13.1 --- a/src/video/x11/SDL_x11sym.h	Fri Feb 04 18:05:20 2011 -0800
    13.2 +++ b/src/video/x11/SDL_x11sym.h	Fri Feb 04 19:18:08 2011 -0800
    13.3 @@ -24,58 +24,38 @@
    13.4  
    13.5  SDL_X11_MODULE(BASEXLIB)
    13.6  SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return)
    13.7 -SDL_X11_SYM(Status,XAllocColor,(Display* a,Colormap b,XColor* c),(a,b,c),return)
    13.8 -SDL_X11_SYM(Status,XAllocColorCells,(Display *a,Colormap b,Bool c,unsigned long d[],unsigned int e,unsigned long f[],unsigned int g),(a,b,c,d,e,f,g),return)
    13.9  SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
   13.10 -SDL_X11_SYM(XStandardColormap *,XAllocStandardColormap,(void),(),return)
   13.11  SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
   13.12  SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return)
   13.13  SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return)
   13.14  SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
   13.15  SDL_X11_SYM(int,XChangeProperty,(Display* a,Window b,Atom c,Atom d,int e,int f,_Xconst unsigned char* g,int h),(a,b,c,d,e,f,g,h),return)
   13.16 -SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSetWindowAttributes* d),(a,b,c,d),return)
   13.17 -SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
   13.18 -SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
   13.19  SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
   13.20  SDL_X11_SYM(int,XConvertSelection,(Display* a,Atom b,Atom c,Atom d,Window e,Time f),(a,b,c,d,e,f),return)
   13.21 -SDL_X11_SYM(int,XCopyArea,(Display* a,Drawable b,Drawable c,GC d,int e,int f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
   13.22  SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char *data,unsigned int width,unsigned int height),(dpy,d,data,width,height),return)
   13.23  SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
   13.24  SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
   13.25  SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
   13.26  SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
   13.27 -SDL_X11_SYM(Pixmap,XCreatePixmap,(Display* a,Drawable b,unsigned int c,unsigned int d,unsigned int e),(a,b,c,d,e),return)
   13.28 -SDL_X11_SYM(Pixmap,XCreatePixmapFromBitmapData,(Display* a,Drawable b,char* c,unsigned int d,unsigned int e,unsigned long f,unsigned long g,unsigned int h),(a,b,c,d,e,f,g,h),return)
   13.29 -SDL_X11_SYM(Window,XCreateSimpleWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,unsigned long h,unsigned long i),(a,b,c,d,e,f,g,h,i),return)
   13.30  SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
   13.31  SDL_X11_SYM(int,XDefineCursor,(Display* a,Window b,Cursor c),(a,b,c),return)
   13.32  SDL_X11_SYM(int,XDeleteProperty,(Display* a,Window b,Atom c),(a,b,c),return)
   13.33  SDL_X11_SYM(int,XDestroyWindow,(Display* a,Window b),(a,b),return)
   13.34  SDL_X11_SYM(int,XDisplayKeycodes,(Display* a,int* b,int* c),(a,b,c),return)
   13.35 -SDL_X11_SYM(int,XDrawLines,(Display* a, Drawable b, GC c, XPoint* d, int e, int f),(a,b,c,d,e,f),return)
   13.36 -SDL_X11_SYM(int,XDrawPoint,(Display* a, Drawable b, GC c, int d, int e),(a,b,c,d,e),return)
   13.37 -SDL_X11_SYM(int,XDrawPoints,(Display* a, Drawable b, GC c, XPoint* d, int e, int f),(a,b,c,d,e,f),return)
   13.38 -SDL_X11_SYM(int,XDrawRectangles,(Display* a,Drawable b,GC c,XRectangle* d,int e),(a,b,c,d,e),return)
   13.39 -SDL_X11_SYM(int,XFillRectangles,(Display* a,Drawable b,GC c,XRectangle* d,int e),(a,b,c,d,e),return)
   13.40  SDL_X11_SYM(char*,XDisplayName,(_Xconst char* a),(a),return)
   13.41  SDL_X11_SYM(int,XEventsQueued,(Display* a,int b),(a,b),return)
   13.42  SDL_X11_SYM(Bool,XFilterEvent,(XEvent *event,Window w),(event,w),return)
   13.43  SDL_X11_SYM(int,XFlush,(Display* a),(a),return)
   13.44  SDL_X11_SYM(int,XFree,(void*a),(a),return)
   13.45 -SDL_X11_SYM(int,XFreeColormap,(Display* a,Colormap b),(a,b),return)
   13.46 -SDL_X11_SYM(int,XFreeColors,(Display* a,Colormap b,unsigned long* c,int d,unsigned long e),(a,b,c,d,e),return)
   13.47  SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return)
   13.48  SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return)
   13.49  SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return)
   13.50  SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return)
   13.51  SDL_X11_SYM(char*,XGetAtomName,(Display *a,Atom b),(a,b),return)
   13.52  SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return)
   13.53 -SDL_X11_SYM(XImage*,XGetImage,(Display* a,Drawable b,int c,int d,unsigned int e,unsigned int f,unsigned long g, int h),(a,b,c,d,e,f,g,h),return)
   13.54  SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return)
   13.55  SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return)
   13.56 -SDL_X11_SYM(int,XGetRGBColormaps,(Display* a,Window b,XStandardColormap **c,int *d,Atom e),(a,b,c,d,e),return)
   13.57  SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return)
   13.58 -SDL_X11_SYM(Status,XGetTextProperty,(Display *a,Window b,XTextProperty *c,Atom d),(a,b,c,d),return)
   13.59  SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return)
   13.60  SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return)
   13.61  SDL_X11_SYM(int,XGetWindowProperty,(Display* a,Window b,Atom c,long d,long e,Bool f,Atom g,Atom* h,int* i,unsigned long* j,unsigned long *k,unsigned char **l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
   13.62 @@ -84,47 +64,34 @@
   13.63  SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return)
   13.64  SDL_X11_SYM(int,XGrabServer,(Display* a),(a),return)
   13.65  SDL_X11_SYM(Status,XIconifyWindow,(Display* a,Window b,int c),(a,b,c),return)
   13.66 -SDL_X11_SYM(int,XInstallColormap,(Display* a,Colormap b),(a,b),return)
   13.67  SDL_X11_SYM(KeyCode,XKeysymToKeycode,(Display* a,KeySym b),(a,b),return)
   13.68  SDL_X11_SYM(char*,XKeysymToString,(KeySym a),(a),return)
   13.69 -SDL_X11_SYM(int,XKillClient,(Display* a,XID b),(a,b),return)
   13.70  SDL_X11_SYM(Atom,XInternAtom,(Display* a,_Xconst char* b,Bool c),(a,b,c),return)
   13.71  SDL_X11_SYM(XPixmapFormatValues*,XListPixmapFormats,(Display* a,int* b),(a,b),return)
   13.72  SDL_X11_SYM(KeySym,XLookupKeysym,(XKeyEvent* a,int b),(a,b),return)
   13.73  SDL_X11_SYM(int,XLookupString,(XKeyEvent* a,char* b,int c,KeySym* d,XComposeStatus* e),(a,b,c,d,e),return)
   13.74  SDL_X11_SYM(int,XMapRaised,(Display* a,Window b),(a,b),return)
   13.75 -SDL_X11_SYM(int,XMapWindow,(Display* a,Window b),(a,b),return)
   13.76 -SDL_X11_SYM(int,XMaskEvent,(Display* a,long b,XEvent* c),(a,b,c),return)
   13.77  SDL_X11_SYM(Status,XMatchVisualInfo,(Display* a,int b,int c,int d,XVisualInfo* e),(a,b,c,d,e),return)
   13.78  SDL_X11_SYM(int,XMissingExtension,(Display* a,_Xconst char* b),(a,b),return)
   13.79 -SDL_X11_SYM(int,XMoveResizeWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f),(a,b,c,d,e,f),return)
   13.80  SDL_X11_SYM(int,XMoveWindow,(Display* a,Window b,int c,int d),(a,b,c,d),return)
   13.81  SDL_X11_SYM(int,XNextEvent,(Display* a,XEvent* b),(a,b),return)
   13.82  SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return)
   13.83  SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return)
   13.84  SDL_X11_SYM(int,XPending,(Display* a),(a),return)
   13.85  SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return)
   13.86 -SDL_X11_SYM(int,XQueryColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
   13.87  SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
   13.88  SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return)
   13.89  SDL_X11_SYM(int,XRaiseWindow,(Display* a,Window b),(a,b),return)
   13.90 -SDL_X11_SYM(int,XReparentWindow,(Display* a,Window b,Window c,int d,int e),(a,b,c,d,e),return)
   13.91  SDL_X11_SYM(int,XResetScreenSaver,(Display* a),(a),return)
   13.92  SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return)
   13.93  SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return)
   13.94  SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return)
   13.95  SDL_X11_SYM(int,XSetClassHint,(Display* a,Window b,XClassHint* c),(a,b,c),return)
   13.96 -SDL_X11_SYM(int,XSetCloseDownMode,(Display *a, int b),(a,b),return)
   13.97 -SDL_X11_SYM(int,XSetForeground,(Display* a,GC b,unsigned long c),(a,b,c),return)
   13.98  SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return)
   13.99  SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return)
  13.100 -SDL_X11_SYM(void,XSetRGBColormaps,( Display *a,Window b,XStandardColormap *c,int d,Atom e),(a,b,c,d,e),return)
  13.101  SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d),return)
  13.102  SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
  13.103  SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
  13.104 -SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
  13.105 -SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return)
  13.106 -SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return)
  13.107  SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return)
  13.108  SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
  13.109  SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
  13.110 @@ -157,10 +124,6 @@
  13.111  SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return)
  13.112  SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return)
  13.113  SDL_X11_SYM(XExtensionErrorHandler,XSetExtensionErrorHandler,(XExtensionErrorHandler a),(a),return)
  13.114 -SDL_X11_SYM(int,XFillRectangle,(Display *dpy,Drawable d,GC gc,int x,int y,unsigned int width,unsigned int height),(dpy,d,gc,x,y,width,height),return)
  13.115 -SDL_X11_SYM(int,XSetBackground,(Display *dpy,GC gc,unsigned long background),(dpy,gc,background),return)
  13.116 -SDL_X11_SYM(Status,XInitImage,(XImage *image),(image),return)
  13.117 -SDL_X11_SYM(int,XSetClipMask,(Display *dpy,GC gc,Pixmap pixmap),(dpy,gc,pixmap),return)
  13.118  
  13.119  #if NeedWidePrototypes
  13.120  SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,unsigned int b,int c),(a,b,c),return)
  13.121 @@ -243,42 +206,6 @@
  13.122  SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return)
  13.123  #endif
  13.124  
  13.125 -/* XRender support */
  13.126 -#if SDL_VIDEO_DRIVER_X11_XRENDER
  13.127 -SDL_X11_MODULE(XRENDER)
  13.128 -SDL_X11_SYM(Bool,XRenderQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return)
  13.129 -SDL_X11_SYM(Bool,XRenderQueryVersion,(Display *dpy,int *major,int *minor),(dpy,major,minor),return)
  13.130 -SDL_X11_SYM(XRenderPictFormat*,XRenderFindVisualFormat,(Display *dpy,_Xconst Visual *visual),(dpy,visual),return)
  13.131 -SDL_X11_SYM(XRenderPictFormat*,XRenderFindStandardFormat,(Display *dpy,int format),(dpy,format),return)
  13.132 -SDL_X11_SYM(XRenderPictFormat*,XRenderFindFormat,(Display *dpy,unsigned long mask,_Xconst XRenderPictFormat* templ,int count),(dpy,mask,templ,count),return)
  13.133 -SDL_X11_SYM(Picture,XRenderCreatePicture,(Display *dpy,Drawable drawable,_Xconst XRenderPictFormat* format,unsigned long valuemask,_Xconst XRenderPictureAttributes* attributes),(dpy,drawable,format,valuemask,attributes),return)
  13.134 -SDL_X11_SYM(void,XRenderFreePicture,(Display *dpy,Picture picture),(dpy,picture),return)
  13.135 -SDL_X11_SYM(void,XRenderChangePicture,(Display *dpy,Picture picture,unsigned long valuemask,_Xconst XRenderPictureAttributes* attributes),(dpy,picture,valuemask,attributes),return)
  13.136 -SDL_X11_SYM(void,XRenderComposite,(Display *dpy,int op,Picture src,Picture mask,Picture dst,int src_x,int src_y,int mask_x,int mask_y,int dst_x,int dst_y,unsigned int width,unsigned int height),(dpy,op,src,mask,dst,src_x,src_y,mask_x,mask_y,dst_x,dst_y,width,height),return)
  13.137 -SDL_X11_SYM(Picture,XRenderCreateSolidFill,(Display *dpy,const XRenderColor *color),(dpy,color),return)
  13.138 -SDL_X11_SYM(void,XRenderSetPictureTransform,(Display *dpy,Picture picture,XTransform *transform),(dpy,picture,transform),return)
  13.139 -SDL_X11_SYM(void,XRenderFillRectangle,(Display *dpy,int op,Picture dst,_Xconst XRenderColor *color,int x,int y,unsigned int width,unsigned int height),(dpy,op,dst,color,x,y,width,height),return)
  13.140 -SDL_X11_SYM(void,XRenderFillRectangles,(Display *dpy,int op,Picture dst,_Xconst XRenderColor *color,_Xconst XRectangle *rectangles,int n_rects),(dpy,op,dst,color,rectangles,n_rects),return)
  13.141 -SDL_X11_SYM(void,XRenderSetPictureFilter,(Display *dpy,Picture picture,const char *filter,XFixed *params,int nparams),(dpy,picture,filter,params,nparams),return)
  13.142 -#endif
  13.143 -
  13.144 -#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
  13.145 -SDL_X11_MODULE(XDAMAGE)
  13.146 -SDL_X11_SYM(Bool,XDamageQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return)
  13.147 -SDL_X11_SYM(Status,XDamageQueryVersion,(Display *dpy,int *major,int *minor),(dpy,major,minor),return)
  13.148 -SDL_X11_SYM(Damage,XDamageCreate,(Display *dpy,Drawable d,int level),(dpy,d,level),return)
  13.149 -SDL_X11_SYM(void,XDamageSubtract,(Display *dpy,Damage damage,XserverRegion repair,XserverRegion parts),(dpy,damage,repair,parts),return)
  13.150 -SDL_X11_SYM(void,XDamageDestroy,(Display *dpy,Damage damage),(dpy,damage),return)
  13.151 -#endif
  13.152 -
  13.153 -#ifdef SDL_VIDEO_DRIVER_X11_XFIXES
  13.154 -SDL_X11_MODULE(XFIXES)
  13.155 -SDL_X11_SYM(Bool,XFixesQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return)
  13.156 -SDL_X11_SYM(Status,XFixesQueryVersion,(Display *dpy,int *major,int *minor),(dpy,major,minor),return)
  13.157 -SDL_X11_SYM(void,XFixesSetGCClipRegion,(Display *dpy,GC gc,int clip_x,int clip_y,XserverRegion region),(dpy,gc,clip_x,clip_y,region),return)
  13.158 -SDL_X11_SYM(void,XFixesSetPictureClipRegion,(Display *dpy,XID picture,int clip_x,int clip_y,XserverRegion region),(dpy,picture,clip_x,clip_y,region),return)
  13.159 -#endif
  13.160 -
  13.161  #if SDL_VIDEO_DRIVER_X11_XSHAPE
  13.162  SDL_X11_MODULE(XSHAPE)
  13.163  SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),)
    14.1 --- a/src/video/x11/SDL_x11video.h	Fri Feb 04 18:05:20 2011 -0800
    14.2 +++ b/src/video/x11/SDL_x11video.h	Fri Feb 04 19:18:08 2011 -0800
    14.3 @@ -47,15 +47,6 @@
    14.4  #if SDL_VIDEO_DRIVER_X11_SCRNSAVER
    14.5  #include <X11/extensions/scrnsaver.h>
    14.6  #endif
    14.7 -#if SDL_VIDEO_DRIVER_X11_XRENDER
    14.8 -#include <X11/extensions/Xrender.h>
    14.9 -#endif
   14.10 -#if SDL_VIDEO_DRIVER_X11_XDAMAGE
   14.11 -#include <X11/extensions/Xdamage.h>
   14.12 -#endif
   14.13 -#if SDL_VIDEO_DRIVER_X11_XFIXES
   14.14 -#include <X11/extensions/Xfixes.h>
   14.15 -#endif
   14.16  #if SDL_VIDEO_DRIVER_X11_XSHAPE
   14.17  #include <X11/extensions/shape.h>
   14.18  #endif
    15.1 --- a/src/video/x11/SDL_x11window.c	Fri Feb 04 18:05:20 2011 -0800
    15.2 +++ b/src/video/x11/SDL_x11window.c	Fri Feb 04 19:18:08 2011 -0800
    15.3 @@ -30,7 +30,6 @@
    15.4  #include "SDL_x11mouse.h"
    15.5  #include "SDL_x11gamma.h"
    15.6  #include "SDL_x11shape.h"
    15.7 -#include "../Xext/extensions/StdCmap.h"
    15.8  
    15.9  #ifdef SDL_VIDEO_DRIVER_PANDORA
   15.10  #include "SDL_x11opengles.h"