--- SDL-1.2.15.old/src/video/x11/SDL_x11modes.c +++ SDL-1.2.15/src/video/x11/SDL_x11modes.c @@ -207,16 +207,27 @@ #endif int i, nsizes; XRRScreenSize *sizes; + int best = -1; /* find the smallest resolution that is at least as big as the user requested */ sizes = XRRConfigSizes(screen_config, &nsizes); + for ( i = (nsizes-1); i >= 0; i-- ) { - if ( (SDL_modelist[i]->w >= width) && - (SDL_modelist[i]->h >= height) ) { - break; + int cw = SDL_modelist[i]->w; + int ch = SDL_modelist[i]->h; + + if ((cw < width) || (ch < height)) continue; + if (best < 0) { best = i; continue; } + + if ((cw <= SDL_modelist [best]->w) && + (ch <= SDL_modelist [best]->h)) + { + best = i; } } + i = best; + if ( i >= 0 && SDL_modelist[i] ) { /* found one, lets try it */ int w, h; @@ -421,10 +432,12 @@ return 0; } +#ifdef NOTDEF /* This defaults off now, due to KDE window maximize problems */ if ( !env ) { return 0; } +#endif if ( !SDL_X11_HAVE_XRANDR ) { return 0; @@ -515,6 +528,8 @@ int xrandr_major, xrandr_minor; int nsizes; XRRScreenSize *sizes; +#else +#error XRANDR is required for this copy of SDL 1.2 #endif #if SDL_VIDEO_DRIVER_X11_VIDMODE int vm_major, vm_minor;