# HG changeset patch # User Ryan C. Gordon # Date 1165537892 0 # Node ID 34a4d02b8db14c072d8b78575eb350bbc2c54923 # Parent c611cb0638b26192195705ca1b0ce376c72ddbd7 Look for an exact match first when setting a video mode on BeOS. Fixes Bugzilla #370. diff -r c611cb0638b2 -r 34a4d02b8db1 src/video/bwindow/SDL_sysvideo.cc --- a/src/video/bwindow/SDL_sysvideo.cc Fri Dec 08 00:16:38 2006 +0000 +++ b/src/video/bwindow/SDL_sysvideo.cc Fri Dec 08 00:31:32 2006 +0000 @@ -370,12 +370,23 @@ (current.timing.h_total * current.timing.v_total); modes = SDL_modelist[((bpp + 7) / 8) - 1]; - for (i = 0; modes[i] && (modes[i]->w > width) && - (modes[i]->h > height); ++i) { - /* still looking */ + + bool exactmatch = false; + for ( uint32 x = 0; modes[x]; x++ ) { + if (modes[x]->w == width && modes[x]->h == height) { + exactmatch = true; + i = x; + break; + } } - if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) { - --i; /* We went too far */ + if (!exactmatch) { + for (i = 0; modes[i] && (modes[i]->w > width) && + (modes[i]->h > height); ++i) { + /* still looking */ + } + if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) { + --i; /* We went too far */ + } } width = modes[i]->w; height = modes[i]->h;