summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-02-19 16:02:56 +0000
committerManolo Gouy <Manolo>2014-02-19 16:02:56 +0000
commitdc8021753163fb3eb70d2bc4b0d9d05e07e15ef0 (patch)
tree62d01076c12fd00c03c8793a6d1b84a1f5771c35
parent1122c1444301231a1072395f4c9018a965df0bfc (diff)
Fixed processing of menu shortcuts for Fl_Sys_Menu_Bar
in the case of an invisible item. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10106 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Sys_Menu_Bar.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Fl_Sys_Menu_Bar.mm b/src/Fl_Sys_Menu_Bar.mm
index 5a58c87b4..fc0576795 100644
--- a/src/Fl_Sys_Menu_Bar.mm
+++ b/src/Fl_Sys_Menu_Bar.mm
@@ -470,8 +470,14 @@ void Fl_Sys_Menu_Bar::draw() {
static int process_sys_menu_shortcuts(int event)
{
if (event != FL_SHORTCUT || !fl_sys_menu_bar || Fl::modal()) return 0;
- // have the system menu process the shortcut, highlighting the corresponding menu if found
- return [[NSApp mainMenu] performKeyEquivalent:[NSApp currentEvent]];
+ // is the last event the shortcut of an item of the fl_sys_menu_bar menu ?
+ const Fl_Menu_Item *item = fl_sys_menu_bar->menu()->test_shortcut();
+ if (!item) return 0;
+ if (item->visible()) // have the system menu process the shortcut, highlighting the corresponding menu
+ [[NSApp mainMenu] performKeyEquivalent:[NSApp currentEvent]];
+ else // have FLTK process the shortcut associated to an invisible Fl_Menu_Item
+ fl_sys_menu_bar->picked(item);
+ return 1;
}