summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2007-03-18 08:06:18 +0000
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2007-03-18 08:06:18 +0000
commita83c3e315ff818d5fb2924f4791f30cdf0f3075f (patch)
treeaa6b38a051a3f7191a1b1cc75deeb921b6ff82df
parent1a172c64960c9494bf1b8ea5696d78c2fbb0ef87 (diff)
downloademacs-a83c3e315ff818d5fb2924f4791f30cdf0f3075f.tar.gz
emacs-a83c3e315ff818d5fb2924f4791f30cdf0f3075f.tar.bz2
emacs-a83c3e315ff818d5fb2924f4791f30cdf0f3075f.zip
(popup_activated_flag): New variable.
(x_activate_menubar, mac_menu_show): Set it during menu tracking. (popup_activated): New function.
-rw-r--r--src/macmenu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/macmenu.c b/src/macmenu.c
index 82322515c31..c7a84df7106 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -259,6 +259,9 @@ static int menu_items_n_panes;
/* Current depth within submenus. */
static int menu_items_submenu_depth;
+/* Nonzero means a menu is currently active. */
+static int popup_activated_flag;
+
/* This is set nonzero after the user activates the menu bar, and set
to zero again after the menu bars are redisplayed by prepare_menu_bar.
While it is nonzero, all calls to set_frame_menubar go deep.
@@ -1141,7 +1144,9 @@ x_activate_menubar (f)
set_frame_menubar (f, 0, 1);
BLOCK_INPUT;
+ popup_activated_flag = 1;
menu_choice = MenuSelect (saved_menu_event_location);
+ popup_activated_flag = 0;
menu_id = HiWord (menu_choice);
menu_item = LoWord (menu_choice);
@@ -2237,7 +2242,9 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
install_menu_quit_handler (MAC_MENU_POPUP_SUB, menu);
/* Display the menu. */
+ popup_activated_flag = 1;
menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0);
+ popup_activated_flag = 0;
/* Get the refcon to find the correct item */
if (menu_item_choice)
@@ -3218,6 +3225,14 @@ dispose_menus (kind, id)
#endif /* HAVE_MENUS */
+/* Detect if a menu is currently active. */
+
+int
+popup_activated ()
+{
+ return popup_activated_flag;
+}
+
/* The following is used by delayed window autoselection. */
DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,