JBR-7449: Fix press-and-hold cancel keys not being swallowed by JBR

(cherry picked from commit a0dbdff2b0)
This commit is contained in:
Nikita Tsarev
2024-07-29 17:29:36 +02:00
committed by jbrbot
parent 4a62198289
commit ac2fe7c617

View File

@@ -375,6 +375,9 @@ static void debugPrintNSEvent(NSEvent* event, const char* comment) {
#ifdef LOG_KEY_EVENTS
debugPrintNSEvent(event, "keyDown");
#endif
// Check for willBeHandledByComplexInputMethod here, because interpretKeyEvents might invalidate that field
bool isPressAndHold = fEnablePressAndHold && [event willBeHandledByComplexInputMethod] && fInputMethodLOCKABLE;
fProcessingKeystroke = YES;
fKeyEventsNeeded = ![(NSString *)kbdLayout containsString:@KEYMAN_LAYOUT];
@@ -392,8 +395,7 @@ static void debugPrintNSEvent(NSEvent* event, const char* comment) {
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod] &&
fInputMethodLOCKABLE)
if (isPressAndHold)
{
BOOL skipProcessingCancelKeys = YES;
fProcessingKeystroke = NO;