summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogelnew1@free.fr <fvogel>2016-03-20 09:55:13 (GMT)
committerfvogelnew1@free.fr <fvogel>2016-03-20 09:55:13 (GMT)
commit1aed6e3be1d9c61fad43c2282317c3c4c916e7d1 (patch)
treeca35222b80f627359a26dafd4fd8c108e17ac5c4 /win
parenta465f0eabbda214d1031adfb69b2fe15e2239b3c (diff)
parentbc0d3b2a3e40e8c013ef4c38d1ac2b09e097d8e1 (diff)
downloadtk-1aed6e3be1d9c61fad43c2282317c3c4c916e7d1.zip
tk-1aed6e3be1d9c61fad43c2282317c3c4c916e7d1.tar.gz
tk-1aed6e3be1d9c61fad43c2282317c3c4c916e7d1.tar.bz2
Fixed bug [487861ffff] - cascade with -accelerator looks wrong
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 {