X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=share%2Fst_resol.c;h=8d76cfacf0121152ba1fa05f139c344064d1e581;hb=90baa3b05af80b5996bb2eecebd58ca2ceb53acf;hp=ad3f75f97b52082f312177b3ec3482ab1b43bdb0;hpb=d2c9bca9aace20e142d510ed84587ac64914eede;p=neverball diff --git a/share/st_resol.c b/share/st_resol.c index ad3f75f..8d76cfa 100644 --- a/share/st_resol.c +++ b/share/st_resol.c @@ -28,7 +28,7 @@ extern struct state st_conf; extern struct state st_null; -SDL_Rect ** resolutions; +static SDL_Rect **resolutions; /*---------------------------------------------------------------------------*/ @@ -38,7 +38,7 @@ static int resol_action(int i) { int f = config_get_d(CONFIG_FULLSCREEN); int r = 1; - + switch (i) { case LANG_BACK: @@ -46,9 +46,9 @@ static int resol_action(int i) break; default: - goto_state(&st_null); - r = config_mode(f, resolutions[i-1]->w, resolutions[i-1]->h); - goto_state(&st_conf); + goto_state(&st_null); + r = config_mode(f, resolutions[i - 1]->w, resolutions[i - 1]->h); + goto_state(&st_conf); break; } @@ -68,18 +68,18 @@ static int resol_enter(void) /* Get the current resolution. */ w = config_get_d(CONFIG_WIDTH); h = config_get_d(CONFIG_HEIGHT); - + /* Get the resolution list. */ resolutions = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN); if ((int)resolutions == -1) { - resolutions = NULL; - printf("Any resolution\n"); + resolutions = NULL; + printf("Any resolution\n"); } else if (resolutions == NULL) { - printf("No resolution\n"); + printf("No resolution\n"); } if ((id = gui_harray(0))) @@ -89,32 +89,35 @@ static int resol_enter(void) if ((kd = gui_harray(jd))) { gui_label(kd, _("Resolution"), GUI_SML, GUI_ALL, 0, 0); - gui_filler(kd); - gui_start(kd, _("Back"), GUI_SML, LANG_BACK, 0); + gui_filler(kd); + gui_start(kd, _("Back"), GUI_SML, LANG_BACK, 0); + } + + if (resolutions != NULL) + { + hp = wp = -1; + c = 0; + for(i = 0; resolutions[i]; i++) + { + if (wp != resolutions[i]->w || hp != resolutions[i]->h) + { + static char st[100]; + wp = resolutions[i]->w; + hp = resolutions[i]->h; + sprintf(st, "%d x %d", wp, hp); + + if (c % 4 == 0) + kd = gui_harray(jd); + + gui_state(kd, st, GUI_SML, i + 1, + (w == wp) && (h == hp)); + c++; + } + } + + for(; c % 4 != 0; c++) + gui_filler(kd); } - - if (resolutions != NULL) - { - hp = wp = -1; - c = 0; - for(i=0; resolutions[i]; i++) - { - if (wp!=resolutions[i]->w || hp!=resolutions[i]->h) - { - static char st[100]; - wp = resolutions[i]->w; - hp = resolutions[i]->h; - sprintf(st, "%d x %d", wp, hp); - if (c % 4 == 0) - kd = gui_harray(jd); - gui_state(kd, st, GUI_SML, i+1, (w==wp) && (h==hp)); - c++; - } - } - - for(; c%4!=0; c++) - gui_filler(kd); - } } gui_layout(id, 0, 0); }