summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-10 20:10:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-10 20:10:22 (GMT)
commit2bc6576988e60413ca7873f9c9899f9f1f012564 (patch)
treec41e59c93f104338f9529db07105ceb8a246bd75 /win
parent6800a25eec9c9dfcd3640892d0a5a3d73e7409e7 (diff)
downloadtk-2bc6576988e60413ca7873f9c9899f9f1f012564.zip
tk-2bc6576988e60413ca7873f9c9899f9f1f012564.tar.gz
tk-2bc6576988e60413ca7873f9c9899f9f1f012564.tar.bz2
Better solution for [4d0a6f32b7], which doesn't cache padX/padY/borderWidth/hightlightWidth any more: If scaling changes, it needs to be re-calculated, which wasn't taken into account. Done for 'button' and 'message'
Diffstat (limited to 'win')
-rw-r--r--win/tkWinButton.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index a60fec2..88b98c6 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -565,6 +565,11 @@ TkpDisplayButton(
return;
}
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padXPtr, &butPtr->padX);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padYPtr, &butPtr->padY);
+
border = butPtr->normalBorder;
if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
gc = butPtr->disabledGC;
@@ -924,8 +929,8 @@ TkpDisplayButton(
if (relief != TK_RELIEF_FLAT) {
Tk_Draw3DRectangle(tkwin, pixmap, border,
defaultWidth, defaultWidth,
- Tk_Width(tkwin) - 2*defaultWidth,
- Tk_Height(tkwin) - 2*defaultWidth,
+ Tk_Width(tkwin) - 2 * defaultWidth,
+ Tk_Height(tkwin) - 2 * defaultWidth,
butPtr->borderWidth, relief);
}
if (defaultWidth != 0) {
@@ -1000,9 +1005,9 @@ TkpComputeButtonGeometry(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (butPtr->highlightWidth < 0) {
- butPtr->highlightWidth = 0;
- }
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
+
butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth;
butPtr->indicatorSpace = 0;
@@ -1195,6 +1200,9 @@ TkpComputeButtonGeometry(
* because otherwise it is not really a compound button.
*/
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padXPtr, &butPtr->padX);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padYPtr, &butPtr->padY);
+
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
case COMPOUND_TOP:
@@ -1265,8 +1273,8 @@ TkpComputeButtonGeometry(
height = butPtr->height;
}
- width += 2*butPtr->padX;
- height += 2*butPtr->padY;
+ width += 2 * butPtr->padX;
+ height += 2 * butPtr->padY;
} else if (haveImage) {
if (butPtr->width > 0) {
width = butPtr->width;