Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 00a82f0

Browse files
committed
Update comment
1 parent ceb6254 commit 00a82f0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.mm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,17 @@ - (void)keyUp:(NSEvent*)event {
497497
[self.flutterViewController keyUp:event];
498498
}
499499

500-
// Invoked through NSWindow processing of key down event. This can be either
501-
// regular event sent from NSApplication with CMD modifier, in which case the
502-
// event is processed as keyDown, or keyboard manager redispatching the event
503-
// if nextResponder is NSWindow, in which case the event needs to be ignored,
504-
// otherwise it will cause endless loop.
505500
- (BOOL)performKeyEquivalent:(NSEvent*)event {
506501
if (_flutterViewController.keyboardManager.eventBeingDispatched == event) {
507-
// This happens with cmd+contorl+space (emoji picker)
502+
// When NSWindow is nextResponder, keyboard manager will send to it
503+
// unhandled events (through [NSWindow keyDown:]). If event has has both
504+
// control and cmd modifiers set (i.e. cmd+control+space - emoji picker)
505+
// NSWindow will then send this event as performKeyEquivalent: to first
506+
// responder, which is FlutterTextInputPlugin. If that's the case, the
507+
// plugin must not handle the event, otherwise the emoji picker would not
508+
// work (due to first responder returning YES from performKeyEquivalent:)
509+
// and there would be endless loop, because FlutterViewController will
510+
// send the event back to [keyboardManager handleEvent:].
508511
return NO;
509512
}
510513
[self.flutterViewController keyDown:event];

0 commit comments

Comments
 (0)