Skip to content

Commit

Permalink
Fixed bug 1979 - X11_SetGammaRamp doesn't check the return value of X…
Browse files Browse the repository at this point in the history
…StoreColors

Sven Hesse

Here on my laptop with an ATI Mobility Radeon 9600 PRO Turbo (RV350), the free radeon drivers and X.org 1.12.4, SDL_SetGamma() fails because it tries to use SDL_SetGammaRamp() if available. SDL_SetGammaRamp() uses XStoreColors(), and that call always fails with BadRequest (for whatever reason, I don't know). The SDL_Visual class check goes through, though.

Now, XStoreColors failing is maybe another bug in SDL, or in Xorg, or in the radeon drivers or anywhere else, but I think SDL should still check that the XStoreColors() doesn't error as well.
  • Loading branch information
slouken committed Jul 21, 2013
1 parent f1b5582 commit 7f26604
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/video/x11/SDL_x11video.c
Expand Up @@ -1481,7 +1481,10 @@ int X11_SetGammaRamp(_THIS, Uint16 *ramp)
xcmap[i].blue = ramp[2*256+c];
xcmap[i].flags = (DoRed|DoGreen|DoBlue);
}
XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
if ( XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors) != 0 ) {
SDL_SetError("Setting gamma correction failed");
return(-1);
}
XSync(GFX_Display, False);
return(0);
}
Expand Down

0 comments on commit 7f26604

Please sign in to comment.