summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2019-11-11 01:45:54 (GMT)
committerculler <culler>2019-11-11 01:45:54 (GMT)
commit770d3ab7c71b257d3aee36fbd5346a71be5df6dd (patch)
treeb75136480d1c95d0576def616fc63259da5490a3 /macosx
parent9b325ebbd06b8857fffffe9107c87e993ca550a8 (diff)
downloadtk-770d3ab7c71b257d3aee36fbd5346a71be5df6dd.zip
tk-770d3ab7c71b257d3aee36fbd5346a71be5df6dd.tar.gz
tk-770d3ab7c71b257d3aee36fbd5346a71be5df6dd.tar.bz2
Allow creating 0x0 NSImages, which work e.g. in labels, just don't allow using them as iconphoto images.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDraw.c2
-rw-r--r--macosx/tkMacOSXWm.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 3f7ca0a..fb6a8a0 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -504,7 +504,7 @@ TkMacOSXGetNSImageWithTkImage(
Pixmap pixmap;
NSImage *nsImage;
if (width == 0 | height == 0) {
- return NULL;
+ return nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0,0)];
}
pixmap = Tk_GetPixmap(display, None, width, height, 0);
Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0);
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 086746b..0d49d74 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -2518,6 +2518,7 @@ WmIconphotoCmd(
{
Tk_Image tk_icon;
int width, height, isDefault = 0;
+ NSImage *newIcon = NULL;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2563,10 +2564,11 @@ WmIconphotoCmd(
return TCL_ERROR;
}
- NSImage *newIcon;
Tk_SizeOfImage(tk_icon, &width, &height);
- newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon,
- width, height);
+ if (width != 0 && height != 0) {
+ newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon,
+ width, height);
+ }
Tk_FreeImage(tk_icon);
if (newIcon == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(