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.
This commit is contained in:
parent
64cd50c130
commit
b692cc55da
@ -248,6 +248,8 @@ Changes in FLTK 1.4.0 Released: Feb ?? 2024
|
|||||||
keyboard focus (STR #2989).
|
keyboard focus (STR #2989).
|
||||||
- Renamed test/help.cxx demo program to test/help_dialog.cxx to avoid
|
- Renamed test/help.cxx demo program to test/help_dialog.cxx to avoid
|
||||||
name conflict with CMake's auto-generated target 'help'.
|
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.
|
- Many documentation fixes, clarifications, and enhancements.
|
||||||
|
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@ static int forward(int menu) { // go to next item in menu menu if possible
|
|||||||
}
|
}
|
||||||
item = -1;
|
item = -1;
|
||||||
}
|
}
|
||||||
while (pp.menubar && pp.menu_number <= 0 && (!m.menu || m.menu->submenu()));
|
while (pp.menubar && Fl::event_key() == FL_Right);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +724,7 @@ static int backward(int menu) { // previous item in menu menu if possible
|
|||||||
}
|
}
|
||||||
item = m.numitems;
|
item = m.numitems;
|
||||||
}
|
}
|
||||||
while (pp.menubar && (!m.menu || m.menu->submenu()));
|
while (pp.menubar && Fl::event_key() == FL_Left);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ int menuwindow::handle_part1(int e) {
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case FL_Right:
|
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);
|
forward(0);
|
||||||
else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
|
else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user