Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit d8bd8f9

Browse files
Ensure selector sent only when CEF isn't wired up to handle it
1 parent b1fbfdc commit d8bd8f9

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

appshell/cefclient_mac.mm

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ - (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
7878

7979
- (void)sendEvent:(NSEvent*)event {
8080
if ([event type] == NSKeyDown) {
81-
// We've removed cut, copy, paste from the edit menu,
82-
// so we handle those shortcuts explicitly.
83-
if ([event modifierFlags] & NSCommandKeyMask) {
81+
// If mainWindow is the first responder then cef isn't the target
82+
// so let the application event chain handle it intrinsically
83+
if ([[self mainWindow] firstResponder] == [self mainWindow] &&
84+
[event modifierFlags] & NSCommandKeyMask) {
85+
// We've removed cut, copy, paste from the edit menu,
86+
// so we handle those shortcuts explicitly.
8487
SEL theSelector = nil;
8588
NSString *keyStr = [event charactersIgnoringModifiers];
8689
unichar keyChar = [keyStr characterAtIndex:0];
@@ -91,11 +94,7 @@ - (void)sendEvent:(NSEvent*)event {
9194
} else if (keyChar == 'x'){
9295
theSelector = NSSelectorFromString(@"cut:");
9396
} else if (keyChar == 'a'){
94-
// If mainWindow is the first responder then cef isn't the target
95-
// so let the application event chain handle it intrinsically
96-
if ([[self mainWindow] firstResponder] == [self mainWindow]) {
97-
theSelector = NSSelectorFromString(@"selectAll:");
98-
}
97+
theSelector = NSSelectorFromString(@"selectAll:");
9998
}
10099
if (theSelector != nil) {
101100
[[NSApplication sharedApplication] sendAction:theSelector to:nil from:nil];

0 commit comments

Comments
 (0)