diff options
-rw-r--r-- | generic/tkMenuDraw.c | 36 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 2 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 6 | ||||
-rw-r--r-- | win/tkWinMenu.c | 18 |
4 files changed, 28 insertions, 34 deletions
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 1abe1c4..3f492db 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -624,7 +624,6 @@ DisplayMenu( int width; int borderWidth; Tk_3DBorder border; - int activeBorderWidth; int relief; @@ -636,8 +635,6 @@ DisplayMenu( Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, - menuPtr->activeBorderWidthPtr, &activeBorderWidth); if (menuPtr->menuType == MENUBAR) { Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, borderWidth, @@ -668,28 +665,16 @@ DisplayMenu( } mePtr->entryFlags &= ~ENTRY_NEEDS_REDISPLAY; - if (menuPtr->menuType == MENUBAR) { - width = mePtr->width; - } else { - if (mePtr->entryFlags & ENTRY_LAST_COLUMN) { - width = Tk_Width(menuPtr->tkwin) - mePtr->x - - activeBorderWidth; - } else { - width = mePtr->width + borderWidth; - } - } TkpDrawMenuEntry(mePtr, Tk_WindowId(menuPtr->tkwin), tkfont, - &menuMetrics, mePtr->x, mePtr->y, width, + &menuMetrics, mePtr->x, mePtr->y, mePtr->width, mePtr->height, strictMotif, 1); if ((index > 0) && (menuPtr->menuType != MENUBAR) && mePtr->columnBreak) { mePtr = menuPtr->entries[index - 1]; Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, - mePtr->x, mePtr->y + mePtr->height, - mePtr->width, - Tk_Height(tkwin) - mePtr->y - mePtr->height - - activeBorderWidth, 0, - TK_RELIEF_FLAT); + mePtr->x, mePtr->y + mePtr->height, mePtr->width, + Tk_Height(tkwin) - mePtr->y - mePtr->height - borderWidth, + 0, TK_RELIEF_FLAT); } } @@ -698,19 +683,18 @@ DisplayMenu( if (menuPtr->numEntries == 0) { x = y = borderWidth; - width = Tk_Width(tkwin) - 2 * activeBorderWidth; - height = Tk_Height(tkwin) - 2 * activeBorderWidth; + width = Tk_Width(tkwin) - 2 * borderWidth; + height = Tk_Height(tkwin) - 2 * borderWidth; } else { mePtr = menuPtr->entries[menuPtr->numEntries - 1]; Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, mePtr->x, mePtr->y + mePtr->height, mePtr->width, - Tk_Height(tkwin) - mePtr->y - mePtr->height - - activeBorderWidth, 0, - TK_RELIEF_FLAT); + Tk_Height(tkwin) - mePtr->y - mePtr->height - borderWidth, + 0, TK_RELIEF_FLAT); x = mePtr->x + mePtr->width; y = mePtr->y + mePtr->height; - width = Tk_Width(tkwin) - x - activeBorderWidth; - height = Tk_Height(tkwin) - y - activeBorderWidth; + width = Tk_Width(tkwin) - x - borderWidth; + height = Tk_Height(tkwin) - y - borderWidth; } Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y, width, height, 0, TK_RELIEF_FLAT); diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 08f2f72..c625232 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1139,7 +1139,7 @@ TkpComputeStandardMenuGeometry( columnEntryPtr->x = x; columnEntryPtr->entryFlags &= ~ENTRY_LAST_COLUMN; } - x += maxIndicatorSpace + maxWidth + 2 * borderWidth; + x += maxIndicatorSpace + maxWidth + 2 * activeBorderWidth; maxWidth = maxIndicatorSpace = 0; lastColumnBreak = i; y = borderWidth; diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 2d02097..38b6c58 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -640,7 +640,7 @@ DrawMenuSeparator( points[0].x = x; points[0].y = y + height/2; - points[1].x = width - 1; + points[1].x = x + width - 1; points[1].y = points[0].y; border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1, @@ -1195,7 +1195,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) { @@ -1720,7 +1720,7 @@ TkpComputeStandardMenuGeometry( menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN; } windowWidth = x + indicatorSpace + labelWidth + accelWidth - + 2 * activeBorderWidth + 2 * borderWidth; + + 2 * activeBorderWidth + borderWidth; windowHeight += borderWidth; 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); |