summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-03-20 09:56:09 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-03-20 09:56:09 (GMT)
commit80c74be24faeeddbe71c2078229afbde8d89e3dc (patch)
tree1f7af24a28f67125278458a9ca39d0a58d748a68 /win
parentf104e0a2222fbd4e8b71eba4a637e04d08356aea (diff)
downloadtk-80c74be24faeeddbe71c2078229afbde8d89e3dc.zip
tk-80c74be24faeeddbe71c2078229afbde8d89e3dc.tar.gz
tk-80c74be24faeeddbe71c2078229afbde8d89e3dc.tar.bz2
Fixed bug [487861ffff] - cascade with -accelerator looks wrong (cherrypicked [282635ad52])
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 4593928..8eede75 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -155,7 +155,7 @@ static void DrawWindowsSystemBitmap(Display *display,
Drawable drawable, GC gc, const RECT *rectPtr,
int bitmapID, int alignFlags);
static void FreeID(WORD commandID);
-static char * GetEntryText(TkMenuEntry *mePtr);
+static char * GetEntryText(TkMenu *menuPtr, TkMenuEntry *mePtr);
static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
const Tk_FontMetrics *fmPtr, int *widthPtr,
@@ -486,6 +486,7 @@ TkpDestroyMenuEntry(
static char *
GetEntryText(
+ TkMenu *menuPtr, /* The menu considered. */
TkMenuEntry *mePtr) /* A pointer to the menu entry. */
{
char *itemText;
@@ -506,7 +507,7 @@ GetEntryText(
int i;
const char *label = (mePtr->labelPtr == NULL) ? ""
: Tcl_GetString(mePtr->labelPtr);
- const char *accel = (mePtr->accelPtr == NULL) ? ""
+ const char *accel = ((menuPtr->menuType == MENUBAR) || (mePtr->accelPtr == NULL)) ? ""
: Tcl_GetString(mePtr->accelPtr);
const char *p, *next;
Tcl_DString itemString;
@@ -605,7 +606,7 @@ ReconfigureWindowsMenu(
continue;
}
- itemText = GetEntryText(mePtr);
+ itemText = GetEntryText(menuPtr, mePtr);
if ((menuPtr->menuType == MENUBAR)
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
Tcl_WinUtfToTChar(itemText, -1, &translatedText);
@@ -1502,12 +1503,12 @@ GetMenuAccelGeometry(
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
*widthPtr = 0;
- } else if (mePtr->accelPtr == NULL) {
- *widthPtr = 0;
- } else {
+ } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
const char *accel = Tcl_GetString(mePtr->accelPtr);
*widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
+ } else {
+ *widthPtr = 0;
}
}
@@ -1763,6 +1764,10 @@ DrawMenuEntryAccelerator(
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
const char *accel;
+ if (menuPtr->menuType == MENUBAR) {
+ return;
+ }
+
if (mePtr->accelPtr != NULL) {
accel = Tcl_GetString(mePtr->accelPtr);
} else {