|
21 | 21 | #define EMPTY_HOTKEY 0xFE0000FE
|
22 | 22 | #define LOAD_DATA(VAR, KEY) VAR = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@#KEY]
|
23 | 23 |
|
| 24 | +// Ignore code for Modifier keys and numpad |
| 25 | +// Reference: https://eastmanreference.com/complete-list-of-applescript-key-codes |
| 26 | +NSDictionary *keyStringToKeyCodeMap = @{ |
| 27 | + // Characters from number row |
| 28 | + @"`": @50, @"~": @50, @"1": @18, @"!": @18, @"2": @19, @"@": @19, @"3": @20, @"#": @20, @"4": @21, @"$": @21, |
| 29 | + @"5": @23, @"%": @23, @"6": @22, @"^": @22, @"7": @26, @"&": @26, @"8": @28, @"*": @28, @"9": @25, @"(": @25, |
| 30 | + @"0": @29, @")": @29, @"-": @27, @"_": @27, @"=": @24, @"+": @24, |
| 31 | + // Characters from first keyboard row |
| 32 | + @"q": @12, @"w": @13, @"e": @14, @"r": @15, @"t": @17, @"y": @16, @"u": @32, @"i": @34, @"o": @31, @"p": @35, |
| 33 | + @"[": @33, @"{": @33, @"]": @30, @"}": @30, @"\\": @42, @"|": @42, |
| 34 | + // Characters from second keyboard row |
| 35 | + @"a": @0, @"s": @1, @"d": @2, @"f": @3, @"g": @5, @"h": @4, @"j": @38, @"k": @40, @"l": @37, |
| 36 | + @";": @41, @":": @41, @"'": @39, @"\"": @39, |
| 37 | + // Characters from second third row |
| 38 | + @"z": @6, @"x": @7, @"c": @8, @"v": @9, @"b": @11, @"n": @45, @"m": @46, |
| 39 | + @",": @43, @"<": @43, @".": @47, @">": @47, @"/": @44, @"?": @44 |
| 40 | +}; |
| 41 | + |
24 | 42 | extern ViewController* viewController;
|
25 | 43 |
|
26 | 44 | extern AppDelegate* appDelegate;
|
@@ -535,23 +553,6 @@ int ConvertKeyStringToKeyCode(NSString *keyString, CGKeyCode fallback) {
|
535 | 553 | return fallback;
|
536 | 554 | }
|
537 | 555 |
|
538 |
| - // Ignore code for Modifier keys and numpad |
539 |
| - // Reference: https://eastmanreference.com/complete-list-of-applescript-key-codes |
540 |
| - NSDictionary *keyStringToKeyCodeMap = @{ |
541 |
| - // Characters from number row |
542 |
| - @"`": @50, @"~": @50, @"1": @18, @"!": @18, @"2": @19, @"@": @19, @"3": @20, @"#": @20, @"4": @21, @"$": @21, |
543 |
| - @"5": @23, @"%": @23, @"6": @22, @"^": @22, @"7": @26, @"&": @26, @"8": @28, @"*": @28, @"9": @25, @"(": @25, |
544 |
| - @"0": @29, @")": @29, @"-": @27, @"_": @27, @"=": @24, @"+": @24, |
545 |
| - // Characters from first keyboard row |
546 |
| - @"q": @12, @"w": @13, @"e": @14, @"r": @15, @"t": @17, @"y": @16, @"u": @32, @"i": @34, @"o": @31, @"p": @35, |
547 |
| - @"[": @33, @"{": @33, @"]": @30, @"}": @30, @"\\": @42, @"|": @42, |
548 |
| - // Characters from second keyboard row |
549 |
| - @"a": @0, @"s": @1, @"d": @2, @"f": @3, @"g": @5, @"h": @4, @"j": @38, @"k": @40, @"l": @37, |
550 |
| - @";": @41, @":": @41, @"'": @39, @"\"": @39, |
551 |
| - // Characters from second third row |
552 |
| - @"z": @6, @"x": @7, @"c": @8, @"v": @9, @"b": @11, @"n": @45, @"m": @46, |
553 |
| - @",": @43, @"<": @43, @".": @47, @">": @47, @"/": @44, @"?": @44 |
554 |
| - }; |
555 | 556 | NSNumber *keycode = [keyStringToKeyCodeMap objectForKey:lowercasedKeyString];
|
556 | 557 |
|
557 | 558 | if (keycode) {
|
|
0 commit comments