From 5b4f0b239c9c69e330fcc1a78a5d5b222369355d Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Wed, 1 Jan 2014 16:52:07 -0500
Subject: [PATCH] add config option to set the window icon

---
 src/config.cpp |  1 +
 src/config.h   |  2 ++
 src/main.cpp   | 10 ++++++++++
 3 files changed, 13 insertions(+)

diff --git a/src/config.cpp b/src/config.cpp
index 6633f8b..7a2ad06 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -67,6 +67,7 @@ void Config::read()
     PO_DESC(gameFolder, std::string) \
     PO_DESC(anyAltToggleFS, bool) \
     PO_DESC(allowSymlinks, bool) \
+    PO_DESC(iconPath, std::string) \
     PO_DESC(customScript, std::string)
 
 // Not gonna take your shit boost
diff --git a/src/config.h b/src/config.h
index 235a69a..e380dae 100644
--- a/src/config.h
+++ b/src/config.h
@@ -47,6 +47,8 @@ struct Config
 	bool anyAltToggleFS;
 	bool allowSymlinks;
 
+	std::string iconPath;
+
 	std::string customScript;
 	std::vector<std::string> rtps;
 
diff --git a/src/main.cpp b/src/main.cpp
index f3824fa..2b07ef1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -297,6 +297,16 @@ int main(int, char *argv[])
 		return 0;
 	}
 
+	if (!conf.iconPath.empty())
+	{
+		SDL_Surface *iconImg = IMG_Load(conf.iconPath.c_str());
+		if (iconImg)
+		{
+			SDL_SetWindowIcon(win, iconImg);
+			SDL_FreeSurface(iconImg);
+		}
+	}
+
 	EventThread eventThread;
 	RGSSThreadData rtData(&eventThread, argv[0], win, conf);