|
41 | 41 | // SN-2014-11-10: [[ Bug 13836 ]] Keeps the track about the open items in the menu bar. |
42 | 42 | static uint32_t s_open_menubar_items = 0; |
43 | 43 |
|
| 44 | +// SN-2015-11-02: [[ Bug 16218 ]] We can't trust popUpMenuPositioningItem on |
| 45 | +// returning whether an item has been selected. |
| 46 | +static bool s_menu_item_selected = false; |
| 47 | + |
44 | 48 |
|
45 | 49 | //////////////////////////////////////////////////////////////////////////////// |
46 | 50 |
|
@@ -204,7 +208,10 @@ - (void)menuItemSelected: (id)sender |
204 | 208 | t_quit_accelerator_present = [(com_runrev_livecode_MCMenuDelegate *)[[t_item menu] delegate] platformMenuRef] -> quit_item != nil; |
205 | 209 |
|
206 | 210 | if (s_menu_select_lock == 0 || t_quit_accelerator_present) |
| 211 | + { |
207 | 212 | MCPlatformCallbackSendMenuSelect(m_menu, [[t_item menu] indexOfItem: t_item]); |
| 213 | + s_menu_item_selected = true; |
| 214 | + } |
208 | 215 |
|
209 | 216 | // SN-2014-11-06: [[ Bug 13836 ]] s_menu_select_occured was not used. |
210 | 217 | } |
@@ -858,12 +865,17 @@ bool MCPlatformPopUpMenu(MCPlatformMenuRef p_menu, MCPlatformWindowRef p_window, |
858 | 865 |
|
859 | 866 | // MW-2014-07-29: [[ Bug 12990 ]] If item is UINDEX_MAX then don't specify an item, thus preventing |
860 | 867 | // one from being highlighted. |
861 | | - bool t_result; |
862 | | - t_result = [t_menu popUpMenuPositioningItem: p_item == UINDEX_MAX ? nil : [t_menu itemAtIndex: p_item] atLocation: t_location inView: t_view]; |
| 868 | + |
| 869 | + // SN-2015-11-02: [[ Bug 16218 ]] popUpMenuPositioningItem always returns |
| 870 | + // true if the menu is open by keeping the mouse down, even if the mouse is |
| 871 | + // released outside of the menu list. |
| 872 | + // We will set s_menu_item_selected in menuItemSelected if selection occurs. |
| 873 | + s_menu_item_selected = false; |
| 874 | + [t_menu popUpMenuPositioningItem: p_item == UINDEX_MAX ? nil : [t_menu itemAtIndex: p_item] atLocation: t_location inView: t_view]; |
863 | 875 |
|
864 | 876 | MCMacPlatformSyncMouseAfterTracking(); |
865 | 877 |
|
866 | | - return t_result; |
| 878 | + return s_menu_item_selected; |
867 | 879 | } |
868 | 880 |
|
869 | 881 | ////////// |
|
0 commit comments