summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tkMacOSXEntry.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index ab236c6..dfb9eb1 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -91,7 +91,7 @@ TkpDrawEntryBorderAndFocus(
TkMacOSXDrawingContext dc;
GC bgGC;
Tk_Window tkwin = entryPtr->tkwin;
- int oldWidth = 0;
+ int oldWidth;
MacDrawable *macDraw = (MacDrawable *) d;
const HIThemeFrameDrawInfo info = {
.version = 0,
@@ -123,8 +123,14 @@ TkpDrawEntryBorderAndFocus(
if (isSpinbox) {
int incDecWidth;
- oldWidth = Tk_Width(tkwin);
+ /*
+ * 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;
@@ -149,6 +155,15 @@ TkpDrawEntryBorderAndFocus(
bounds.size.width = Tk_Width(tkwin) - 2*MAC_OSX_FOCUS_WIDTH;
bounds.size.height = Tk_Height(tkwin) - 2*MAC_OSX_FOCUS_WIDTH;
if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) {
+
+ /*
+ * No graphics context is available. If the widget is a Spinbox, we
+ * must restore its width before returning 0. (Ticket [273b6a4996].)
+ */
+
+ if (isSpinbox) {
+ Tk_Width(tkwin) = oldWidth;
+ }
return 0;
}
ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation);