Commit 31f1dceb authored by Sam Lantinga's avatar Sam Lantinga

Removed a bunch of X11 support that we no longer need.

parent 3bcc4afe
......@@ -1118,7 +1118,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
AC_DEFINE(SDL_VIDEO_DRIVER_X11)
SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
if test x$enable_x11_shared = xmaybe; then
......@@ -1261,69 +1260,6 @@ AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension
if test x$definitely_enable_video_x11_scrnsaver = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
fi
AC_ARG_ENABLE(video-x11-xrender,
AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
, enable_video_x11_xrender=yes)
if test x$enable_video_x11_xrender = xyes; then
AC_CHECK_HEADER(X11/extensions/Xrender.h,
have_xrender_h_hdr=yes,
have_xrender_h_hdr=no,
[#include <X11/Xlib.h>
])
if test x$have_xrender_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
echo "-- dynamic libXrender -> $xrender_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
definitely_enable_video_x11_xrender=yes
else
AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
if test x$have_xrender_lib = xyes ; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
definitely_enable_video_x11_xrender=yes
fi
fi
fi
fi
if test x$definitely_enable_video_x11_xrender = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
fi
AC_ARG_ENABLE(video-x11-xdamage-xfixes,
AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
, enable_video_x11_xdamage=yes)
if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
AC_CHECK_HEADER(X11/extensions/Xdamage.h,
have_xdamage_h_hdr=yes,
have_xdamage_h_hdr=no,
[#include <X11/Xlib.h>
])
AC_CHECK_HEADER(X11/extensions/Xfixes.h,
have_xfixes_h_hdr=yes,
have_xfixes_h_hdr=no,
[#include <X11/Xlib.h>
])
if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
echo "-- dynamic libXdamage -> $xdamage_lib"
echo "-- dynamic libXfixes -> $xfixes_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
definitely_enable_video_x11_xdamage=yes
definitely_enable_video_x11_xfixes=yes
else
AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
definitely_enable_video_x11_xdamage=yes
definitely_enable_video_x11_xfixes=yes
fi
fi
fi
fi
if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
fi
fi
fi
}
......
......@@ -266,20 +266,14 @@
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XRANDR
#undef SDL_VIDEO_DRIVER_X11_XINPUT
#undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
#undef SDL_VIDEO_DRIVER_X11_XV
#undef SDL_VIDEO_DRIVER_X11_XRENDER
#undef SDL_VIDEO_DRIVER_X11_XDAMAGE
#undef SDL_VIDEO_DRIVER_X11_XFIXES
#undef SDL_VIDEO_DRIVER_X11_XSHAPE
#undef SDL_VIDEO_RENDER_D3D
......
/* $Xorg: AllCmap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/AllCmap.c,v 1.7 2001/01/17 19:42:53 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "../extensions/StdCmap.h"
static XVisualInfo *getDeepestVisual(int, XVisualInfo *, int);
/*
* To create all of the appropriate standard colormaps for every visual of
* every screen on a given display, use XmuAllStandardColormaps.
*
* Define and retain as permanent resources all standard colormaps which are
* meaningful for the visuals of each screen of the display. Return 0 on
* failure, non-zero on success. If the property of any standard colormap
* is already defined, redefine it.
*
* This interface is intended to be used by window managers or a client
* upon start-up of a session.
*
* The standard colormaps of a screen are defined by properties associated
* with the screen's root window. Each screen has exactly one root window.
* The property names of standard colormaps are predefined, and each property
* name may describe at most one colormap.
*
* The standard colormaps are
* RGB_BEST_MAP
* RGB_RED_MAP
* RGB_GREEN_MAP
* RGB_BLUE_MAP
* RGB_DEFAULT_MAP
* RGB_GRAY_MAP
*
* Therefore a screen may have at most 6 standard colormap properties defined.
*
* A standard colormap is associated with a particular visual of the screen.
* A screen may have multiple visuals defined, including visuals of the same
* class at different depths. Note that a visual id might be repeated for
* more than one depth, so the visual id and the depth of a visual identify
* the visual. The characteristics of the visual will determine which
* standard colormaps are meaningful under that visual, and will determine
* how the standard colormap is defined. Because a standard colormap is
* associated with a specific visual, there must be a method of determining
* which visuals take precedence in defining standard colormaps.
*
* The method used here is: for the visual of greatest depth, define all
* standard colormaps meaningful to that visual class, according to this
* order of (descending) precedence:
* 1. DirectColor
* 2. PseudoColor
* 3. TrueColor and GrayScale
* 4. StaticColor and StaticGray
*
* Allows partial success by screenful. For example, if a map on screen 1
* fails, the maps on screen 0, created earlier, will remain. However,
* none on screen 1 will remain. If a map on 0 fails, none will remain.
*
* See the comments under XmuVisualStandardColormaps() for notes on which
* standard colormaps are meaningful under these classes of visuals.
*/
Status
XmuAllStandardColormaps(Display * dpy)
{
int nvisuals, scr;
Status status;
long vinfo_mask;
XVisualInfo template, *vinfo, *v1, *v2;
status = 0;
/* for each screen, determine all visuals of this server */
for (scr = 0; scr < ScreenCount(dpy); scr++) {
template.screen = scr;
vinfo_mask = VisualScreenMask;
vinfo = XGetVisualInfo(dpy, vinfo_mask, &template, &nvisuals);
if (vinfo == NULL) /* unexpected: a screen with no visuals */
continue;
v1 = getDeepestVisual(DirectColor, vinfo, nvisuals);
v2 = getDeepestVisual(PseudoColor, vinfo, nvisuals);
if (v2 &&
(!v1 || (v2->colormap_size >=
((v1->red_mask | v1->green_mask | v1->blue_mask) + 1))))
status = XmuVisualStandardColormaps(dpy, scr, v2->visualid,
(unsigned) v2->depth, 1, 1);
else if (v1)
status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
(unsigned) v1->depth, 1, 1);
else {
if (((v1 = getDeepestVisual(TrueColor, vinfo, nvisuals)) != NULL)
|| ((v1 = getDeepestVisual(StaticColor, vinfo, nvisuals)) !=
NULL))
status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
(unsigned) v1->depth, 1,
1);
if (status
&&
(((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
|| ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
NULL)))
status =
XmuVisualStandardColormaps(dpy, scr, v1->visualid,
(unsigned) v1->depth, 1, 1);
}
XFree((char *) vinfo);
if (!status)
break;
}
return status;
}
static XVisualInfo *
getDeepestVisual(int visual_class, XVisualInfo * vinfo, int nvisuals)
{
register int i;
register int maxdepth = 0;
XVisualInfo *v = NULL;
for (i = 0; i < nvisuals; i++, vinfo++)
if (vinfo->class == visual_class && vinfo->depth > maxdepth) {
maxdepth = vinfo->depth;
v = vinfo;
}
return (v);
}
This diff is collapsed.
This diff is collapsed.
/* $Xorg: DelCmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.6 2001/01/17 19:42:54 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "../extensions/StdCmap.h"
/* To remove any standard colormap property, use XmuDeleteStandardColormap().
* XmuDeleteStandardColormap() will remove the specified property from the
* specified screen, releasing any resources used by the colormap(s) of the
* property if possible.
*/
void
XmuDeleteStandardColormap(Display * dpy, int screen, Atom property)
/* dpy; - specifies the X server to connect to
* screen - specifies the screen of the display
* property - specifies the standard colormap property
*/
{
XStandardColormap *stdcmaps, *s;
int count = 0;
if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
property)) {
for (s = stdcmaps; count > 0; count--, s++) {
if ((s->killid == ReleaseByFreeingColormap) &&
(s->colormap != None) &&
(s->colormap != DefaultColormap(dpy, screen)))
XFreeColormap(dpy, s->colormap);
else if (s->killid != None)
XKillClient(dpy, s->killid);
}
XDeleteProperty(dpy, RootWindow(dpy, screen), property);
XFree((char *) stdcmaps);
XSync(dpy, False);
}
}
/* $Xorg: Distinct.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
/*
Copyright 1990, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/Distinct.c,v 3.5 2001/07/25 15:04:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <X11/Xlib.h>
#include <stdlib.h>
#include <X11/Xutil.h>
#include "../extensions/StdCmap.h"
/*
* Distinguishable colors routine. Determines if two colors are
* distinguishable or not. Somewhat arbitrary meaning.
*/
#define MIN_DISTINGUISH 10000.0
Bool
XmuDistinguishableColors(XColor * colors, int count)
{
double deltaRed, deltaGreen, deltaBlue;
double dist;
int i, j;
for (i = 0; i < count - 1; i++)
for (j = i + 1; j < count; j++) {
deltaRed = (double) colors[i].red - (double) colors[j].red;
deltaGreen = (double) colors[i].green - (double) colors[j].green;
deltaBlue = (double) colors[i].blue - (double) colors[j].blue;
dist = deltaRed * deltaRed +
deltaGreen * deltaGreen + deltaBlue * deltaBlue;
if (dist <= MIN_DISTINGUISH * MIN_DISTINGUISH)
return False;
}
return True;
}
Bool
XmuDistinguishablePixels(Display * dpy, Colormap cmap,
unsigned long *pixels, int count)
{
XColor *defs;
int i, j;
Bool ret;
for (i = 0; i < count - 1; i++)
for (j = i + 1; j < count; j++)
if (pixels[i] == pixels[j])
return False;
defs = (XColor *) malloc(count * sizeof(XColor));
if (!defs)
return False;
for (i = 0; i < count; i++)
defs[i].pixel = pixels[i];
XQueryColors(dpy, cmap, defs, count);
ret = XmuDistinguishableColors(defs, count);
free((char *) defs);
return ret;
}
This diff is collapsed.
/* $Xorg: StdCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/StdCmap.c,v 1.5 2001/01/17 19:42:56 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "../extensions/StdCmap.h"
#define lowbit(x) ((x) & (~(x) + 1))
/*
* Prototypes
*/
/* argument restrictions */
static Status valid_args(XVisualInfo *, unsigned long, unsigned long,
unsigned long, Atom);
/*
* To create any one standard colormap, use XmuStandardColormap().
*
* Create a standard colormap for the given screen, visualid, and visual
* depth, with the given red, green, and blue maximum values, with the
* given standard property name. Return a pointer to an XStandardColormap
* structure which describes the newly created colormap, upon success.
* Upon failure, return NULL.
*
* XmuStandardColormap() calls XmuCreateColormap() to create the map.
*
* Resources created by this function are not made permanent; that is the
* caller's responsibility.
*/
XStandardColormap *
XmuStandardColormap(Display * dpy, int screen, VisualID visualid,
unsigned int depth, Atom property, Colormap cmap,
unsigned long red_max, unsigned long green_max,
unsigned long blue_max)
/*
* dpy - specifies X server connection
* screen - specifies display screen
* visualid - identifies the visual type
* depth - identifies the visual type
* property - a standard colormap property
* cmap - specifies colormap ID or None
* red_max, green_max, blue_max - allocations
*/
{
XStandardColormap *stdcmap;
Status status;
XVisualInfo vinfo_template, *vinfo;
long vinfo_mask;
int n;
/* Match the required visual information to an actual visual */
vinfo_template.visualid = visualid;
vinfo_template.screen = screen;
vinfo_template.depth = depth;
vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
if ((vinfo =
XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
return 0;
/* Check the validity of the combination of visual characteristics,
* allocation, and colormap property. Create an XStandardColormap
* structure.
*/
if (!valid_args(vinfo, red_max, green_max, blue_max, property)
|| ((stdcmap = XAllocStandardColormap()) == NULL)) {
XFree((char *) vinfo);
return 0;
}
/* Fill in the XStandardColormap structure */
if (cmap == DefaultColormap(dpy, screen)) {
/* Allocating out of the default map, cannot use XFreeColormap() */
Window win = XCreateWindow(dpy, RootWindow(dpy, screen), 1, 1, 1, 1,
0, 0, InputOnly, vinfo->visual,
(unsigned long) 0,
(XSetWindowAttributes *) NULL);
stdcmap->killid = (XID) XCreatePixmap(dpy, win, 1, 1, depth);
XDestroyWindow(dpy, win);
stdcmap->colormap = cmap;
} else {
stdcmap->killid = ReleaseByFreeingColormap;
stdcmap->colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
vinfo->visual, AllocNone);
}
stdcmap->red_max = red_max;
stdcmap->green_max = green_max;
stdcmap->blue_max = blue_max;
if (property == XA_RGB_GRAY_MAP)
stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
stdcmap->red_mult = lowbit(vinfo->red_mask);
stdcmap->green_mult = lowbit(vinfo->green_mask);
stdcmap->blue_mult = lowbit(vinfo->blue_mask);
} else {
stdcmap->red_mult = (red_max > 0)
? (green_max + 1) * (blue_max + 1) : 0;
stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
stdcmap->blue_mult = (blue_max > 0) ? 1 : 0;
}
stdcmap->base_pixel = 0; /* base pixel may change */
stdcmap->visualid = vinfo->visualid;
/* Make the colormap */
status = XmuCreateColormap(dpy, stdcmap);
/* Clean up */
XFree((char *) vinfo);
if (!status) {
/* Free the colormap or the pixmap, if we created one */
if (stdcmap->killid == ReleaseByFreeingColormap)
XFreeColormap(dpy, stdcmap->colormap);
else if (stdcmap->killid != None)
XFreePixmap(dpy, stdcmap->killid);
XFree((char *) stdcmap);
return (XStandardColormap *) NULL;
}
return stdcmap;
}
/****************************************************************************/
static Status
valid_args(XVisualInfo * vinfo, unsigned long red_max,
unsigned long green_max, unsigned long blue_max, Atom property)
/*
* vinfo - specifies visual
* red_max, green_max, blue_max - specifies alloc
* property - specifies property name
*/
{
unsigned long ncolors; /* number of colors requested */
/* Determine that the number of colors requested is <= map size */
if ((vinfo->class == DirectColor) || (vinfo->class == TrueColor)) {
unsigned long mask;
mask = vinfo->red_mask;
while (!(mask & 1))
mask >>= 1;
if (red_max > mask)
return 0;
mask = vinfo->green_mask;
while (!(mask & 1))
mask >>= 1;
if (green_max > mask)
return 0;
mask = vinfo->blue_mask;
while (!(mask & 1))
mask >>= 1;
if (blue_max > mask)
return 0;
} else if (property == XA_RGB_GRAY_MAP) {
ncolors = red_max + green_max + blue_max + 1;
if (ncolors > vinfo->colormap_size)
return 0;
} else {
ncolors = (red_max + 1) * (green_max + 1) * (blue_max + 1);
if (ncolors > vinfo->colormap_size)
return 0;
}
/* Determine that the allocation and visual make sense for the property */
switch (property) {
case XA_RGB_DEFAULT_MAP:
if (red_max == 0 || green_max == 0 || blue_max == 0)
return 0;
break;
case XA_RGB_RED_MAP:
if (red_max == 0)
return 0;
break;
case XA_RGB_GREEN_MAP:
if (green_max == 0)
return 0;
break;
case XA_RGB_BLUE_MAP:
if (blue_max == 0)
return 0;
break;
case XA_RGB_BEST_MAP:
if (red_max == 0 || green_max == 0 || blue_max == 0)
return 0;
break;
case XA_RGB_GRAY_MAP:
if (red_max == 0 || blue_max == 0 || green_max == 0)
return 0;
break;
default:
return 0;
}
return 1;
}
/* $Xorg: VisCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/VisCmap.c,v 1.6 2001/01/17 19:42:57 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <math.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "../extensions/StdCmap.h"
/*
* To create all of the appropriate standard colormaps for a given visual on
* a given screen, use XmuVisualStandardColormaps.
*
* Define all appropriate standard colormap properties for the given visual.
* If replace is true, any previous definition will be removed.
* If retain is true, new properties will be retained for the duration of
* the server session. Return 0 on failure, non-zero on success.
* On failure, no new properties will be defined, and, old ones may have
* been removed if replace was True.
*
* Not all standard colormaps are meaningful to all visual classes. This
* routine will check and define the following properties for the following
* classes, provided that the size of the colormap is not too small.
*
* DirectColor and PseudoColor
* RGB_DEFAULT_MAP
* RGB_BEST_MAP
* RGB_RED_MAP
* RGB_GREEN_MAP
* RGB_BLUE_MAP
* RGB_GRAY_MAP
*
* TrueColor and StaticColor
* RGB_BEST_MAP
*
* GrayScale and StaticGray
* RGB_GRAY_MAP
*/
Status
XmuVisualStandardColormaps(Display * dpy, int screen, VisualID visualid,
unsigned int depth, Bool replace, Bool retain)
/*
* dpy - specifies server connection
* screen - specifies screen number
* visualid - specifies the visual
* depth - specifies the visual
* replace specifies - whether to replace
* retain - specifies whether to retain
*/
{
Status status;
int n;
long vinfo_mask;
XVisualInfo vinfo_template, *vinfo;
status = 0;
vinfo_template.screen = screen;
vinfo_template.visualid = visualid;
vinfo_template.depth = depth;
vinfo_mask = VisualScreenMask | VisualIDMask | VisualDepthMask;
if ((vinfo =
XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
return 0;
if (vinfo->colormap_size <= 2) {
/* Monochrome visuals have no standard maps; considered successful */
XFree((char *) vinfo);
return 1;
}
switch (vinfo->class) {
case PseudoColor:
case DirectColor:
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_DEFAULT_MAP, replace,
retain);
if (!status)
break;
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_GRAY_MAP, replace, retain);
if (!status) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
break;
}
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_RED_MAP, replace, retain);
if (!status) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
break;
}
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_GREEN_MAP, replace, retain);
if (!status) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
break;
}
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_BLUE_MAP, replace, retain);
if (!status) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
break;
}
/* fall through */
case StaticColor:
case TrueColor:
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_BEST_MAP, replace, retain);
if (!status && (vinfo->class == PseudoColor ||
vinfo->class == DirectColor)) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_BLUE_MAP);
}
break;
/* the end for PseudoColor, DirectColor, StaticColor, and TrueColor */
case GrayScale:
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_DEFAULT_MAP, replace,
retain);
if (!status)
break;
/*FALLTHROUGH*/ case StaticGray:
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_GRAY_MAP, replace, retain);
if (!status && vinfo->class == GrayScale) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
break;
}
}
XFree((char *) vinfo);
return status;
}
/* $Xorg: StdCmap.h,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/StdCmap.h,v 1.8 2001/01/23 17:38:14 keithp Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
* and are not part of the Xlib standard.
*/
#ifndef _XMU_STDCMAP_H_
#define _XMU_STDCMAP_H_
#include <X11/Xfuncproto.h>
#include "SDL_name.h"
_XFUNCPROTOBEGIN extern Status XmuAllStandardColormaps(Display * dpy);
extern Status XmuCreateColormap(Display * dpy, XStandardColormap * colormap);
extern void XmuDeleteStandardColormap
(Display * dpy, int screen, Atom property);
extern Status XmuGetColormapAllocation
(XVisualInfo * vinfo,
Atom property,
unsigned long *red_max_return,
unsigned long *green_max_return, unsigned long *blue_max_return);
extern Status XmuLookupStandardColormap
(Display * dpy,
int screen,
VisualID visualid,
unsigned int depth, Atom property, Bool replace, Bool retain);
extern XStandardColormap *XmuStandardColormap
(Display * dpy,
int screen,
VisualID visualid,
unsigned int depth,
Atom property,
Colormap cmap,
unsigned long red_max, unsigned long green_max, unsigned long blue_max);
extern Status XmuVisualStandardColormaps
(Display * dpy,
int screen,
VisualID visualid, unsigned int depth, Bool replace, Bool retain);
extern Bool XmuDistinguishableColors(XColor * colors, int count);
extern Bool XmuDistinguishablePixels
(Display * dpy, Colormap cmap, unsigned long *pixels, int count);
_XFUNCPROTOEND
#endif /* _XMU_STDCMAP_H_ */
......@@ -52,18 +52,6 @@
#include <X11/extensions/XInput.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
/*
* When using the "dynamic X11" functionality, we duplicate all the Xlib
* symbols that would be referenced by SDL inside of SDL itself.
......
This diff is collapsed.
......@@ -47,15 +47,6 @@
#if SDL_VIDEO_DRIVER_X11_SCRNSAVER
#include <X11/extensions/scrnsaver.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XSHAPE
#include <X11/extensions/shape.h>
#endif
......
......@@ -30,7 +30,6 @@
#include "SDL_x11mouse.h"
#include "SDL_x11gamma.h"
#include "SDL_x11shape.h"
#include "../Xext/extensions/StdCmap.h"
#ifdef SDL_VIDEO_DRIVER_PANDORA
#include "SDL_x11opengles.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment