comparison src/w32menu.c @ 73695:3901ff3eaf2c

(Fmenu_or_popup_active_p): New function. (syms_of_w32menu): Defsubr it. (popup_activated_flag, popup_activated): Remove.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 05 Nov 2006 12:17:26 +0000
parents 15d914de92fd
children 177184091f28
comparison
equal deleted inserted replaced
73694:124599cd087e 73695:3901ff3eaf2c
233 static int menu_items_n_panes; 233 static int menu_items_n_panes;
234 234
235 /* Current depth within submenus. */ 235 /* Current depth within submenus. */
236 static int menu_items_submenu_depth; 236 static int menu_items_submenu_depth;
237 237
238 /* Flag which when set indicates a dialog or menu has been posted by
239 Xt on behalf of one of the widget sets. */
240 static int popup_activated_flag;
241
242 static int next_menubar_widget_id; 238 static int next_menubar_widget_id;
243 239
244 /* This is set nonzero after the user activates the menu bar, and set 240 /* This is set nonzero after the user activates the menu bar, and set
245 to zero again after the menu bars are redisplayed by prepare_menu_bar. 241 to zero again after the menu bars are redisplayed by prepare_menu_bar.
246 While it is nonzero, all calls to set_frame_menubar go deep. 242 While it is nonzero, all calls to set_frame_menubar go deep.
990 /* Lock out further menubar changes while active. */ 986 /* Lock out further menubar changes while active. */
991 f->output_data.w32->menubar_active = 1; 987 f->output_data.w32->menubar_active = 1;
992 988
993 /* Signal input thread to return from WM_INITMENU. */ 989 /* Signal input thread to return from WM_INITMENU. */
994 complete_deferred_msg (FRAME_W32_WINDOW (f), WM_INITMENU, 0); 990 complete_deferred_msg (FRAME_W32_WINDOW (f), WM_INITMENU, 0);
991 }
992
993 /* The following is used by delayed window autoselection. */
994
995 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
996 doc: /* Return t if a menu or popup dialog is active on selected frame. */)
997 ()
998 {
999 FRAME_PTR f;
1000 f = SELECTED_FRAME ();
1001 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil;
995 } 1002 }
996 1003
997 /* This callback is called from the menu bar pulldown menu 1004 /* This callback is called from the menu bar pulldown menu
998 when the user makes a selection. 1005 when the user makes a selection.
999 Figure out what the user chose 1006 Figure out what the user chose
2146 /* No selection has been chosen yet. */ 2153 /* No selection has been chosen yet. */
2147 menu_item_selection = 0; 2154 menu_item_selection = 0;
2148 2155
2149 /* Display the menu. */ 2156 /* Display the menu. */
2150 lw_pop_up_all_widgets (dialog_id); 2157 lw_pop_up_all_widgets (dialog_id);
2151 popup_activated_flag = 1;
2152 2158
2153 /* Process events that apply to the menu. */ 2159 /* Process events that apply to the menu. */
2154 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id); 2160 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);
2155 2161
2156 lw_destroy_all_widgets (dialog_id); 2162 lw_destroy_all_widgets (dialog_id);
2426 } 2432 }
2427 } 2433 }
2428 return 1; 2434 return 1;
2429 } 2435 }
2430 2436
2431 int
2432 popup_activated ()
2433 {
2434 /* popup_activated_flag not actually used on W32 */
2435 return 0;
2436 }
2437
2438 /* Display help string for currently pointed to menu item. Not 2437 /* Display help string for currently pointed to menu item. Not
2439 supported on NT 3.51 and earlier, as GetMenuItemInfo is not 2438 supported on NT 3.51 and earlier, as GetMenuItemInfo is not
2440 available. */ 2439 available. */
2441 void 2440 void
2442 w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) 2441 w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
2547 2546
2548 Qdebug_on_next_call = intern ("debug-on-next-call"); 2547 Qdebug_on_next_call = intern ("debug-on-next-call");
2549 staticpro (&Qdebug_on_next_call); 2548 staticpro (&Qdebug_on_next_call);
2550 2549
2551 defsubr (&Sx_popup_menu); 2550 defsubr (&Sx_popup_menu);
2551 defsubr (&Smenu_or_popup_active_p);
2552 #ifdef HAVE_MENUS 2552 #ifdef HAVE_MENUS
2553 defsubr (&Sx_popup_dialog); 2553 defsubr (&Sx_popup_dialog);
2554 #endif 2554 #endif
2555 } 2555 }
2556 2556