summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-11 20:54:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-11 20:54:52 (GMT)
commit28e782136de3e9e8f068fc6ab263bf91a2a47339 (patch)
tree0226a69b61295ec036f854e1705fbd98dfd766eb /win
parent78d7109e33c9570799c85d140122d368ce9cf959 (diff)
parent11769f5c46a422bee9ac737b4a70d390e6bab012 (diff)
downloadtk-28e782136de3e9e8f068fc6ab263bf91a2a47339.zip
tk-28e782136de3e9e8f068fc6ab263bf91a2a47339.tar.gz
tk-28e782136de3e9e8f068fc6ab263bf91a2a47339.tar.bz2
Merge 8.7
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 886c14e..5c31ca0 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -882,13 +882,6 @@ TkpPostTearoffMenu(
int result;
(void)dummy;
- if (index >= (int)menuPtr->numEntries) {
- index = menuPtr->numEntries - 1;
- }
- if (index >= 0) {
- y -= menuPtr->entries[index]->y;
- }
-
TkActivateMenuEntry(menuPtr, -1);
TkRecomputeMenu(menuPtr);
result = TkPostCommand(menuPtr);
@@ -905,7 +898,19 @@ TkpPostTearoffMenu(
return TCL_OK;
}
- /*
+ /*
+ * Adjust the menu y position so that the specified entry will be located
+ * at the given coordinates.
+ */
+
+ if (index >= (int)menuPtr->numEntries) {
+ index = menuPtr->numEntries - 1;
+ }
+ if (index >= 0) {
+ y -= menuPtr->entries[index]->y;
+ }
+
+ /*
* Adjust the position of the menu if necessary to keep it visible on the
* screen. There are two special tricks to make this work right:
*