Issue #469: Fl_Sys_Menu_Bar menu item shortcuts using Escape or Tab do not work on Mac

This commit is contained in:
ManoloFLTK 2022-07-28 08:22:20 +02:00
parent 8ae8370dcf
commit df2b94bfa4
2 changed files with 14 additions and 5 deletions

View File

@ -167,7 +167,17 @@ typedef struct {
if ( (key >= (FL_F+1)) && (key <= FL_F_Last) ) { // Handle function keys
int fkey_num = (key - FL_F); // 1,2..
mac_key = NSF1FunctionKey + fkey_num - 1;
}
} else if (key == FL_Escape) {
mac_key = 27;
} else if (key == FL_Tab) {
mac_key = NSTabCharacter;
} else if (key == FL_Enter) {
mac_key = 0x0d;
} else if (key == FL_BackSpace) {
mac_key = NSBackspaceCharacter;
} else if (key == FL_Delete) {
mac_key = NSDeleteCharacter;
}
[self setKeyEquivalent:[NSString stringWithCharacters:&mac_key length:1]];
[self setKeyEquivalentModifierMask:mod];
}

View File

@ -122,13 +122,12 @@ static Keyname table[] = {
static Keyname table[] = {
// v - this column may contain UTF-8 characters
{' ', "Space"},
{FL_BackSpace,"\xe2\x8c\xab"}, // erase to the left
{FL_BackSpace,""/*"\xe2\x8c\xab"*/}, // U+232B : erase to the left
{FL_Tab, "\xe2\x87\xa5"}, // rightwards arrow to bar
{0xff0b, "\xe2\x8c\xa6"}, // erase to the right
{FL_Enter, "\xe2\x86\xa9"}, // leftwards arrow with hook
{FL_Pause, "Pause"},
{FL_Scroll_Lock, "Scroll_Lock"},
{FL_Escape, "\xe2\x90\x9b"},
{FL_Escape, ""}, // U+238B : broken circle with northwest arrow
{FL_Home, "\xe2\x86\x96"}, // north west arrow
{FL_Left, "\xe2\x86\x90"}, // leftwards arrow
{FL_Up, "\xe2\x86\x91"}, // upwards arrow
@ -151,7 +150,7 @@ static Keyname table[] = {
{FL_Meta_R, "Meta_R"},
{FL_Alt_L, "Alt_L"},
{FL_Alt_R, "Alt_R"},
{FL_Delete, "\xe2\x8c\xa7"} // x in a rectangle box
{FL_Delete, ""/*"\xe2\x8c\xa6"*/} // U+2326 : erase to the right
};
#endif