diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-29 21:04:59 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-29 21:04:59 (GMT) |
commit | a6fb5d03374353e57d3f7e7d5d073153f7d51079 (patch) | |
tree | 8bbea806426b94f34eb0d872922a1da3619f8f22 /win/tkWinMenu.c | |
parent | 843db10016b16f9ec3f28c6574727d901cc9005a (diff) | |
parent | fb5142cb5e53bc33637e51d1259c380bc22a1dee (diff) | |
download | tk-a6fb5d03374353e57d3f7e7d5d073153f7d51079.zip tk-a6fb5d03374353e57d3f7e7d5d073153f7d51079.tar.gz tk-a6fb5d03374353e57d3f7e7d5d073153f7d51079.tar.bz2 |
Merge 8.6
Diffstat (limited to 'win/tkWinMenu.c')
-rw-r--r-- | win/tkWinMenu.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 5dc8f8a..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; + } } } @@ -1840,7 +1849,7 @@ DrawMenuEntryArrow( int width, /* Width of menu entry */ int height, /* Height of menu entry */ int drawArrow) /* For cascade menus, whether of not to draw - * the arraw. I cannot figure out Windows' + * the arrow. I cannot figure out Windows' * algorithm for where to draw this. */ { COLORREF oldFgColor; @@ -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) { @@ -2500,7 +2509,7 @@ TkpDrawMenuEntry( int strictMotif, /* Boolean flag */ int drawingParameters) /* Whether or not to draw the cascade arrow * for cascade items and accelerator - * cues. Only applies to Windows. */ + * cues. */ { GC gc, indicatorGC; TkMenu *menuPtr = mePtr->menuPtr; @@ -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); |