Skip to content

Commit

Permalink
fix: restore window event redispatching on mac (#27787)
Browse files Browse the repository at this point in the history
  • Loading branch information
clavin committed Feb 19, 2021
1 parent 527c767 commit 6fa2ab2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shell/browser/common_web_contents_delegate_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
#include "shell/browser/web_contents_preferences.h"
#include "ui/base/cocoa/command_dispatcher.h"
#include "ui/events/keycodes/keyboard_codes.h"

@interface NSWindow (EventDispatchingWindow)
Expand Down Expand Up @@ -48,6 +49,16 @@ - (void)redispatchKeyEvent:(NSEvent*)event;
// devtools windows as Widgets in order to take advantage of the
// pre-existing redispatch code in bridged_native_widget.
return false;
} else if (event.os_event.window &&
[event.os_event.window
conformsToProtocol:@protocol(CommandDispatchingWindow)]) {
NSObject<CommandDispatchingWindow>* window =
static_cast<NSObject<CommandDispatchingWindow>*>(event.os_event.window);
[[window commandDispatcher] redispatchKeyEvent:event.os_event];
// FIXME(clavin): Not exactly sure what to return here, likely the same
// situation as the branch above. If a future refactor removes
// |EventDispatchingWindow| then only this branch will need to remain.
return false;
}

return false;
Expand Down

0 comments on commit 6fa2ab2

Please sign in to comment.