GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
/* 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.
DialogItemIndex item_hit;
Lisp_Object tem;
+ /* Force a redisplay before showing the dialog. If a frame is
+ created just before showing the dialog, its contents may not
+ have been fully drawn. */
+ Fredisplay (Qt);
+
tem = Fstring_match (concat3 (build_string ("\\("),
call0 (intern ("sentence-end")),
build_string ("\\)\n")),
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);
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)
first_wv = wv;
}
+ /* Force a redisplay before showing the dialog. If a frame is created
+ just before showing the dialog, its contents may not have been fully
+ drawn. */
+ Fredisplay (Qt);
+
/* Actually create the dialog. */
#if TARGET_API_MAC_CARBON
menu_item_selection = create_and_show_dialog (f, first_wv);
#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,