changeset 48929:d81c005163cb

(pop_new_stack_if_no_contents): Do nothing if new_depth is 1. (remap_menubar): Don't look in new_stack[0]. (Left): At level 1, do the same thing Right does.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 Dec 2002 22:00:44 +0000
parents a9565e3d6e34
children 2cbcb30abe6f
files lwlib/xlwmenu.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/xlwmenu.c	Sun Dec 22 21:59:20 2002 +0000
+++ b/lwlib/xlwmenu.c	Sun Dec 22 22:00:44 2002 +0000
@@ -316,7 +316,7 @@
 pop_new_stack_if_no_contents (mw)
      XlwMenuWidget mw;
 {
-  if (mw->menu.new_depth)
+  if (mw->menu.new_depth > 1)
     {
       if (!mw->menu.new_stack [mw->menu.new_depth - 1]->contents)
 	mw->menu.new_depth -= 1;
@@ -1397,7 +1397,7 @@
 
   /* unmap the menus that popped down */
   for (i = new_depth - 1; i < old_depth; i++)
-    if (i >= new_depth || !new_stack[i]->contents)
+    if (i >= new_depth || (i > 0 && !new_stack[i]->contents))
       XUnmapWindow (XtDisplay (mw), windows[i].window);
 }
 
@@ -2184,6 +2184,16 @@
        the menu-bar. If the current item is the first one, highlight the
        last item in the menubar (probably Help).  */
     set_new_state (mw, find_prev_selectable (mw, selected_item), mw->menu.old_depth - 1);
+  else if (mw->menu.old_depth == 1
+	   && selected_item->contents)     /* Is this menu item expandable?  */
+    {
+      set_new_state (mw, selected_item->contents, mw->menu.old_depth);
+      remap_menubar (mw);
+      selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
+      if (!selected_item->enabled && find_first_selectable (mw, selected_item))
+	set_new_state (mw, find_first_selectable (mw, selected_item), mw->menu.old_depth - 1);
+    }
+
   else
     {
       pop_new_stack_if_no_contents (mw);