summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-03-16 16:15:05 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-03-16 16:15:05 (GMT)
commit094a8766b4ff2390a2d24104e4fe7e1ab7efcd2b (patch)
tree516a71040e350e9ab1305ca25666b59959150c93 /win
parente553b23b383af4d3ffb9c956a9d9b2b0faf7d750 (diff)
downloadtk-094a8766b4ff2390a2d24104e4fe7e1ab7efcd2b.zip
tk-094a8766b4ff2390a2d24104e4fe7e1ab7efcd2b.tar.gz
tk-094a8766b4ff2390a2d24104e4fe7e1ab7efcd2b.tar.bz2
Fixed bug [1192095] (issue 2) - Toplevel menus return incorrect active index
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 4593928..4478dd6 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -1287,7 +1287,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];