| Index: ui/views/cocoa/bridged_content_view.mm
|
| diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
|
| index 3a3e83962f17744628618a60069066f79731fb5e..30e884f889ab89708fc50b6a27a1b85662b79f1d 100644
|
| --- a/ui/views/cocoa/bridged_content_view.mm
|
| +++ b/ui/views/cocoa/bridged_content_view.mm
|
| @@ -54,6 +54,8 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
| return false;
|
| }
|
|
|
| +bool g_ignore_mouse_events = false;
|
| +
|
| } // namespace
|
|
|
| @interface BridgedContentView ()
|
| @@ -93,6 +95,7 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
|
|
| @synthesize hostedView = hostedView_;
|
| @synthesize textInputClient = textInputClient_;
|
| +@synthesize ignoreMouseEvents = ignoreMouseEvents_;
|
| @synthesize mouseDownCanMoveWindow = mouseDownCanMoveWindow_;
|
|
|
| - (id)initWithView:(views::View*)viewToHost {
|
| @@ -118,6 +121,11 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
| return self;
|
| }
|
|
|
| +- (void)setIgnoreMouseEvents:(BOOL)flag {
|
| + ignoreMouseEvents_ = flag;
|
| + g_ignore_mouse_events = flag;
|
| +}
|
| +
|
| - (void)clearView {
|
| hostedView_ = NULL;
|
| [cursorTrackingArea_.get() clearOwner];
|
| @@ -125,6 +133,11 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
| }
|
|
|
| - (void)processCapturedMouseEvent:(NSEvent*)theEvent {
|
| + if (CGEventGetIntegerValueField([theEvent CGEvent], kCGEventSourceUserData)) {
|
| + DLOG(INFO) << "Ignoring generated event in capture.";
|
| + return;
|
| + }
|
| +
|
| if (!hostedView_)
|
| return;
|
|
|
| @@ -141,6 +154,7 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
| ui::MouseEvent event(theEvent);
|
| event.set_location(
|
| MovePointToWindow([theEvent locationInWindow], source, target));
|
| + DLOG(INFO) << "processing captured event in window at: " << event.location().ToString();
|
| hostedView_->GetWidget()->OnMouseEvent(&event);
|
| }
|
|
|
| @@ -259,11 +273,18 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) {
|
| // Translates the location of |theEvent| to toolkit-views coordinates and passes
|
| // the event to NativeWidgetMac for handling.
|
| - (void)mouseEvent:(NSEvent*)theEvent {
|
| - if (!hostedView_)
|
| + if (CGEventGetIntegerValueField([theEvent CGEvent], kCGEventSourceUserData)) {
|
| + DLOG(INFO) << "Ignoring generated event [regular].";
|
| + return;
|
| + }
|
| +
|
| + if (!hostedView_ || g_ignore_mouse_events)
|
| return;
|
|
|
| ui::MouseEvent event(theEvent);
|
|
|
| + //DLOG(INFO) << "processing regular mouse event event in window at: " << event.location().ToString();
|
| +
|
| // Aura updates tooltips with the help of aura::Window::AddPreTargetHandler().
|
| // Mac hooks in here.
|
| [self updateTooltipIfRequiredAt:event.location()];
|
|
|