summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-08-10 16:51:37 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-08-10 16:51:37 (GMT)
commitad45c00441bc4f99294ea11c71f6440dd3978ee9 (patch)
treed646ece238bf26734613ce225aaca49d3b050b11
parent2e2413944cbe72a1dc484bf830dcf9c99f654d11 (diff)
parent77587d48dfa24f29cf65de67ac0abc7f8baa86cd (diff)
downloadtk-ad45c00441bc4f99294ea11c71f6440dd3978ee9.zip
tk-ad45c00441bc4f99294ea11c71f6440dd3978ee9.tar.gz
tk-ad45c00441bc4f99294ea11c71f6440dd3978ee9.tar.bz2
Merge in chavez_spinbox
-rw-r--r--generic/tkEntry.c24
-rw-r--r--macosx/tkMacOSXEntry.c23
2 files changed, 22 insertions, 25 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index a7bc5a0..0dfacd7 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1513,17 +1513,15 @@ EntryWorldChanged(
*
* TkpDrawEntryBorderAndFocus --
*
- * This function redraws the border of an entry widget. It overrides the
- * generic border drawing code if the entry widget parameters are such
- * that the native widget drawing is a good fit. This version just
- * returns 0, so platforms that don't do special native drawing don't
- * have to implement it.
+ * Stub function for Tk on platforms other than Aqua
+ * (Windows and X11), which do not draw native entry borders.
+ * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua.
*
* Results:
- * 1 if it has drawn the border, 0 if not.
+ * Returns 0.
*
* Side effects:
- * May draw the entry border into pixmap.
+ * None.
*
*--------------------------------------------------------------
*/
@@ -1542,17 +1540,15 @@ TkpDrawEntryBorderAndFocus(
*
* TkpDrawSpinboxButtons --
*
- * This function redraws the buttons of an spinbox widget. It overrides
- * the generic button drawing code if the spinbox widget parameters are
- * such that the native widget drawing is a good fit. This version just
- * returns 0, so platforms that don't do special native drawing don't
- * have to implement it.
+ * Stub function for Tk on platforms other than Aqua
+ * (Windows and X11), which do not draw native spinbox buttons.
+ * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua.
*
* Results:
- * 1 if it has drawn the border, 0 if not.
+ * Returns 0.
*
* Side effects:
- * May draw the entry border into pixmap.
+ * None.
*
*--------------------------------------------------------------
*/
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index a1c5d60..7915f6f 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -124,16 +124,17 @@ TkpDrawEntryBorderAndFocus(
int incDecWidth;
/*
- * Temporarily change the width of the widget so that the same code can
- * be used for drawing the Entry portion of the Spinbox as is used to
- * draw an ordinary Entry. The width must be restored before
- * returning.
+ * If native spinbox buttons are going to be drawn, then temporarily
+ * change the width of the widget so that the same code can be used
+ * for drawing the Entry portion of the Spinbox as is used to draw
+ * an ordinary Entry. The width must be restored before returning.
*/
oldWidth = Tk_Width(tkwin);
- ComputeIncDecParameters(Tk_Height(tkwin) - 2 * MAC_OSX_FOCUS_WIDTH,
- &incDecWidth);
- Tk_Width(tkwin) -= incDecWidth + 1;
+ if (ComputeIncDecParameters(Tk_Height(tkwin) - 2 * MAC_OSX_FOCUS_WIDTH,
+ &incDecWidth) != 0) {
+ Tk_Width(tkwin) -= incDecWidth + 1;
+ }
}
/*
@@ -186,10 +187,10 @@ TkpDrawEntryBorderAndFocus(
* have to implement it.
*
* Results:
- * 1 if it has drawn the border, 0 if not.
+ * 1 if it has drawn the buttons, 0 if not.
*
* Side effects:
- * May draw the entry border into pixmap.
+ * May draw the buttons into pixmap.
*
*--------------------------------------------------------------
*/
@@ -258,9 +259,9 @@ TkpDrawSpinboxButtons(
*/
bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d);
- rects[0].x = bounds.origin.x;
+ rects[0].x = Tk_Width(tkwin) - incDecWidth - 1;
rects[0].y = 0;
- rects[0].width = Tk_Width(tkwin);
+ rects[0].width = incDecWidth + 1;
rects[0].height = Tk_Height(tkwin);
XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1);