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

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: Extract DragsWindowUsingCocoaMoveLoop test, cleanup code. Created 4 years, 9 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 88a5b84de02afe7f709d6c19cc343db02f248143..419a253ac55fdfc979cb75615bf6def61f15f531 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -32,6 +32,8 @@ using views::MenuController;
namespace {
+bool g_ignore_mouse_events = false;
tapted 2016/03/10 11:51:19 needs a comment. (it should say why we need both a
themblsha 2016/03/25 17:22:54 Done.
+
// Returns true if all four corners of |rect| are contained inside |path|.
bool IsRectInsidePath(NSRect rect, NSBezierPath* path) {
return [path containsPoint:rect.origin] &&
@@ -200,6 +202,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 {
@@ -225,6 +228,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;
@@ -233,6 +241,10 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
}
- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
+ if (CGEventGetIntegerValueField([theEvent CGEvent], kCGEventSourceUserData)) {
+ return;
+ }
+
if (!hostedView_)
return;
@@ -391,7 +403,11 @@ 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)) {
+ return;
+ }
+
+ if (!hostedView_ || g_ignore_mouse_events)
return;
ui::MouseEvent event(theEvent);

Powered by Google App Engine
This is Rietveld 408576698