| Index: ui/views/cocoa/native_widget_mac_nswindow.mm
|
| diff --git a/ui/views/cocoa/native_widget_mac_nswindow.mm b/ui/views/cocoa/native_widget_mac_nswindow.mm
|
| index f3ccb522652a85af015b7bf64c9c3651ae8d91dd..0f077fe12b65c90ba4126e6ba6496e134b0071f7 100644
|
| --- a/ui/views/cocoa/native_widget_mac_nswindow.mm
|
| +++ b/ui/views/cocoa/native_widget_mac_nswindow.mm
|
| @@ -5,6 +5,7 @@
|
| #import "ui/views/cocoa/native_widget_mac_nswindow.h"
|
|
|
| #include "base/mac/foundation_util.h"
|
| +#import "base/mac/sdk_forward_declarations.h"
|
| #import "ui/views/cocoa/bridged_native_widget.h"
|
| #import "ui/base/cocoa/user_interface_item_command_handler.h"
|
| #import "ui/views/cocoa/views_nswindow_delegate.h"
|
| @@ -107,14 +108,32 @@ - (BOOL)hasKeyAppearance {
|
| return [super hasKeyAppearance];
|
| }
|
|
|
| -// Override sendEvent to allow key events to be forwarded to a toolkit-views
|
| -// menu while it is active, and while still allowing any native subview to
|
| -// retain firstResponder status.
|
| +// Override sendEvent to intercept window drag events and allow key events to be
|
| +// forwarded to a toolkit-views menu while it is active, and while still
|
| +// allowing any native subview to retain firstResponder status.
|
| - (void)sendEvent:(NSEvent*)event {
|
| // Let CommandDispatcher check if this is a redispatched event.
|
| if ([commandDispatcher_ preSendEvent:event])
|
| return;
|
|
|
| + // If a window drag event monitor is not used, query the BridgedNativeWidget
|
| + // to decide if a window drag should be performed.
|
| + if (!views::BridgedNativeWidget::ShouldUseDragEventMonitor()) {
|
| + views::BridgedNativeWidget* bridge =
|
| + views::NativeWidgetMac::GetBridgeForNativeWindow(self);
|
| +
|
| + if (bridge && bridge->ShouldDragWindow(event)) {
|
| + // Using performWindowDragWithEvent: does not generate a
|
| + // NSWindowWillMoveNotification. Hence post one.
|
| + [[NSNotificationCenter defaultCenter]
|
| + postNotificationName:NSWindowWillMoveNotification
|
| + object:self];
|
| +
|
| + [self performWindowDragWithEvent:event];
|
| + return;
|
| + }
|
| + }
|
| +
|
| NSEventType type = [event type];
|
| if ((type != NSKeyDown && type != NSKeyUp) || ![self hasViewsMenuActive]) {
|
| [super sendEvent:event];
|
|
|