Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: ui/views/cocoa/bridged_content_view.mm

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6022a44723bf99d9873d04bd6dcbebdb7bc66697..788564ccbb054081ffd324b74f9f202c4b88857e 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -31,6 +31,8 @@ using views::MenuController;
namespace {
+bool g_ignore_mouse_events = false;
+
// Returns true if all four corners of |rect| are contained inside |path|.
bool IsRectInsidePath(NSRect rect, NSBezierPath* path) {
return [path containsPoint:rect.origin] &&
@@ -198,6 +200,7 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
@synthesize hostedView = hostedView_;
@synthesize textInputClient = textInputClient_;
@synthesize drawMenuBackgroundForBlur = drawMenuBackgroundForBlur_;
+@synthesize ignoreMouseEvents = ignoreMouseEvents_;
@synthesize mouseDownCanMoveWindow = mouseDownCanMoveWindow_;
- (id)initWithView:(views::View*)viewToHost {
@@ -223,6 +226,11 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
return self;
}
+- (void)setIgnoreMouseEvents:(BOOL)flag {
+ ignoreMouseEvents_ = flag;
+ g_ignore_mouse_events = flag;
+}
+
- (void)clearView {
textInputClient_ = nullptr;
hostedView_ = nullptr;
@@ -231,6 +239,11 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
}
- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
+ if (CGEventGetIntegerValueField([theEvent CGEvent], kCGEventSourceUserData)) {
+ DLOG(INFO) << "Ignoring generated event in capture.";
+ return;
+ }
+
if (!hostedView_)
return;
@@ -247,6 +260,8 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
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);
}
@@ -389,11 +404,19 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
// 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()];

Powered by Google App Engine
This is Rietveld 408576698