changeset 36933:01f8906fa0fd

Include widget.h. (single_submenu): Return int. Some cleanup. (set_frame_menubar): Call x_set_menu_resources_from_menu_face.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 22 Mar 2001 13:33:32 +0000
parents 798523f71b16
children 29a76ec27dc1
files src/xmenu.c
diffstat 1 files changed, 34 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmenu.c	Thu Mar 22 13:33:13 2001 +0000
+++ b/src/xmenu.c	Thu Mar 22 13:33:32 2001 +0000
@@ -44,6 +44,7 @@
 #include "window.h"
 #include "blockinput.h"
 #include "buffer.h"
+#include "widget.h"
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -123,12 +124,16 @@
 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
 				Lisp_Object, Lisp_Object, Lisp_Object,
 				Lisp_Object, Lisp_Object));
-static Lisp_Object xmenu_show ();
-static void keymap_panes ();
-static void single_keymap_panes ();
-static void single_menu_item ();
-static void list_of_panes ();
-static void list_of_items ();
+static int update_frame_menubar P_ ((struct frame *));
+static Lisp_Object xmenu_show P_ ((struct frame *, int, int, int, int,
+				   Lisp_Object, char **));
+static void keymap_panes P_ ((Lisp_Object *, int, int));
+static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
+				     int, int));
+static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object *,
+				  int, int, int *));
+static void list_of_panes P_ ((Lisp_Object));
+static void list_of_items P_ ((Lisp_Object));
 
 /* This holds a Lisp vector that holds the results of decoding
    the keymaps or alist-of-alists that specify a menu.
@@ -1539,55 +1544,42 @@
 
   return first_wv;
 }
+
+
 
-extern void EmacsFrameSetCharSize ();
-
-/* Recompute all the widgets of frame F, when the menu bar
-   has been changed.  */
-
-static void
+/* Recompute all the widgets of frame F, when the menu bar has been
+   changed.  Value is non-zero if widgets were updated.  */
+
+static int
 update_frame_menubar (f)
      FRAME_PTR f;
 {
   struct x_output *x = f->output_data.x;
   int columns, rows;
-  int menubar_changed;
   
-  /* We assume the menubar contents has changed if the global flag is set,
-     or if the current buffer has changed, or if the menubar has never
-     been updated before.
-   */
-  menubar_changed = (x->menubar_widget
-		     && !XtIsManaged (x->menubar_widget));
-
-  if (! (menubar_changed))
-    return;
+  if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
+    return 0;
 
   BLOCK_INPUT;
-  /* Save the size of the frame because the pane widget doesn't accept to
-     resize itself. So force it.  */
+  /* Save the size of the frame because the pane widget doesn't accept
+     to resize itself. So force it.  */
   columns = f->width;
   rows = f->height;
 
-  /* Do the voodoo which means "I'm changing lots of things, don't try to
-     refigure sizes until I'm done." */
+  /* Do the voodoo which means "I'm changing lots of things, don't try
+     to refigure sizes until I'm done."  */
   lw_refigure_widget (x->column_widget, False);
 
-  /* the order in which children are managed is the top to
-     bottom order in which they are displayed in the paned window.
-     First, remove the text-area widget.
-   */
+  /* The order in which children are managed is the top to bottom
+     order in which they are displayed in the paned window.  First,
+     remove the text-area widget.  */
   XtUnmanageChild (x->edit_widget);
 
-  /* remove the menubar that is there now, and put up the menubar that
-     should be there.
-   */
-  if (menubar_changed)
-    {
-      XtManageChild (x->menubar_widget);
-      XtMapWidget (x->menubar_widget);
-      XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, NULL);
-    }
+  /* Remove the menubar that is there now, and put up the menubar that
+     should be there.  */
+  XtManageChild (x->menubar_widget);
+  XtMapWidget (x->menubar_widget);
+  XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, NULL);
 
   /* Re-manage the text-area widget, and then thrash the sizes.  */
   XtManageChild (x->edit_widget);
@@ -1597,6 +1589,7 @@
   /* Force the pane widget to resize itself with the right values.  */
   EmacsFrameSetCharSize (x->edit_widget, columns, rows);
   UNBLOCK_INPUT;
+  return 1;
 }
 
 /* Set the contents of the menubar widgets of frame F.
@@ -1842,7 +1835,8 @@
   }
   
   free_menubar_widget_value_tree (first_wv);
-  update_frame_menubar (f);
+  if (!update_frame_menubar (f))
+    x_set_menu_resources_from_menu_face (f, menubar_widget);
 
   UNBLOCK_INPUT;
 }