}
/* Cause frame titles to update--necessary if we now have just one
- frame. On NS the menu bar becomes empty after a tooltip frame is
- deleted for an unknown reason, so this serves to restore the
- contents of the menu bar as well. */
-#ifndef HAVE_NS
+ frame. */
if (!is_tooltip_frame)
-#endif
update_mode_lines = 15;
/* Now run the post-deletion hooks. */
/* Nonzero means a menu is currently active. */
static int popup_activated_flag;
+/* The last frame whose menubar was updated. (This is the frame whose
+ menu bar is currently being displayed.) */
+static struct frame *last_menubar_frame;
+
/* NOTE: toolbar implementation is at end,
following complete menu implementation. */
free_frame_menubar (struct frame *f)
{
id menu = [NSApp mainMenu];
+
+ if (f != last_menubar_frame)
+ return;
+
+ last_menubar_frame = NULL;
+
for (int i = [menu numberOfItems] - 1 ; i >= 0; i--)
{
NSMenuItem *item = (NSMenuItem *)[menu itemAtIndex:i];
#endif
return;
}
- XSETFRAME (Vmenu_updating_frame, f);
-/*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */
+ XSETFRAME (Vmenu_updating_frame, f);
+ last_menubar_frame = f;
block_input ();
/* Menu may have been created automatically; if so, discard it. */
#if NSMENUPROFILE
ftime (&tb);
- t = -(1000*tb.time+tb.millitm);
+ t = -(1000 * tb.time + tb.millitm);
#endif
if (deep_p)
#if NSMENUPROFILE
ftime (&tb);
- t += 1000*tb.time+tb.millitm;
+ t += 1000 * tb.time + tb.millitm;
fprintf (stderr, "Menu update took %ld msec.\n", t);
#endif