# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1174205178 0 # Node ID 388ed021f5594572a197a7e56f3b55c6cae23486 # Parent 338aa54d148fc0fad038e5ee02864f41140bb3bf (popup_activated_flag): New variable. (x_activate_menubar, mac_menu_show): Set it during menu tracking. (popup_activated): New function. diff -r 338aa54d148f -r 388ed021f559 src/macmenu.c --- 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,