Move window caption initialisation code.

The code is moved from game_controller::init_language to
game_controller::init_video. This makes porting the code to SDL 2
easier. In SDL 2 the caption must be set after the main window exists.
It could be set in the constructor of the Window, but that can be done
once we drop SDL 1.2 support.
This commit is contained in:
Mark de Wever 2014-03-09 12:17:25 +01:00
parent 26aad8b7ab
commit 632710bdad

View File

@ -328,16 +328,6 @@ bool game_controller::init_language()
}
::set_language(locale);
if(!cmdline_opts_.nogui) {
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::revision;
#if SDL_VERSION_ATLEAST(2, 0, 0)
CVideo::set_window_title(wm_title_string);
#else
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
#endif
}
return true;
}
@ -353,6 +343,12 @@ bool game_controller::init_video()
return true;
}
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::revision;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
#endif
#if !(defined(__APPLE__))
surface icon(image::get_image("game-icon.png", image::UNSCALED));
if(icon != NULL) {
@ -401,7 +397,9 @@ bool game_controller::init_video()
<< resolution.second << "x" << bpp << " is not supported\n";
return false;
}
#if SDL_VERSION_ATLEAST(2, 0, 0)
CVideo::set_window_title(wm_title_string);
#endif
return true;
}