window->menus_begun = &menus_begun;
set_mouse_position (pt.x, pt.y);
- MouseDown (l);
+ BMenuBar::MouseDown (l);
window->menus_begun = NULL;
if (!menus_begun)
}
else if (msg->what == REPLAY_MENU_BAR)
{
+ window = (EmacsWindow *) Window ();
+ menus_begun = false;
+ window->menus_begun = &menus_begun;
+
if (msg->FindPoint ("emacs:point", &pt) == B_OK)
BMenuBar::MouseDown (pt);
+
+ window->menus_begun = NULL;
+
+ if (!menus_begun)
+ msg->SendReply (msg);
+ else
+ msg->SendReply (BE_MENU_BAR_OPEN);
}
else
BMenuBar::MessageReceived (msg);
return drag_and_drop_in_progress;
}
-void
+/* Replay the menu bar click event EVENT. Return whether or not the
+ menu bar actually opened. */
+bool
be_replay_menu_bar_event (void *menu_bar,
struct haiku_menu_bar_click_event *event)
{
BMenuBar *m = (BMenuBar *) menu_bar;
BMessenger messenger (m);
- BMessage msg (REPLAY_MENU_BAR);
+ BMessage reply, msg (REPLAY_MENU_BAR);
msg.AddPoint ("emacs:point", BPoint (event->x, event->y));
- messenger.SendMessage (&msg);
+ messenger.SendMessage (&msg, &reply);
+ return reply.what == BE_MENU_BAR_OPEN;
}
bool (*) (void));
extern bool be_drag_and_drop_in_progress (void);
-extern void be_replay_menu_bar_event (void *, struct haiku_menu_bar_click_event *);
+extern bool be_replay_menu_bar_event (void *, struct haiku_menu_bar_click_event *);
#ifdef __cplusplus
extern void *find_appropriate_view_for_draw (void *);
if (FRAME_OUTPUT_DATA (f)->saved_menu_event)
{
block_input ();
- be_replay_menu_bar_event (FRAME_HAIKU_MENU_BAR (f),
- FRAME_OUTPUT_DATA (f)->saved_menu_event);
+ rc = be_replay_menu_bar_event (FRAME_HAIKU_MENU_BAR (f),
+ FRAME_OUTPUT_DATA (f)->saved_menu_event);
xfree (FRAME_OUTPUT_DATA (f)->saved_menu_event);
FRAME_OUTPUT_DATA (f)->saved_menu_event = NULL;
unblock_input ();
+
+ if (!rc)
+ return;
+
+ FRAME_OUTPUT_DATA (f)->menu_bar_open_p = 1;
+ popup_activated_p += 1;
}
else
{