Skip to content

Commit

Permalink
(cherry-pick): Fix [13ac26b35d]: wm iconbitmap does not correctly set…
Browse files Browse the repository at this point in the history
… the icon pixmap hint on macOS. Thanks to Serhiy Storchaka
  • Loading branch information
jan.nijtmans committed Jan 3, 2025
1 parent ef181a1 commit 66a0174
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
3 changes: 3 additions & 0 deletions changes
Original file line number Diff line number Diff line change
Expand Up @@ -8253,3 +8253,6 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
(emiliano)

- Released 8.6.16, Dec 11, 2024 - https://core.tcl-lang.org/tk/ for details

2025-01-03 (bug) [13ac26] wm iconbitmap does not correctly set the icon
pixmap hint on macOS (serhiy.storchaka)
15 changes: 8 additions & 7 deletions macosx/tkMacOSXWm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2363,14 +2363,15 @@ WmIconbitmapCmd(
TkMacOSXMakeRealWindowExist(winPtr);
}
if (WmSetAttribute(winPtr, TkMacOSXGetNSWindowForDrawable(winPtr->window), interp,
WMATT_TITLEPATH, objv[3]) == TCL_OK) {
if (!len) {
if (wmPtr->hints.icon_pixmap != None) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
wmPtr->hints.icon_pixmap = None;
}
wmPtr->hints.flags &= ~IconPixmapHint;
WMATT_TITLEPATH, objv[3]) != TCL_OK) {
return TCL_ERROR;
}
if (!len) {
if (wmPtr->hints.icon_pixmap != None) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
wmPtr->hints.icon_pixmap = None;
}
wmPtr->hints.flags &= ~IconPixmapHint;
} else {
pixmap = Tk_GetBitmap(interp, (Tk_Window)winPtr, Tk_GetUid(str));
if (pixmap == None) {
Expand Down
10 changes: 2 additions & 8 deletions tests/unixWm.test
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,9 @@ test unixWm-22.2 {Tk_WmCmd procedure, "iconbitmap" option} {unix testwrapper} {
WM_HINTS] 0]]]
lappend result [wm iconbitmap .t] $bit
} {{} questhead 0x4 {} 0x0}
if {[tk windowingsystem] eq "aqua"} {
set result_22_3 {0 {}}
} else {
set result_22_3 {1 {bitmap "bad-bitmap" not defined}}
}
test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \
unix {
test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option} unix {
list [catch {wm iconbitmap .t bad-bitmap} msg] $msg
} $result_22_3
} {1 {bitmap "bad-bitmap" not defined}}

test unixWm-23.1 {Tk_WmCmd procedure, "iconify" option} unix {
list [catch {wm iconify .t 12} msg] $msg
Expand Down
4 changes: 2 additions & 2 deletions tests/wm.test
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,11 @@ test wm-iconbitmap-1.2.2 {usage} -constraints win -returnCodes error -body {
test wm-iconbitmap-1.3 {usage} -constraints win -returnCodes error -body {
wm iconbitmap .t 12 13
} -result {illegal option "12" must be "-default"}
test wm-iconbitmap-1.4 {usage} -constraints notAqua -returnCodes error -body {
test wm-iconbitmap-1.4 {usage} -returnCodes error -body {
wm iconbitmap .t bad-bitmap
} -result {bitmap "bad-bitmap" not defined}

test wm-iconbitmap-2.1 {setting and reading values} -constraints notAqua -setup {
test wm-iconbitmap-2.1 {setting and reading values} -setup {
set result {}
} -body {
lappend result [wm iconbitmap .t]
Expand Down

0 comments on commit 66a0174

Please sign in to comment.