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

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 click simulation, reimplemented CocoaWindowMoveLoop without relying on the WindowServer. Created 4 years, 7 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 6b53860e202bfe7ff39ef2d021a92653b57c4382..57b9c434577dcbad31c6fc62d296e889dd949020 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -35,6 +35,13 @@ namespace {
NSString* const kFullKeyboardAccessChangedNotification =
@"com.apple.KeyboardUIModeDidChange";
+// We're sending simulated mouse events in CocoaWindowMoveLoop, and don't want
+// BridgedContentView to react when we're starting/ending the RunMoveLoop.
+// When reattaching the dragged tab we're sending the mouse down event to the
+// parent window we don't have the pointer to, so this flag is global for the
+// RunMoveLoop.
+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] &&
@@ -276,6 +283,10 @@ base::string16 AttributedSubstringForRangeHelper(
return self;
}
++ (void)setIgnoreMouseEvents:(BOOL)flag {
+ g_ignore_mouse_events = flag;
+}
+
- (void)clearView {
textInputClient_ = nullptr;
hostedView_ = nullptr;
@@ -459,7 +470,7 @@ base::string16 AttributedSubstringForRangeHelper(
// Translates the location of |theEvent| to toolkit-views coordinates and passes
// the event to NativeWidgetMac for handling.
- (void)mouseEvent:(NSEvent*)theEvent {
- if (!hostedView_)
+ if (!hostedView_ || g_ignore_mouse_events)
return;
ui::MouseEvent event(theEvent);

Powered by Google App Engine
This is Rietveld 408576698