@@ -886,28 +886,36 @@ void MCPlatformHandleMenuUpdate(MCPlatformMenuRef p_menu)
886886 uindex_t t_parent_menu_index;
887887 MCPlatformGetMenuParent (p_menu, t_parent_menu, t_parent_menu_index);
888888
889- // If the parent menu is not the menubar, we aren't interested.
890- if (t_parent_menu != s_menubar)
891- return ;
889+ // SN-2014-11-10: [[ Bug 13836 ]] We can also be the menubar's LiveCode item - in which case an
890+ // update is allowed as well
891+ bool t_update_menubar;
892+ t_update_menubar = p_menu == s_menubar;
893+
894+ // If the parent menu is not the menubar, we aren't interested.
895+ if (t_parent_menu != s_menubar && !t_update_menubar)
896+ return ;
892897
893898 // If the button it is 'attached' to still exists, dispatch the menu update
894899 // message (currently mouseDown("")). We do this whilst the menubar is locked
895900 // from updates as we mustn't fiddle about with it too much in this case!
896- if (s_menubar_targets[t_parent_menu_index] -> Exists ())
901+ if (t_update_menubar || s_menubar_targets[t_parent_menu_index] -> Exists ())
897902 {
898903 // MW-2014-06-10: [[ Bug 12590 ]] Make sure we lock screen around the menu update message.
899904 MCRedrawLockScreen ();
900- s_menubar_lock_count += 1 ;
901- // SN-2014-11-06: [[ Bug 13940 ]] Keep the behaviour as previously: mouseDown "" is sent when updating menus
902- s_menubar_targets[t_parent_menu_index] -> Get () -> message_with_valueref_args (MCM_mouse_down, MCSTR (" " ));
903-
905+ s_menubar_lock_count += 1 ;
906+ // SN-2014-11-06: [[ Bug 13836 ]] MCmenubar (or MCdefaultmenubar) should get mouseDown, not the target (it gets menuPick)
907+ if (MCmenubar != nil)
908+ MCmenubar -> message_with_valueref_args (MCM_mouse_down, MCSTR (" 1" ));
909+ else if (MCdefaultmenubar != nil)
910+ MCdefaultmenubar -> message_with_valueref_args (MCM_mouse_down, MCSTR (" 1" ));
904911 s_menubar_lock_count -= 1 ;
905912 MCRedrawUnlockScreen ();
906913 }
907914
915+ // SN-2014-11-10: [[ Bug 13836 ]] Make sure that
908916 // Now we've got the menu to update, process the new menu spec, but only if the
909917 // menu button still exists!
910- if (s_menubar_targets[t_parent_menu_index] -> Exists ())
918+ if (!t_update_menubar && s_menubar_targets[t_parent_menu_index] -> Exists ())
911919 {
912920 MCButton *t_button;
913921 t_button = (MCButton *)s_menubar_targets[t_parent_menu_index] -> Get ();
0 commit comments