Fixed DirectColor visual window creation problem
authorSam Lantinga <slouken@libsdl.org>
Thu, 01 Jan 2009 18:58:26 +0000
changeset 2945e38423786728
parent 2944 7dac01628a8b
child 2946 29e1f863a844
Fixed DirectColor visual window creation problem
TODO
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11window.c
     1.1 --- a/TODO	Thu Jan 01 18:49:43 2009 +0000
     1.2 +++ b/TODO	Thu Jan 01 18:58:26 2009 +0000
     1.3 @@ -7,7 +7,6 @@
     1.4   * Implement icon support (with translucency?)
     1.5   * Add diagonal line clipping to SDL_IntersectRectAndLine()
     1.6   * Add OpenGL 3.0 context support
     1.7 - * Have Bob look at why DirectColor visuals fail with XA_RGB_BEST_MAP error
     1.8   * Verify mouse grab support
     1.9   * Properly handle mouse grab with Vista DPI scaling
    1.10   * Make sure the mouse is where it's supposed to be when un-grabbed
     2.1 --- a/src/video/x11/SDL_x11modes.c	Thu Jan 01 18:49:43 2009 +0000
     2.2 +++ b/src/video/x11/SDL_x11modes.c	Thu Jan 01 18:58:26 2009 +0000
     2.3 @@ -32,13 +32,9 @@
     2.4  get_visualinfo(Display * display, int screen, XVisualInfo * vinfo)
     2.5  {
     2.6      const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID");
     2.7 -    /* FIXME FIXME FIXME
     2.8 -     * Window creation fails in the colormap code on DirectColor visuals:
     2.9 -     *      XA_RGB_BEST_MAP not found and could not be created
    2.10 -     * I'm disabling this for now until Bob can look at it.  We don't need
    2.11 -     * it until we implement the gamma fading using DirectColor RGB ramps
    2.12 -     */
    2.13 -    int use_directcolor = 0;
    2.14 +    /* We really don't need DirectColor visuals until we implement
    2.15 +     * gamma ramps, but we'll leave it on for now to catch bugs */
    2.16 +    int use_directcolor = 1;
    2.17      int depth;
    2.18  
    2.19      /* Look for an exact visual, if requested */
     3.1 --- a/src/video/x11/SDL_x11window.c	Thu Jan 01 18:49:43 2009 +0000
     3.2 +++ b/src/video/x11/SDL_x11window.c	Thu Jan 01 18:58:26 2009 +0000
     3.3 @@ -212,7 +212,7 @@
     3.4      xattr.background_pixel = 0;
     3.5      xattr.border_pixel = 0;
     3.6  
     3.7 -    if (visual->class == DirectColor || visual->class == PseudoColor) {
     3.8 +    if (visual->class == PseudoColor) {
     3.9          int nmaps;
    3.10          XStandardColormap cmap;
    3.11          XStandardColormap *stdmaps;
    3.12 @@ -299,6 +299,12 @@
    3.13              X11_TrackColormap(data->display, displaydata->screen, colormap,
    3.14                                &cmap, visual);
    3.15          }
    3.16 +    } else if (visual->class == DirectColor) {
    3.17 +        /* FIXME: Allocate a read-write colormap for gamma fading someday */
    3.18 +        xattr.colormap =
    3.19 +            XCreateColormap(data->display,
    3.20 +                            RootWindow(data->display, displaydata->screen),
    3.21 +                            visual, AllocNone);
    3.22      } else {
    3.23          xattr.colormap =
    3.24              XCreateColormap(data->display,