Fl_Sys_Menu_Bar: allow use of more keys as menu shortcuts.

This commit is contained in:
ManoloFLTK 2022-07-27 00:52:09 +02:00
parent f582e06224
commit d6832f210c
2 changed files with 11 additions and 5 deletions

View File

@ -23,6 +23,7 @@
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include "Fl_System_Driver.H"
#import <Cocoa/Cocoa.h> // keep this after include of Fl_MacOS_Sys_Menu_Bar_Driver.H because of check() conflict
@ -180,7 +181,13 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
} else if (key == FL_Escape) {
mac_key = 27;
} else if (key == FL_Tab) {
mac_key = 9;
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

@ -44,13 +44,12 @@
Fl_System_Driver::Keyname darwin_key_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
@ -73,7 +72,7 @@ Fl_System_Driver::Keyname darwin_key_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
};
const char *Fl_Darwin_System_Driver::shift_name() {