MacViews, Sierra: Draggable regions no longer drag the window |
||
Issue descriptionChrome Version : 56.0.2902.0 OS Version: OS X 10.12.1 What steps will reproduce the problem? 1. Build mac_views_browser, browser window not draggable, OR 1. In Canary, flip chrome://flags/#mac-views-native-app-windows 2. Install https://chrome.google.com/webstore/detail/frameless-window-sample/hjjdaddngnaofnfjpajdcbdmkegiakec/ 3. Add a titlebar (draggable region) and drag the window around. What is the expected result? Windows should drag. What happens instead of that? They don't. This is because before 10.11 there was no API to move windows around properly, so we relied on a bunch of hacks :(. In 10.11, AppKit added -[NSWindow performWindowDragWithEvent:] - https://developer.apple.com/reference/appkit/nswindow/1419386-performwindowdragwithevent We should use it. UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2902.0 Safari/537.36
,
Nov 10 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d22dbe7d44e81b40c2c1415a13ff7965693150ed commit d22dbe7d44e81b40c2c1415a13ff7965693150ed Author: karandeepb <karandeepb@chromium.org> Date: Thu Nov 10 03:23:47 2016 MacViews: Fix window dragging on Sierra. To allow window dragging on custom window regions on MacViews, an event monitor is currently used. The event monitor looks for any mouse down events which should cause window dragging, makes the window draggable and then reposts these events. Since AppKit caches the draggable regions, we use a hack to invalidate this cache in BridgedNativeWidget::SetDraggable. However, this broke on Sierra. To fix, use the new window dragging API [NSWindow performWindowDragWithEvent:] introduced in Mac OS 10.11. BridgedNativeWidget::ShouldUseDragEventMonitor is introduced which returns true if the drag event monitor approach should be used when the API is not available. NativeWidgetMacNSWindow's sendEvent is modified to intercept mouse events and perform window dragging when necessary. Also, BridgedNativeWidgetUITest.HitTest is fixed for both the cases (when a drag event monitor is used and when it isn't). BUG= 660270 TEST=On Sierra, enable chrome://flags/#mac-views-native-app-windows. Install https://chrome.google.com/webstore/detail/frameless-window-sample/hjjdaddngnaofnfjpajdcbdmkegiakec/. Add a titlebar (draggable region) and ensure window dragging works. TEST=Build with mac_views_browser=true on Sierra. Ensure the browser window is draggable. Review-Url: https://codereview.chromium.org/2475173002 Cr-Commit-Position: refs/heads/master@{#431166} [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/base/mac/sdk_forward_declarations.h [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/bridged_native_widget.h [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/bridged_native_widget.mm [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/native_widget_mac_nswindow.mm [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/views_nswindow_delegate.h [modify] https://crrev.com/d22dbe7d44e81b40c2c1415a13ff7965693150ed/ui/views/cocoa/views_nswindow_delegate.mm
,
Nov 10 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by karandeepb@chromium.org
, Nov 1 2016Status: Assigned (was: Available)