summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt2
-rw-r--r--src/Fl_Menu.cxx6
2 files changed, 5 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 3189d3056..1c016abf2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -248,6 +248,8 @@ Changes in FLTK 1.4.0 Released: Feb ?? 2024
keyboard focus (STR #2989).
- Renamed test/help.cxx demo program to test/help_dialog.cxx to avoid
name conflict with CMake's auto-generated target 'help'.
+ - Fl_Menu_Bar: left and right arrow keys now wrap to the menu at the
+ other end of the menubar when pressed in the first (resp. last) menu.
- Many documentation fixes, clarifications, and enhancements.
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index 41f36490e..b9b02bc4a 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -706,7 +706,7 @@ static int forward(int menu) { // go to next item in menu menu if possible
}
item = -1;
}
- while (pp.menubar && pp.menu_number <= 0 && (!m.menu || m.menu->submenu()));
+ while (pp.menubar && Fl::event_key() == FL_Right);
return 0;
}
@@ -724,7 +724,7 @@ static int backward(int menu) { // previous item in menu menu if possible
}
item = m.numitems;
}
- while (pp.menubar && (!m.menu || m.menu->submenu()));
+ while (pp.menubar && Fl::event_key() == FL_Left);
return 0;
}
@@ -819,7 +819,7 @@ int menuwindow::handle_part1(int e) {
}
return 1;
case FL_Right:
- if (pp.menubar && (pp.menu_number<=0 || (pp.menu_number==1 && pp.nummenus==2)))
+ if (pp.menubar && (pp.menu_number<=0 || (pp.menu_number == pp.nummenus-1)))
forward(0);
else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
return 1;