diff --git a/data/game_config.cfg b/data/game_config.cfg index 21ee70291c1..9a53fddd367 100644 --- a/data/game_config.cfg +++ b/data/game_config.cfg @@ -77,7 +77,6 @@ [images] game_title="maps/wesnoth.png" game_logo="misc/logo.png" - game_icon="wesnoth-icon-small.png" moved_orb="misc/orb-moved.png" unmoved_orb="misc/orb-unmoved.png" diff --git a/images/wesnoth-icon-small.png b/images/game-icon.png similarity index 100% rename from images/wesnoth-icon-small.png rename to images/game-icon.png diff --git a/src/game.cpp b/src/game.cpp index c8e3401bf8f..a5be31f534c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -536,8 +536,13 @@ bool game_controller::init_video() return true; } - //NOTE will use the hardcoded icon, game_config is not ready yet - image::set_wm_icon(); +#if !(defined(__APPLE__)) + surface icon(image::get_image("game-icon.png", image::UNSCALED)); + if(icon != NULL) { + ///must be called after SDL_Init() and before setting video mode + ::SDL_WM_SetIcon(icon,NULL); + } +#endif std::pair resolution; int bpp = 0; @@ -598,10 +603,6 @@ bool game_controller::init_config(const bool force) const config &cfg = game_config().child("game_config"); game_config::load_config(cfg ? &cfg : NULL); - //the game_config icon may be different from the hardcoded one - //FIXME SDL seems to segfault when setting twice the same icon - //image::set_wm_icon(); - hotkey::deactivate_all_scopes(); hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_GAME); diff --git a/src/game_config.cpp b/src/game_config.cpp index 21a82d8dd05..892406235e4 100644 --- a/src/game_config.cpp +++ b/src/game_config.cpp @@ -63,9 +63,7 @@ namespace game_config default_defeat_music; namespace images { - //NOTE hardcode game_icon because used before that game_config is ready - std::string game_icon = "wesnoth-icon-small.png", - game_title, + std::string game_title, game_logo, // orbs and hp/xp bar moved_orb, @@ -186,7 +184,6 @@ namespace game_config if(const config &i = v.child("images")){ using namespace game_config::images; - game_icon = i["game_icon"].str(); game_title = i["game_title"].str(); game_logo = i["game_logo"].str(); diff --git a/src/game_config.hpp b/src/game_config.hpp index e902ddd60ad..e0f90bc131c 100644 --- a/src/game_config.hpp +++ b/src/game_config.hpp @@ -70,8 +70,7 @@ namespace game_config default_defeat_music; namespace images { - extern std::string game_icon, - game_title, + extern std::string game_title, game_logo, // orbs and hp/xp bar moved_orb, diff --git a/src/image.cpp b/src/image.cpp index 0d3fb8c6c21..8561e8f1ddf 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -879,16 +879,6 @@ manager::~manager() flush_cache(); } -void set_wm_icon() -{ -#if !(defined(__APPLE__)) - surface icon(get_image(game_config::images::game_icon,UNSCALED)); - if(icon != NULL) { - ::SDL_WM_SetIcon(icon,NULL); - } -#endif -} - SDL_PixelFormat last_pixel_format; void set_pixel_format(SDL_PixelFormat* format) diff --git a/src/image.hpp b/src/image.hpp index c67d0e0f8df..34d314fe133 100644 --- a/src/image.hpp +++ b/src/image.hpp @@ -165,11 +165,6 @@ namespace image { ~manager(); }; - ///function to set the program's icon to the window manager. - ///must be called after SDL_Init() is called, but before setting the - ///video mode - void set_wm_icon(); - ///will make all scaled images have these rgb values added to all ///their pixels. i.e. add a certain color hint to images. useful ///for representing day/night. Invalidates all scaled images.