aboutsummaryrefslogtreecommitdiffstats
path: root/src/macmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/macmenu.c')
-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;
259/* Current depth within submenus. */ 259/* Current depth within submenus. */
260static int menu_items_submenu_depth; 260static int menu_items_submenu_depth;
261 261
262/* Nonzero means a menu is currently active. */
263static int popup_activated_flag;
264
262/* This is set nonzero after the user activates the menu bar, and set 265/* This is set nonzero after the user activates the menu bar, and set
263 to zero again after the menu bars are redisplayed by prepare_menu_bar. 266 to zero again after the menu bars are redisplayed by prepare_menu_bar.
264 While it is nonzero, all calls to set_frame_menubar go deep. 267 While it is nonzero, all calls to set_frame_menubar go deep.
@@ -1141,7 +1144,9 @@ x_activate_menubar (f)
1141 set_frame_menubar (f, 0, 1); 1144 set_frame_menubar (f, 0, 1);
1142 BLOCK_INPUT; 1145 BLOCK_INPUT;
1143 1146
1147 popup_activated_flag = 1;
1144 menu_choice = MenuSelect (saved_menu_event_location); 1148 menu_choice = MenuSelect (saved_menu_event_location);
1149 popup_activated_flag = 0;
1145 menu_id = HiWord (menu_choice); 1150 menu_id = HiWord (menu_choice);
1146 menu_item = LoWord (menu_choice); 1151 menu_item = LoWord (menu_choice);
1147 1152
@@ -2237,7 +2242,9 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
2237 install_menu_quit_handler (MAC_MENU_POPUP_SUB, menu); 2242 install_menu_quit_handler (MAC_MENU_POPUP_SUB, menu);
2238 2243
2239 /* Display the menu. */ 2244 /* Display the menu. */
2245 popup_activated_flag = 1;
2240 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); 2246 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0);
2247 popup_activated_flag = 0;
2241 2248
2242 /* Get the refcon to find the correct item */ 2249 /* Get the refcon to find the correct item */
2243 if (menu_item_choice) 2250 if (menu_item_choice)
@@ -3218,6 +3225,14 @@ dispose_menus (kind, id)
3218 3225
3219#endif /* HAVE_MENUS */ 3226#endif /* HAVE_MENUS */
3220 3227
3228/* Detect if a menu is currently active. */
3229
3230int
3231popup_activated ()
3232{
3233 return popup_activated_flag;
3234}
3235
3221/* The following is used by delayed window autoselection. */ 3236/* The following is used by delayed window autoselection. */
3222 3237
3223DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, 3238DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,