From dc8021753163fb3eb70d2bc4b0d9d05e07e15ef0 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 19 Feb 2014 16:02:56 +0000 Subject: 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 --- src/Fl_Sys_Menu_Bar.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Fl_Sys_Menu_Bar.mm') 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; } -- cgit v1.2.3