summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-03-25 15:50:47 (GMT)
committerculler <culler>2019-03-25 15:50:47 (GMT)
commit2cf5a82a75201dd866c90d3add0462c19854d88f (patch)
tree5102b88fd4bd8ed14174167e0fed32cf4a7a2061
parent53623d974a56e46a09078d5c6d72a792f9018829 (diff)
downloadtk-2cf5a82a75201dd866c90d3add0462c19854d88f.zip
tk-2cf5a82a75201dd866c90d3add0462c19854d88f.tar.gz
tk-2cf5a82a75201dd866c90d3add0462c19854d88f.tar.bz2
Fix bug [48c39440af]: On macOS, Buttons and Labels do not recompute their
textLayout when the text option is set to an empty string.
-rw-r--r--macosx/tkMacOSXButton.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index c0b83f2..484dcf2 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -295,11 +295,11 @@ TkpComputeButtonGeometry(
haveImage = 1;
}
- if (strlen(text) > 0) {
+ if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
- butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
+ text, -1, butPtr->wrapLength, butPtr->justify, 0,
+ &butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth + 2*butPtr->padX;
txtHeight = butPtr->textHeight + 2*butPtr->padY;