mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: restore window event redispatching on mac (#27812)
Co-authored-by: clavin <cwatford@slack-corp.com>
This commit is contained in:
@@ -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)
|
||||
@@ -48,6 +49,16 @@ bool CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user