summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-06-27 07:45:45 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-06-27 07:45:45 +0200
commitb692cc55dabb63dae4bec2bd92590764c71e4a70 (patch)
tree3552e3136918f24a99dc0dccfbccb907f8dc1ea8 /src
parent64cd50c1306258460becf81ff06058e09a357929 (diff)
Navigation in menubar: wrap around when using arrow past end or start of menubar.
Slight behavior change of Fl_Menu_Bar relatively to 1.3: left and right arrow keys when pressed in the first (resp. last) (sub)menu of a menubar wrap to the menu at the other end of the bar. Also, left and right arrow keys open the previous (resp. next) menu of the bar when pressed in a submenu. Rationale: macOS, gnome and Windows apps equipped with a menubar do that.
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Menu.cxx6
1 files changed, 3 insertions, 3 deletions
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;