Commit f2eac7a5 authored by erikchen's avatar erikchen Committed by Commit Bot

CommandDispatcher should not suppress key-up events.

There are some PPAPI consumers [e.g. chrome remote desktop] that expect to
receive key-up events even if a hotkey was consumed.

Bug: 856692
Change-Id: I8c70709344cfd412d77f8c6ea6d820886b4775ad
Reviewed-on: https://chromium-review.googlesource.com/1129679Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573788}
parent 2bb8bedc
......@@ -65,10 +65,6 @@ NSEvent* KeyEventForWindow(NSWindow* window, NSEvent* event) {
BOOL eventHandled_;
BOOL isRedispatchingKeyEvent_;
// If CommandDispatcher handles a keyEquivalent: [e.g. cmd + w], then it
// should suppress future key-up events, e.g. [cmd + w (key up)].
BOOL suppressEventsUntilKeyDown_;
NSWindow<CommandDispatchingWindow>* owner_; // Weak, owns us.
}
......@@ -97,7 +93,9 @@ NSEvent* KeyEventForWindow(NSWindow* window, NSEvent* event) {
// |delegate_| may be nil in this method. Rather than adding nil checks to every
// call, we rely on the fact that method calls to nil return nil, and that nil
// == ui::PerformKeyEquivalentResult::kUnhandled;
- (BOOL)doPerformKeyEquivalent:(NSEvent*)event {
- (BOOL)performKeyEquivalent:(NSEvent*)event {
DCHECK_EQ(NSKeyDown, [event type]);
// If the event is being redispatched, then this is the second time
// performKeyEquivalent: is being called on the event. The first time, a
// WebContents was firstResponder and claimed to have handled the event [but
......@@ -151,17 +149,6 @@ NSEvent* KeyEventForWindow(NSWindow* window, NSEvent* event) {
return [[self bubbleParent] performKeyEquivalent:event];
}
- (BOOL)performKeyEquivalent:(NSEvent*)event {
DCHECK_EQ(NSKeyDown, [event type]);
suppressEventsUntilKeyDown_ = NO;
BOOL consumed = [self doPerformKeyEquivalent:event];
if (consumed)
suppressEventsUntilKeyDown_ = YES;
return consumed;
}
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
forHandler:(id<UserInterfaceItemCommandHandler>)handler {
// Since this class implements these selectors, |super| will always say they
......@@ -244,18 +231,6 @@ NSEvent* KeyEventForWindow(NSWindow* window, NSEvent* event) {
return YES;
}
// This occurs after redispatchingEvent_, since we want a physical
// key-press from the user to reset this.
if ([event type] == NSKeyDown)
suppressEventsUntilKeyDown_ = NO;
// If CommandDispatcher handled a keyEquivalent: [e.g. cmd + w], then it
// should suppress future key-up events, e.g. [cmd + w (key up)].
if (suppressEventsUntilKeyDown_ &&
([event type] == NSKeyUp || [event type] == NSFlagsChanged)) {
return YES;
}
return NO;
}
......
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