comparison src/xmenu.c @ 90650:02cf29720f31

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 490-504) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 161-163) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-130
author Miles Bader <miles@gnu.org>
date Tue, 07 Nov 2006 23:22:48 +0000
parents 8dd8c8286063 177184091f28
children dbe3f29e61d6
comparison
equal deleted inserted replaced
90649:d53934e7ddef 90650:02cf29720f31
1393 If FRAME is nil or not given, use the selected frame. */) 1393 If FRAME is nil or not given, use the selected frame. */)
1394 (frame) 1394 (frame)
1395 Lisp_Object frame; 1395 Lisp_Object frame;
1396 { 1396 {
1397 GtkWidget *menubar; 1397 GtkWidget *menubar;
1398 FRAME_PTR f;
1399
1400 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
1401 BLOCK_INPUT. */
1402
1398 BLOCK_INPUT; 1403 BLOCK_INPUT;
1399 FRAME_PTR f = check_x_frame (frame); 1404 f = check_x_frame (frame);
1400 1405
1401 if (FRAME_EXTERNAL_MENU_BAR (f)) 1406 if (FRAME_EXTERNAL_MENU_BAR (f))
1402 set_frame_menubar (f, 0, 1); 1407 set_frame_menubar (f, 0, 1);
1403 1408
1404 menubar = FRAME_X_OUTPUT (f)->menubar_widget; 1409 menubar = FRAME_X_OUTPUT (f)->menubar_widget;
1407 /* Activate the first menu. */ 1412 /* Activate the first menu. */
1408 GList *children = gtk_container_get_children (GTK_CONTAINER (menubar)); 1413 GList *children = gtk_container_get_children (GTK_CONTAINER (menubar));
1409 1414
1410 gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), 1415 gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar),
1411 GTK_WIDGET (children->data)); 1416 GTK_WIDGET (children->data));
1412 1417
1413 popup_activated_flag = 1; 1418 popup_activated_flag = 1;
1414 g_list_free (children); 1419 g_list_free (children);
1415 } 1420 }
1416 UNBLOCK_INPUT; 1421 UNBLOCK_INPUT;
1417 1422
3754 } 3759 }
3755 3760
3756 #endif /* not USE_X_TOOLKIT */ 3761 #endif /* not USE_X_TOOLKIT */
3757 3762
3758 #endif /* HAVE_MENUS */ 3763 #endif /* HAVE_MENUS */
3764
3765
3766 /* The following is used by delayed window autoselection. */
3767
3768 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
3769 doc: /* Return t if a menu or popup dialog is active. */)
3770 ()
3771 {
3772 #ifdef HAVE_MENUS
3773 return (popup_activated ()) ? Qt : Qnil;
3774 #else
3775 return Qnil;
3776 #endif /* HAVE_MENUS */
3777 }
3759 3778
3760 void 3779 void
3761 syms_of_xmenu () 3780 syms_of_xmenu ()
3762 { 3781 {
3763 staticpro (&menu_items); 3782 staticpro (&menu_items);
3771 widget_id_tick = (1<<16); 3790 widget_id_tick = (1<<16);
3772 next_menubar_widget_id = 1; 3791 next_menubar_widget_id = 1;
3773 #endif 3792 #endif
3774 3793
3775 defsubr (&Sx_popup_menu); 3794 defsubr (&Sx_popup_menu);
3795 defsubr (&Smenu_or_popup_active_p);
3776 3796
3777 #if defined (USE_GTK) || defined (USE_X_TOOLKIT) 3797 #if defined (USE_GTK) || defined (USE_X_TOOLKIT)
3778 defsubr (&Smenu_bar_open); 3798 defsubr (&Smenu_bar_open);
3779 Ffset (intern ("accelerate-menu"), intern (Smenu_bar_open.symbol_name)); 3799 Ffset (intern ("accelerate-menu"), intern (Smenu_bar_open.symbol_name));
3780 #endif 3800 #endif