From b84ae14eebf8603a46f155bc17827f8cd34e87ca Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Jan 2009 15:47:49 +0000 Subject: [PATCH] Don't use DirectColor visuals until we implement DirectColor colormap support --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403425 --- src/video/x11/SDL_x11modes.c | 5 +---- src/video/x11/SDL_x11opengl.c | 4 ++-- src/video/x11/SDL_x11video.c | 9 +++++++++ src/video/x11/SDL_x11video.h | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 8b6304917..486dd6bdf 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -32,9 +32,6 @@ static int get_visualinfo(Display * display, int screen, XVisualInfo * vinfo) { const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID"); - /* We really don't need DirectColor visuals until we implement - * gamma ramps, but we'll leave it on for now to catch bugs */ - int use_directcolor = 0; int depth; /* Look for an exact visual, if requested */ @@ -53,7 +50,7 @@ get_visualinfo(Display * display, int screen, XVisualInfo * vinfo) } depth = DefaultDepth(display, screen); - if ((use_directcolor && + if ((X11_UseDirectColorVisuals() && XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) || XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) || XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) || diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index b6423e86d..783f20534 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -391,7 +391,7 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) attribs[i++] = GLX_NONE_EXT; } #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */ - if (!SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) { + if (X11_UseDirectColorVisuals()) { attribs[i++] = GLX_X_VISUAL_TYPE; attribs[i++] = GLX_DIRECT_COLOR; } @@ -400,7 +400,7 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); #ifdef GLX_DIRECT_COLOR - if (!vinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) { /* No DirectColor visual? Try again.. */ + if (!vinfo && X11_UseDirectColorVisuals()) { /* No DirectColor visual? Try again.. */ attribs[i - 3] = None; vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); } diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 0cad61c34..53d241e0c 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -267,4 +267,13 @@ X11_VideoQuit(_THIS) X11_QuitMouse(_this); } +SDL_bool +X11_UseDirectColorVisuals() +{ + /* Once we implement DirectColor colormaps and gamma ramp support... + return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE; + */ + return SDL_FALSE; +} + /* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index a71412fc4..c31252b3b 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -76,6 +76,8 @@ typedef struct SDL_VideoData SDL_scancode key_layout[256]; } SDL_VideoData; +extern SDL_bool X11_UseDirectColorVisuals(); + #endif /* _SDL_x11video_h */ /* vi: set ts=4 sw=4 expandtab: */