changeset 76534:388ed021f559

(popup_activated_flag): New variable. (x_activate_menubar, mac_menu_show): Set it during menu tracking. (popup_activated): New function.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sun, 18 Mar 2007 08:06:18 +0000
parents 338aa54d148f
children 12069a316614
files src/macmenu.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macmenu.c	Sun Mar 18 04:54:51 2007 +0000
+++ b/src/macmenu.c	Sun Mar 18 08:06:18 2007 +0000
@@ -259,6 +259,9 @@
 /* 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 @@
   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 @@
   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 @@
 
 #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,