diff options
| author | dannye <33dannye@gmail.com> | 2024-08-04 04:53:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-04 11:53:35 +0200 |
| commit | 46dd1b33ccb1e34be0b7a6d41a162e4dd611a548 (patch) | |
| tree | 09963be8463415a99f4d1af3fd5e0bc4bf3f7dca /src/Fl_Menu.cxx | |
| parent | 9bb9cb3f962bea7365e21bb1a836bf140deb6570 (diff) | |
Fix testing of multi-label alt shortcuts (#974)
* find_shortcut(): fix testing of multi-label alt shortcuts
* Use static function instead of macro
Diffstat (limited to 'src/Fl_Menu.cxx')
| -rw-r--r-- | src/Fl_Menu.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index b9b02bc4a..1d8ac502a 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1155,6 +1155,10 @@ const Fl_Menu_Item* Fl_Menu_Item::popup( return pulldown(X, Y, 0, 0, picked, menu_button, title ? &dummy : 0); } +static bool is_special_labeltype(uchar t) { + return t == _FL_MULTI_LABEL || t == _FL_ICON_LABEL || t == _FL_IMAGE_LABEL; +} + /** Search only the top level menu for a shortcut. Either &x in the label or the shortcut fields are used. @@ -1172,7 +1176,13 @@ const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip, const bool require_alt) if (m) for (int ii = 0; m->text; m = next_visible_or_not(m), ii++) { if (m->active()) { if (Fl::test_shortcut(m->shortcut_) - || Fl_Widget::test_shortcut(m->text, require_alt)) { + || (!is_special_labeltype(m->labeltype_) && Fl_Widget::test_shortcut(m->text, require_alt)) + || (m->labeltype_ == _FL_MULTI_LABEL + && !is_special_labeltype(((Fl_Multi_Label*)m->text)->typea) + && Fl_Widget::test_shortcut(((Fl_Multi_Label*)m->text)->labela, require_alt)) + || (m->labeltype_ == _FL_MULTI_LABEL + && !is_special_labeltype(((Fl_Multi_Label*)m->text)->typeb) + && Fl_Widget::test_shortcut(((Fl_Multi_Label*)m->text)->labelb, require_alt))) { if (ip) *ip=ii; return m; } |
