summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-03-21 14:49:26 (GMT)
committerculler <culler>2019-03-21 14:49:26 (GMT)
commit524655affdae491aad1119f37f59df0109de17e8 (patch)
tree7903cb13e98ab7d4384a9eeec864a1908456293c
parent9aba30314f2d23fe5a6ac36d7c12d056fa286ab9 (diff)
downloadtk-524655affdae491aad1119f37f59df0109de17e8.zip
tk-524655affdae491aad1119f37f59df0109de17e8.tar.gz
tk-524655affdae491aad1119f37f59df0109de17e8.tar.bz2
Make top and bottom button padding equal, even when the suggested total
vertical padding is odd.
-rw-r--r--macosx/ttkMacOSXTheme.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 4fd506b..d136b99 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -836,7 +836,7 @@ static void ButtonElementSize(
{
ThemeButtonParams *params = clientData;
const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, 0, tkwin);
- static const CGRect scratchBounds = {{0, 0}, {100, 20}};
+ static const CGRect scratchBounds = {{0, 0}, {100, 100}};
CGRect contentBounds, backgroundBounds;
int verticalPad;
@@ -864,18 +864,11 @@ static void ButtonElementSize(
&scratchBounds, &info, &contentBounds);
ChkErr(HIThemeGetButtonBackgroundBounds,
&scratchBounds, &info, &backgroundBounds);
- if (info.kind == kThemeComboBox) {
- printf("ButtonElementSize: combobox %s contentBounds = %s\n",
- Tk_PathName(tkwin), NSStringFromRect(contentBounds).UTF8String);
- printf("ButtonElementSize: combobox %s backgroundBounds = %s\n\n",
- Tk_PathName(tkwin), NSStringFromRect(backgroundBounds).UTF8String);
- }
paddingPtr->left = contentBounds.origin.x - backgroundBounds.origin.x;
paddingPtr->right = (CGRectGetMaxX(backgroundBounds) -
CGRectGetMaxX(contentBounds));
verticalPad = backgroundBounds.size.height - contentBounds.size.height;
- paddingPtr->top = verticalPad /2;
- paddingPtr->bottom = verticalPad - paddingPtr->top;
+ paddingPtr->top = paddingPtr->bottom = verticalPad / 2;
}
static void ButtonElementDraw(