diff options
author | fvogel <fvogelnew1@free.fr> | 2016-03-27 09:59:45 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-03-27 09:59:45 (GMT) |
commit | b8683c2dcc13728de8db64f269aaa5c68abe514f (patch) | |
tree | d25f3bd2517001bd3f0dda4b986aa3f5e4d5c41f | |
parent | 80c74be24faeeddbe71c2078229afbde8d89e3dc (diff) | |
download | tk-b8683c2dcc13728de8db64f269aaa5c68abe514f.zip tk-b8683c2dcc13728de8db64f269aaa5c68abe514f.tar.gz tk-b8683c2dcc13728de8db64f269aaa5c68abe514f.tar.bz2 |
Fixed bug [1192095] - Toplevel menus return incorrect active index (cherrypicked [6efe4d5396])
-rw-r--r-- | win/tkWinMenu.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 8eede75..8e14669 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1288,7 +1288,17 @@ TkWinHandleMenuEvent( if (menuPtr != NULL) { long entryIndex = LOWORD(*pwParam); - mePtr = NULL; + if ((menuPtr->menuType == MENUBAR) && menuPtr->tearoff) { + /* + * Windows passes the entry index starting at 0 for + * the first menu entry. However this entry #0 is the + * tearoff entry for Tk (the menu has -tearoff 1), + * which is ignored for MENUBAR menues on Windows. + */ + + entryIndex++; + } + mePtr = NULL; if (flags != 0xFFFF) { if ((flags&MF_POPUP) && (entryIndex<menuPtr->numEntries)) { mePtr = menuPtr->entries[entryIndex]; |