Description
(most of this problem description is outdated -- please see comments for full context.)
The Problem
Fl_Sys_Menu_Bar menu item shortcuts using Escape or Tab do not work properly on Mac.
The shortcuts display incorrectly in the menu and the keyboard shortcuts do not invoke the callback.
This works correctly in Windows and Linux.
"Escape" is displayed in the menu as a semicolon (;
) and "Tab" is displayed as a closing parenthesis ()
).
Note that neither Escape/Tab nor semicolon/parenthesis invoke the callback.
It's possible that this is just user-error on my part but that seems unlikely.
I couldn't find any bug reports of a similar bug so I wanted to submit this and see if there is any known workaround.
Thanks!
Screenshots
Mac
Windows
Linux
The Code
Fl_Menu_Item menu_items[] = {
...
OS_MENU_ITEM("&Stop", FL_Escape, (Fl_Callback *)stop_cb, this, FL_MENU_DIVIDER),
...
OS_MENU_ITEM("&Next Channel", FL_Tab, (Fl_Callback *)next_channel_cb, this, 0),
OS_MENU_ITEM("&Previous Channel", FL_SHIFT + FL_Tab, (Fl_Callback *)previous_channel_cb, this, 0),
...
};
_menu_bar->copy(menu_items);
where OS_MENU_ITEM
is a convenience macro defined as:
#ifdef __APPLE__
#define OS_MENU_ITEM_PREFIX ""
#define OS_MENU_ITEM_SUFFIX ""
#else
#define OS_MENU_ITEM_PREFIX " "
#define OS_MENU_ITEM_SUFFIX " "
#endif
#define OS_MENU_ITEM(l, s, c, d, f) {OS_MENU_ITEM_PREFIX l OS_MENU_ITEM_SUFFIX, s, c, d, f, FL_NORMAL_LABEL, OS_FONT, OS_FONT_SIZE, FL_FOREGROUND_COLOR}