Commit 3e396669 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacPWAs: Fix cmd+C and cmd+V with non-English keyboards

The fix for crrev.com/641485 only saved off the event for redispatch
in a single situation where it wasn't handled. This was too
conservative, and didn't address cmd+C and cmd+V.

Save off the event for redispatch whenever it is unhandled.

Bug: 964052
Change-Id: Iaa9b8d747e396aa1f0a3144c83400ae73dd44a80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643732Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666028}
parent 875ca8c1
...@@ -64,13 +64,18 @@ ...@@ -64,13 +64,18 @@
// TODO(erikchen): Detect symbolic hot keys, and force control to be passed // TODO(erikchen): Detect symbolic hot keys, and force control to be passed
// back to AppKit so that it can handle it correctly. // back to AppKit so that it can handle it correctly.
// https://crbug.com/846893. // https://crbug.com/846893.
auto* bridge =
remote_cocoa::NativeWidgetNSWindowBridge::GetFromNativeWindow(window);
NSResponder* responder = [window firstResponder]; NSResponder* responder = [window firstResponder];
if ([responder conformsToProtocol:@protocol(CommandDispatcherTarget)]) { if ([responder conformsToProtocol:@protocol(CommandDispatcherTarget)]) {
NSObject<CommandDispatcherTarget>* target = NSObject<CommandDispatcherTarget>* target =
static_cast<NSObject<CommandDispatcherTarget>*>(responder); static_cast<NSObject<CommandDispatcherTarget>*>(responder);
if ([target isKeyLocked:event]) if ([target isKeyLocked:event]) {
if (bridge)
bridge->SaveKeyEventForRedispatch(event);
return ui::PerformKeyEquivalentResult::kUnhandled; return ui::PerformKeyEquivalentResult::kUnhandled;
}
} }
if ([self eventHandledByViewsFocusManager:event if ([self eventHandledByViewsFocusManager:event
...@@ -94,8 +99,6 @@ ...@@ -94,8 +99,6 @@
// highlighting of the NSMenu. // highlighting of the NSMenu.
CommandForKeyEventResult result = CommandForKeyEvent(event); CommandForKeyEventResult result = CommandForKeyEvent(event);
if (result.found()) { if (result.found()) {
auto* bridge =
remote_cocoa::NativeWidgetNSWindowBridge::GetFromNativeWindow(window);
if (bridge) { if (bridge) {
bool was_executed = false; bool was_executed = false;
bridge->host()->ExecuteCommand( bridge->host()->ExecuteCommand(
...@@ -103,10 +106,11 @@ ...@@ -103,10 +106,11 @@
true /* is_before_first_responder */, &was_executed); true /* is_before_first_responder */, &was_executed);
if (was_executed) if (was_executed)
return ui::PerformKeyEquivalentResult::kHandled; return ui::PerformKeyEquivalentResult::kHandled;
bridge->SaveKeyEventForRedispatch(event);
} }
} }
if (bridge)
bridge->SaveKeyEventForRedispatch(event);
return ui::PerformKeyEquivalentResult::kUnhandled; return ui::PerformKeyEquivalentResult::kUnhandled;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment