[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lwlib/xlwmenu.c
From: |
Pavel Janík |
Subject: |
[Emacs-diffs] Changes to emacs/lwlib/xlwmenu.c |
Date: |
Sat, 20 Apr 2002 09:39:57 -0400 |
Index: emacs/lwlib/xlwmenu.c
diff -c emacs/lwlib/xlwmenu.c:1.47 emacs/lwlib/xlwmenu.c:1.48
*** emacs/lwlib/xlwmenu.c:1.47 Fri Apr 19 14:56:51 2002
--- emacs/lwlib/xlwmenu.c Sat Apr 20 09:39:57 2002
***************
*** 129,134 ****
--- 129,135 ----
/* FIXME: Should ESC close one level of menu structure or the complete menu?
*/
+ /* FIXME: Should F10 enter to menu? Which one? File? */
#define offset(field) XtOffset(XlwMenuWidget, field)
static XtResource
***************
*** 2005,2010 ****
--- 2006,2028 ----
}
widget_value *
+ find_first_selectable (mw, item)
+ XlwMenuWidget mw;
+ widget_value *item;
+ {
+ widget_value *current = item;
+ enum menu_separator separator;
+
+ while (lw_separator_p (current->name, &separator, 0) || !current->enabled)
+ if (current->next)
+ current=current->next;
+ else
+ return NULL;
+
+ return current;
+ }
+
+ widget_value *
find_next_selectable (mw, item)
XlwMenuWidget mw;
widget_value *item;
***************
*** 2021,2028 ****
current = mw->menu.old_stack [mw->menu.old_depth - 2]->contents;
while (lw_separator_p (current->name, &separator, 0) ||
!current->enabled)
! if (current->next)
! current=current->next;
}
return current;
--- 2039,2052 ----
current = mw->menu.old_stack [mw->menu.old_depth - 2]->contents;
while (lw_separator_p (current->name, &separator, 0) ||
!current->enabled)
! {
! if (current->next)
! current=current->next;
!
! if (current == item)
! break;
! }
!
}
return current;
***************
*** 2037,2043 ****
--- 2061,2071 ----
widget_value *prev = item;
while ((current=find_next_selectable (mw, current)) != item)
+ {
+ if (prev == current)
+ break;
prev=current;
+ }
return prev;
}
***************
*** 2055,2062 ****
/* Inside top-level menu-bar? */
if (mw->menu.old_depth == 2)
/* When <down> in the menu-bar is pressed, display the corresponding
! sub-menu and select the first menu item there. */
! set_new_state (mw, selected_item->contents, mw->menu.old_depth);
else
/* Highlight next possible (enabled and not separator) menu item. */
set_new_state (mw, find_next_selectable (mw, selected_item),
mw->menu.old_depth - 1);
--- 2083,2090 ----
/* Inside top-level menu-bar? */
if (mw->menu.old_depth == 2)
/* When <down> in the menu-bar is pressed, display the corresponding
! sub-menu and select the first selectable menu item there. */
! set_new_state (mw, find_first_selectable (mw, selected_item->contents),
mw->menu.old_depth);
else
/* Highlight next possible (enabled and not separator) menu item. */
set_new_state (mw, find_next_selectable (mw, selected_item),
mw->menu.old_depth - 1);
***************
*** 2078,2086 ****
if (mw->menu.old_depth == 2)
{
/* FIXME: this is tricky. <up> in the menu-bar should select the
! last selectable item in the list. So we select the first one and
! find the previous selectable item. Is there a better way? */
! 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];
set_new_state (mw, find_prev_selectable (mw, selected_item),
mw->menu.old_depth - 1);
--- 2106,2115 ----
if (mw->menu.old_depth == 2)
{
/* FIXME: this is tricky. <up> in the menu-bar should select the
! last selectable item in the list. So we select the first
! selectable one and find the previous selectable item. Is there
! a better way? */
! set_new_state (mw, find_first_selectable (mw, selected_item->contents),
mw->menu.old_depth);
remap_menubar (mw);
selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
set_new_state (mw, find_prev_selectable (mw, selected_item),
mw->menu.old_depth - 1);
***************
*** 2134,2140 ****
first item (probably File). */
set_new_state (mw, find_next_selectable (mw, selected_item),
mw->menu.old_depth - 1);
else if (selected_item->contents) /* Is this menu item expandable? */
! set_new_state (mw, selected_item->contents, mw->menu.old_depth);
else
{
pop_new_stack_if_no_contents (mw);
--- 2163,2175 ----
first item (probably File). */
set_new_state (mw, find_next_selectable (mw, selected_item),
mw->menu.old_depth - 1);
else if (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);