struct frame *f = decode_window_system_frame (frame);
if (FRAME_EXTERNAL_MENU_BAR (f))
- set_frame_menubar (f, 1);
+ {
+ block_input ();
+ BView_draw_lock (FRAME_HAIKU_VIEW (f));
+ set_frame_menubar (f, 1);
+ BMenuBar_start_tracking (FRAME_HAIKU_MENU_BAR (f));
+ BView_draw_unlock (FRAME_HAIKU_VIEW (f));
+ unblock_input ();
+ }
else
{
return call2 (Qpopup_menu, call0 (Qmouse_menu_bar_map),
last_nonmenu_event);
}
- block_input ();
- BMenuBar_start_tracking (FRAME_HAIKU_MENU_BAR (f));
- unblock_input ();
-
return Qnil;
}
if (type == MENU_BAR_OPEN)
{
- BView_draw_lock (FRAME_HAIKU_VIEW (f));
- /* This shouldn't be here, but nsmenu does it, so
- it should probably be safe. */
- int was_waiting_for_input_p = waiting_for_input;
- if (waiting_for_input)
- waiting_for_input = 0;
- set_frame_menubar (f, 1);
- waiting_for_input = was_waiting_for_input_p;
- BView_draw_unlock (FRAME_HAIKU_VIEW (f));
+ /* b->no_lock means that MenusBeginning was called
+ from the main thread, which means tracking was
+ started manually, and we have already updated the
+ menu bar. */
+ if (!b->no_lock)
+ {
+ BView_draw_lock (FRAME_HAIKU_VIEW (f));
+ /* This shouldn't be here, but nsmenu does it, so
+ it should probably be safe. */
+ int was_waiting_for_input_p = waiting_for_input;
+ if (waiting_for_input)
+ waiting_for_input = 0;
+ set_frame_menubar (f, 1);
+ waiting_for_input = was_waiting_for_input_p;
+ BView_draw_unlock (FRAME_HAIKU_VIEW (f));
+ }
+
+ /* But set the flag anyway, because the menu will end
+ from the window thread. */
FRAME_OUTPUT_DATA (f)->menu_bar_open_p = 1;
popup_activated_p += 1;