Skip to content

Commit

Permalink
Fix corrupted display of application icon in Linux (#957)
Browse files Browse the repository at this point in the history
A new ico file was created using imagemagick.
  • Loading branch information
crisisinaptica authored and sirjuddington committed Nov 19, 2018
1 parent 402d99d commit 00a4a2b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
Binary file modified dist/res/slade.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions src/Application/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ bool App::useSFMLRenderWindow()
#endif
}

const string App::getIcon()
{
return "slade.ico";
}

std::thread::id App::mainThreadId()
{
return main_thread_id;
Expand Down
7 changes: 4 additions & 3 deletions src/Application/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ enum Platform
MacOS,
Unknown
};
Platform platform();
bool useWebView();
bool useSFMLRenderWindow();
Platform platform();
bool useWebView();
bool useSFMLRenderWindow();
const string getIcon();

std::thread::id mainThreadId();
} // namespace App
8 changes: 4 additions & 4 deletions src/MainEditor/UI/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ void MainWindow::setupLayout()
wxAuiPaneInfo p_inf;

// Set icon
string icon_filename = App::path("slade.ico", App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
string icon_filename = App::path(App::getIcon(), App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry(App::getIcon())->exportFile(icon_filename);
SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
wxRemoveFile(icon_filename);

Expand Down Expand Up @@ -681,8 +681,8 @@ bool MainWindow::handleAction(string id)
info.SetDescription("It's a Doom Editor");

// Set icon
string icon_filename = App::path("slade.ico", App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
string icon_filename = App::path(App::getIcon(), App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry(App::getIcon())->exportFile(icon_filename);
info.SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
wxRemoveFile(icon_filename);

Expand Down
4 changes: 2 additions & 2 deletions src/MapEditor/UI/MapEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ MapEditorWindow::MapEditorWindow() :
custom_menus_begin_ = 2;

// Set icon
string icon_filename = App::path("slade.ico", App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
string icon_filename = App::path(App::getIcon(), App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry(App::getIcon())->exportFile(icon_filename);
SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
wxRemoveFile(icon_filename);

Expand Down
4 changes: 2 additions & 2 deletions src/Scripting/UI/ScriptManagerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ void ScriptManagerWindow::setupLayout()
wxAuiPaneInfo p_inf;

// Set icon
auto icon_filename = App::path("slade.ico", App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
auto icon_filename = App::path(App::getIcon(), App::Dir::Temp);
App::archiveManager().programResourceArchive()->getEntry(App::getIcon())->exportFile(icon_filename);
SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
wxRemoveFile(icon_filename);

Expand Down

0 comments on commit 00a4a2b

Please sign in to comment.