summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXButton.c
diff options
context:
space:
mode:
authorculler <culler>2018-05-01 22:32:54 (GMT)
committerculler <culler>2018-05-01 22:32:54 (GMT)
commit468e5a9fcf5124df5da5e25eb1aed3f8dd46bcaa (patch)
treed87fed5c406e4f05adf141d7e7132ea0c5b30e07 /macosx/tkMacOSXButton.c
parentda8c99c251fa91c34e272516f5c381724862ada8 (diff)
downloadtk-468e5a9fcf5124df5da5e25eb1aed3f8dd46bcaa.zip
tk-468e5a9fcf5124df5da5e25eb1aed3f8dd46bcaa.tar.gz
tk-468e5a9fcf5124df5da5e25eb1aed3f8dd46bcaa.tar.bz2
Eliminate unnecessary offsets. This moves buttons down 1px, which is better.
Diffstat (limited to 'macosx/tkMacOSXButton.c')
-rw-r--r--macosx/tkMacOSXButton.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 964dcff..1bb3a1d 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -21,19 +21,16 @@
#include "tkMacOSXFont.h"
#include "tkMacOSXDebug.h"
-
#define FIRST_DRAW 2
#define ACTIVE 4
-
/*
- * Default insets for controls - used to adjust button metrics.
+ * Extra padding used for computing the content size that should
+ * be allowed when drawing the HITheme button.
*/
-#define DEF_INSET_LEFT 0
-#define DEF_INSET_RIGHT 0
-#define DEF_INSET_TOP 1
-#define DEF_INSET_BOTTOM 1
+#define HI_PADX 0
+#define HI_PADY 1
/*
* Some defines used to control what type of control is drawn.
@@ -395,9 +392,7 @@ TkpComputeButtonGeometry(
int paddingx = 0;
int paddingy = 0;
- tmpRect = CGRectMake(0, 0,
- width + DEF_INSET_LEFT + DEF_INSET_RIGHT,
- height + DEF_INSET_BOTTOM + DEF_INSET_TOP);
+ tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY);
HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds);
/* If the content region has a minimum height, match it. */
@@ -650,7 +645,7 @@ DrawButtonImageAndText(
butPtr->textHeight, &x, &y);
x += butPtr->indicatorSpace;
Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout,
- x + DEF_INSET_LEFT, y - DEF_INSET_BOTTOM, 0, -1);
+ x, y, 0, -1);
}
/*
@@ -787,19 +782,6 @@ TkMacOSXDrawButton(
return;
}
-
- if (mbPtr->btnkind == kThemePushButton) {
- /*
- * For some reason, pushbuttons get drawn a bit
- * too low, normally. Correct for this.
- */
- if (cntrRect.size.height < 22) {
- cntrRect.origin.y -= 1;
- } else if (cntrRect.size.height < 23) {
- cntrRect.origin.y -= 2;
- }
- }
-
hiinfo.version = 0;
hiinfo.state = mbPtr->drawinfo.state;
hiinfo.kind = mbPtr->btnkind;
@@ -911,7 +893,10 @@ ButtonContentDrawCB (
return;
}
- /*Overlay Tk elements over button native region: drawing elements within button boundaries/native region causes unpredictable metrics.*/
+ /*
+ * Overlay Tk elements over button native region: drawing elements
+ * within button boundaries/native region causes unpredictable metrics.
+ */
DrawButtonImageAndText( butPtr);
}