comparison src/macmenu.c @ 90789:c0409ee15cee

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 670-674) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 209-210) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-185
author Miles Bader <miles@gnu.org>
date Wed, 21 Mar 2007 13:33:07 +0000
parents dd7c098af727 388ed021f559
children 70bf32a0f523
comparison
equal deleted inserted replaced
90788:a12805fdabe8 90789:c0409ee15cee
257 static int menu_items_n_panes; 257 static int menu_items_n_panes;
258 258
259 /* Current depth within submenus. */ 259 /* Current depth within submenus. */
260 static int menu_items_submenu_depth; 260 static int menu_items_submenu_depth;
261 261
262 /* Nonzero means a menu is currently active. */
263 static 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.
265 268
266 I don't understand why this is needed, but it does seem to be 269 I don't understand why this is needed, but it does seem to be
1139 extern Point saved_menu_event_location; 1142 extern Point saved_menu_event_location;
1140 1143
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
1148 #if !TARGET_API_MAC_CARBON 1153 #if !TARGET_API_MAC_CARBON
1149 if (menu_id == min_menu_id[MAC_MENU_M_APPLE]) 1154 if (menu_id == min_menu_id[MAC_MENU_M_APPLE])
2235 /* Add event handler so we can detect C-g. */ 2240 /* Add event handler so we can detect C-g. */
2236 install_menu_quit_handler (MAC_MENU_POPUP, menu); 2241 install_menu_quit_handler (MAC_MENU_POPUP, menu);
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)
2244 { 2251 {
2245 MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice)); 2252 MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice));
3216 } 3223 }
3217 } 3224 }
3218 3225
3219 #endif /* HAVE_MENUS */ 3226 #endif /* HAVE_MENUS */
3220 3227
3228 /* Detect if a menu is currently active. */
3229
3230 int
3231 popup_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
3223 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, 3238 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
3224 doc: /* Return t if a menu or popup dialog is active. */) 3239 doc: /* Return t if a menu or popup dialog is active. */)
3225 () 3240 ()