|
35 | 35 |
|
36 | 36 | //app which error with unicode Compound
|
37 | 37 | NSArray* _unicodeCompoundApp = @[@"com.apple.",
|
38 |
| - @"com.google.Chrome", @"com.brave.Browser", @"com.microsoft.Edge.Dev", @"com.microsoft.Edge", @"com.microsoft.edgemac.Dev"]; |
| 38 | + @"com.google.Chrome", @"com.brave.Browser", |
| 39 | + @"com.microsoft.edgemac.Dev", @"com.microsoft.edgemac.Beta", @"com.microsoft.Edge.Dev", @"com.microsoft.Edge"]; |
39 | 40 |
|
40 | 41 | CGEventSourceRef myEventSource = NULL;
|
41 | 42 | vKeyHookState* pData;
|
|
57 | 58 | Uint16 _uniChar[2];
|
58 | 59 | int _i, _j, _k;
|
59 | 60 | Uint32 _tempChar;
|
60 |
| - |
| 61 | + bool _hasJustUsedHotKey = false; |
| 62 | + |
61 | 63 | int _languageTemp = 0; //use for smart switch key
|
62 | 64 | vector<Byte> savedSmartSwitchKeyData; ////use for smart switch key
|
63 | 65 |
|
@@ -517,37 +519,43 @@ CGEventRef OpenKeyCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef e
|
517 | 519 | if (GET_SWITCH_KEY(vSwitchKeyStatus) == _keycode && checkHotKey(vSwitchKeyStatus, GET_SWITCH_KEY(vSwitchKeyStatus) != 0xFE)){
|
518 | 520 | switchLanguage();
|
519 | 521 | _lastFlag = 0;
|
| 522 | + _hasJustUsedHotKey = true; |
520 | 523 | return NULL;
|
521 | 524 | }
|
522 | 525 | if (GET_SWITCH_KEY(convertToolHotKey) == _keycode && checkHotKey(convertToolHotKey, GET_SWITCH_KEY(convertToolHotKey) != 0xFE)){
|
523 | 526 | [appDelegate onQuickConvert];
|
524 | 527 | _lastFlag = 0;
|
| 528 | + _hasJustUsedHotKey = true; |
525 | 529 | return NULL;
|
526 | 530 | }
|
527 | 531 | }
|
| 532 | + _hasJustUsedHotKey = _lastFlag != 0; |
528 | 533 | } else if (type == kCGEventFlagsChanged) {
|
529 | 534 | if (_lastFlag == 0 || _lastFlag < _flag) {
|
530 | 535 | _lastFlag = _flag;
|
531 | 536 | } else if (_lastFlag > _flag) {
|
532 |
| - //check temporarily turn off spell checking |
533 |
| - if (vTempOffSpelling && _lastFlag & kCGEventFlagMaskControl) { |
534 |
| - vTempOffSpellChecking(); |
535 |
| - } |
536 |
| - if (vTempOffOpenKey && _lastFlag & kCGEventFlagMaskCommand) { |
537 |
| - vTempOffEngine(); |
538 |
| - } |
539 | 537 | //check switch
|
540 | 538 | if (checkHotKey(vSwitchKeyStatus, GET_SWITCH_KEY(vSwitchKeyStatus) != 0xFE)) {
|
541 | 539 | _lastFlag = 0;
|
542 | 540 | switchLanguage();
|
| 541 | + _hasJustUsedHotKey = true; |
543 | 542 | return NULL;
|
544 | 543 | }
|
545 | 544 | if (checkHotKey(convertToolHotKey, GET_SWITCH_KEY(convertToolHotKey) != 0xFE)) {
|
546 | 545 | _lastFlag = 0;
|
547 | 546 | [appDelegate onQuickConvert];
|
| 547 | + _hasJustUsedHotKey = true; |
548 | 548 | return NULL;
|
549 | 549 | }
|
| 550 | + //check temporarily turn off spell checking |
| 551 | + if (vTempOffSpelling && !_hasJustUsedHotKey && _lastFlag & kCGEventFlagMaskControl) { |
| 552 | + vTempOffSpellChecking(); |
| 553 | + } |
| 554 | + if (vTempOffOpenKey && !_hasJustUsedHotKey && _lastFlag & kCGEventFlagMaskCommand) { |
| 555 | + vTempOffEngine(); |
| 556 | + } |
550 | 557 | _lastFlag = 0;
|
| 558 | + _hasJustUsedHotKey = false; |
551 | 559 | }
|
552 | 560 | }
|
553 | 561 |
|
|
0 commit comments