summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-04-10 20:36:33 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-04-10 20:36:33 (GMT)
commit6b77225dcafc4523a84678f1d420e64b3759a405 (patch)
tree55fabde5f6bd19fd874fa8b245694ea491cc9bc3 /win
parentaf2033da574bde2279b005cc9015d2fdbb7030eb (diff)
parentdeb6e2d6a1b578b89fa5633743dd760b473fa90e (diff)
downloadtk-6b77225dcafc4523a84678f1d420e64b3759a405.zip
tk-6b77225dcafc4523a84678f1d420e64b3759a405.tar.gz
tk-6b77225dcafc4523a84678f1d420e64b3759a405.tar.bz2
Fix for [dc4c5573a6]: tk_popup entry index not working on unix. Thanks to cjmcdonald.
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:
*