summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixMenu.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-01 14:37:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-01 14:37:52 (GMT)
commit90d2b95f60fee26a461e44dadeaf46bbaa0e8d54 (patch)
tree49f2146324cc95f8b5fcb1f2c71e5b4e2028a4a8 /unix/tkUnixMenu.c
parentfebcba8fc330403fb595f58acc3570f3d29fe1ed (diff)
downloadtk-90d2b95f60fee26a461e44dadeaf46bbaa0e8d54.zip
tk-90d2b95f60fee26a461e44dadeaf46bbaa0e8d54.tar.gz
tk-90d2b95f60fee26a461e44dadeaf46bbaa0e8d54.tar.bz2
Proposed fix for [dc4c5573a6]: tk_popup entry index not working on unix
Diffstat (limited to 'unix/tkUnixMenu.c')
-rw-r--r--unix/tkUnixMenu.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 4ef5af2..6a8611d 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -938,13 +938,6 @@ TkpPostTearoffMenu(
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- if (index >= menuPtr->numEntries) {
- index = menuPtr->numEntries - 1;
- }
- if (index >= 0) {
- y -= menuPtr->entries[index]->y;
- }
-
TkActivateMenuEntry(menuPtr, -1);
TkRecomputeMenu(menuPtr);
result = TkPostCommand(menuPtr);
@@ -962,6 +955,18 @@ TkpPostTearoffMenu(
}
/*
+ * Adjust the menu y position so that the specified entry will be located
+ * at the given coordinates.
+ */
+
+ if (index >= 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:
*