summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2017-11-11 04:07:18 (GMT)
committerKevin Walzer <kw@codebykevin.com>2017-11-11 04:07:18 (GMT)
commit89d6afc3b40e07487bfcf0799f756abfbec949b5 (patch)
tree3d6dd93243286c4ec9be20fa7ba3dc0d86c44208 /macosx
parentd5df7df7c8c66da6af400db30f3561061140647c (diff)
downloadtk-89d6afc3b40e07487bfcf0799f756abfbec949b5.zip
tk-89d6afc3b40e07487bfcf0799f756abfbec949b5.tar.gz
tk-89d6afc3b40e07487bfcf0799f756abfbec949b5.tar.bz2
Add comments to wm_iconphoto implementation on macOS
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 829c796..1f766c1 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -2357,6 +2357,7 @@ WmIconphotoCmd(
return TCL_ERROR;
}
+ /*Parse args.*/
if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) {
isDefault = 1;
if (objc == 4) {
@@ -2366,13 +2367,16 @@ WmIconphotoCmd(
}
}
+ /*Get icon name. We only use the first icon name because macOS does not
+ support multiple images in Tk photos.*/
char *icon;
if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) {
icon = Tcl_GetString(objv[4]);
} else {
icon = Tcl_GetString(objv[3]);
}
-
+
+ /*Get image and convert to NSImage that can be displayed as icon.*/
tk_icon = Tk_GetImage(interp, winPtr, icon, NULL, NULL);
Tk_SizeOfImage(tk_icon, &width, &height);
@@ -2381,6 +2385,7 @@ WmIconphotoCmd(
[NSApp setApplicationIconImage: newIcon];
Tk_FreeImage(tk_icon);
+
return TCL_OK;
}