src/video/x11/SDL_x11modes.c
changeset 604 31d3af76488b
parent 499 f480ecd70499
child 607 f8710950cddc
equal deleted inserted replaced
603:2e726be3dc08 604:31d3af76488b
   111                 printf("Mode %d: %dx%d\n", i,
   111                 printf("Mode %d: %dx%d\n", i,
   112                         modes[i]->hdisplay, modes[i]->vdisplay);
   112                         modes[i]->hdisplay, modes[i]->vdisplay);
   113             }
   113             }
   114 #endif
   114 #endif
   115             for ( i = nmodes-1; i > 0 ; --i ) {
   115             for ( i = nmodes-1; i > 0 ; --i ) {
       
   116                 if ( (modes[i]->hdisplay == width) &&
       
   117                      (modes[i]->vdisplay == height) )
       
   118                     goto match;
       
   119             }
       
   120             for ( i = nmodes-1; i > 0 ; --i ) {
   116                 if ( (modes[i]->hdisplay >= width) &&
   121                 if ( (modes[i]->hdisplay >= width) &&
   117                      (modes[i]->vdisplay >= height) )
   122                      (modes[i]->vdisplay >= height) )
   118                     break;
   123                     break;
   119             }
   124             }
       
   125        match:
   120             if ( (modes[i]->hdisplay != mode.hdisplay) ||
   126             if ( (modes[i]->hdisplay != mode.hdisplay) ||
   121                  (modes[i]->vdisplay != mode.vdisplay) ) {
   127                  (modes[i]->vdisplay != mode.vdisplay) ) {
   122                 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]);
   128                 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]);
   123             }
   129             }
   124             XFree(modes);
   130             XFree(modes);