diff options
author | fvogel <fvogelnew1@free.fr> | 2018-10-06 09:22:10 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2018-10-06 09:22:10 (GMT) |
commit | 545944120f121ea765f6f74c911eea700acdc295 (patch) | |
tree | 59c65f42c1346b53f215033af5cee7b128cd0b21 /win | |
parent | d1f4d0e4a8e4c74689750d2470eb48403fd03478 (diff) | |
parent | 806e1a97bcd1635ec4b00fb3502c5690d5ce5a61 (diff) | |
download | tk-545944120f121ea765f6f74c911eea700acdc295.zip tk-545944120f121ea765f6f74c911eea700acdc295.tar.gz tk-545944120f121ea765f6f74c911eea700acdc295.tar.bz2 |
Fix [9658bc800c]: Several display issues with menu items, more easily seen whenborderwidth != activeborderwidth and when these values are larger than usually.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinMenu.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 1051250..a409764 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1482,6 +1482,15 @@ GetMenuIndicatorGeometry( Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); *widthPtr = indicatorDimensions[1] - borderWidth; + + /* + * Quite dubious about the above (why would borderWidth play a role?) + * and about how indicatorDimensions[1] is obtained in SetDefaults(). + * At least don't let the result be negative! + */ + if (*widthPtr < 0) { + *widthPtr = 0; + } } } @@ -2428,7 +2437,7 @@ DrawTearoffEntry( points[0].y = y + height/2; points[1].y = points[0].y; segmentWidth = 6; - maxX = width - 1; + maxX = x + width - 1; border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); while (points[0].x < maxX) { @@ -2874,7 +2883,7 @@ TkpComputeStandardMenuGeometry( menuPtr->entries[j]->entryFlags &= ~ENTRY_LAST_COLUMN; } x += indicatorSpace + labelWidth + accelWidth - + 2 * borderWidth; + + 2 * activeBorderWidth; indicatorSpace = labelWidth = accelWidth = 0; lastColumnBreak = i; y = borderWidth; @@ -2944,8 +2953,8 @@ TkpComputeStandardMenuGeometry( menuPtr->entries[j]->x = x; menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN; } - windowWidth = x + indicatorSpace + labelWidth + accelWidth + accelSpace - + 2 * activeBorderWidth + 2 * borderWidth; + windowWidth = x + indicatorSpace + labelWidth + accelWidth + + 2 * activeBorderWidth + borderWidth; windowHeight += borderWidth; @@ -3281,6 +3290,7 @@ SetDefaults( * * The code below was given to me by Microsoft over the phone. It is the * only way to ensure menu items line up, and is not documented. + * How strange the calculation of indicatorDimensions[1] is...! */ indicatorDimensions[0] = GetSystemMetrics(SM_CYMENUCHECK); |