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

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: Removed debug logging, use CGEvents for drag-n-drop. 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..4966c4601308e7fa57bac8e1b6668ec582dcf2b2 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,10 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
}
- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
+ if (CGEventGetIntegerValueField([theEvent CGEvent], kCGEventSourceUserData)) {
+ return;
+ }
+
if (!hostedView_)
return;
@@ -389,7 +401,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