summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2017-12-05 05:40:57 (GMT)
committerculler <culler>2017-12-05 05:40:57 (GMT)
commit67ded6980e35fe5ad7b70688c3693a843a29321d (patch)
tree91f373a1c5a307eb60252d21a72e12f494a6ae12 /macosx
parentbf99dc878386c11ea23ce74bd2ef46acf6108ec8 (diff)
downloadtk-67ded6980e35fe5ad7b70688c3693a843a29321d.zip
tk-67ded6980e35fe5ad7b70688c3693a843a29321d.tar.gz
tk-67ded6980e35fe5ad7b70688c3693a843a29321d.tar.bz2
On macOS, set a default application icon only when no icon has been declared in
an Info.plist file.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXInit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e1436b2..fed81e5 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -161,6 +161,23 @@ long tkMacOSXMacOSXVersion = 0;
* Make sure we are allowed to open windows.
*/
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+
+ /*
+ * If no icon has been set from an Info.plist file, use the Wish icon from
+ * the Tk framework.
+ */
+ NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey:
+ @"CFBundleIconFile"];
+ if (!iconFile) {
+ NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"];
+ if (path) {
+ NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
+ if (image) {
+ [NSApp setApplicationIconImage:image];
+ [image release];
+ }
+ }
+ }
}
- (NSString *) tkFrameworkImagePath: (NSString *) image