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

Issue 1146873002: [MacViews] Enable dragging a window by its caption/draggable areas. (Closed)

Created:
5 years, 7 months ago by jackhou1
Modified:
5 years, 6 months ago
Reviewers:
tapted, Nico, sky
CC:
chromium-reviews, tfarina, dcheng, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[MacViews] Enable dragging a window by its caption/draggable areas. This works by making all subviews of [NSWindow contentView] draggable. I.e. they return YES for mouseDownCanMoveWindow. The content view itself is initially non-draggable. BridgedNativeWidget watches for any mouse-downs and tests whether they should drag the window. If so, it makes the content view draggable and reposts the event. The event is reposted at the kCGSessionEventTap level because window dragging seems to be handled there before the event is sent to the application. When BridgedNativeWidget sees the reposted mouse-down, window dragging will have started, so the content view can be made non-draggable again. BUG=485394, 459877 Committed: https://crrev.com/dc783c7be84a2a8c5564736f4b17a4fbd03897d6 Cr-Commit-Position: refs/heads/master@{#333410}

Patch Set 1 #

Patch Set 2 : Update comments. #

Total comments: 1

Patch Set 3 : Remove CocoaNonClientDragMaskView, change BridgedContentView instead. Remove CGEventTap implementat… #

Total comments: 39

Patch Set 4 : Address comments. #

Total comments: 21

Patch Set 5 : Sync and rebase #

Patch Set 6 : Address comments. #

Total comments: 4

Patch Set 7 : Address comments #

Total comments: 1

Patch Set 8 : Fix dragging of browser windows. #

Patch Set 9 : Add basic test (still debugging). #

Patch Set 10 : Change to single repost and [NSWindow setMovableByWindowBackground]. #

Total comments: 22

Patch Set 11 : Address comments. #

Total comments: 56

Patch Set 12 : Sync and rebase #

Total comments: 24

Patch Set 13 : Address comments. #

Patch Set 14 : Address comments. #

Patch Set 15 : Sync and rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+576 lines, -83 lines) Patch
M chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 10 chunks +25 lines, -73 lines 0 comments Download
M chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +19 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h View 1 2 3 4 5 1 chunk +11 lines, -1 line 0 comments Download
M chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm View 1 2 3 4 5 6 7 8 9 10 2 chunks +22 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/frame/browser_frame_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm View 1 2 3 4 5 6 7 1 chunk +9 lines, -1 line 0 comments Download
M ui/base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
A ui/base/test/windowed_nsnotification_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +40 lines, -0 lines 0 comments Download
A ui/base/test/windowed_nsnotification_observer.mm View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +67 lines, -0 lines 0 comments Download
M ui/base/ui_base.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +8 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.h View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +149 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget_interactive_uitest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +192 lines, -0 lines 0 comments Download
M ui/views/cocoa/views_nswindow_delegate.h View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
M ui/views/cocoa/views_nswindow_delegate.mm View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M ui/views/widget/native_widget_mac.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
M ui/views/widget/native_widget_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 31 (5 generated)
jackhou1
Here's some working code. It's not very polished yet, please ignore debugging and other nits. ...
5 years, 7 months ago (2015-05-20 05:50:37 UTC) #1
jackhou1
Bah, forgot to add reviewers when I last published comments.
5 years, 7 months ago (2015-05-20 05:51:11 UTC) #3
tapted
Awesome work Jack! You may have told me this already, but does it work fine ...
5 years, 7 months ago (2015-05-20 07:18:18 UTC) #4
jackhou1
> You may have told me this already, but does it work fine if Chrome ...
5 years, 7 months ago (2015-05-22 02:49:17 UTC) #5
tapted
niiiice https://codereview.chromium.org/1146873002/diff/40001/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/1146873002/diff/40001/ui/views/cocoa/bridged_native_widget.mm#newcode533 ui/views/cocoa/bridged_native_widget.mm:533: NSHeight([window_ frame]) - location_in_window.y); On 2015/05/22 02:49:16, jackhou1 ...
5 years, 7 months ago (2015-05-22 04:03:12 UTC) #6
jackhou1
https://codereview.chromium.org/1146873002/diff/60001/chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm File chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm (right): https://codereview.chromium.org/1146873002/diff/60001/chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm#newcode15 chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm:15: - (void)setMouseDownCanMoveWindow:(BOOL)can_move; On 2015/05/22 04:03:11, tapted wrote: > I ...
5 years, 7 months ago (2015-05-25 04:50:19 UTC) #7
tapted
lgtm % 1 nit below https://codereview.chromium.org/1146873002/diff/60001/chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm File chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm (right): https://codereview.chromium.org/1146873002/diff/60001/chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm#newcode15 chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm:15: - (void)setMouseDownCanMoveWindow:(BOOL)can_move; On 2015/05/25 ...
5 years, 7 months ago (2015-05-25 05:24:06 UTC) #8
tapted
oh, also "it's" -> its in the CL description & summary
5 years, 7 months ago (2015-05-25 05:24:31 UTC) #9
jackhou1
https://codereview.chromium.org/1146873002/diff/100001/ui/views/cocoa/bridged_native_widget.h File ui/views/cocoa/bridged_native_widget.h (right): https://codereview.chromium.org/1146873002/diff/100001/ui/views/cocoa/bridged_native_widget.h#newcode135 ui/views/cocoa/bridged_native_widget.h:135: // Called by ViewsNSWindowDelegate when the application receives a ...
5 years, 7 months ago (2015-05-25 06:26:39 UTC) #10
jackhou1
tapted, PTAL at: c/b/ui/views/frame/*
5 years, 7 months ago (2015-05-26 03:19:17 UTC) #11
jackhou1
FTR, patch set 8 didn't seem to work on 10.9. Patch set 9 adds a ...
5 years, 6 months ago (2015-06-01 04:15:39 UTC) #12
jackhou1
tapted, PTAL I have something that is much simpler and seems to work with all ...
5 years, 6 months ago (2015-06-02 06:33:09 UTC) #13
tapted
awesome! I think one problem remains - the close/minimize/maximize buttons can't be clicked on a ...
5 years, 6 months ago (2015-06-03 00:28:37 UTC) #14
jackhou1
https://codereview.chromium.org/1146873002/diff/180001/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm File chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm (right): https://codereview.chromium.org/1146873002/diff/180001/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm#newcode36 chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm:36: DCHECK(bounds().Contains(point)); On 2015/06/02 06:33:09, jackhou1 wrote: > Ah, I ...
5 years, 6 months ago (2015-06-03 04:04:44 UTC) #15
tapted
https://codereview.chromium.org/1146873002/diff/180001/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/1146873002/diff/180001/ui/views/cocoa/bridged_native_widget.mm#newcode105 ui/views/cocoa/bridged_native_widget.mm:105: // - BridgedNativeWidget's draggability getting out of sync (e.g. ...
5 years, 6 months ago (2015-06-03 07:04:50 UTC) #16
jackhou1
https://codereview.chromium.org/1146873002/diff/200001/ui/base/test/windowed_nsnotification_observer.h File ui/base/test/windowed_nsnotification_observer.h (right): https://codereview.chromium.org/1146873002/diff/200001/ui/base/test/windowed_nsnotification_observer.h#newcode5 ui/base/test/windowed_nsnotification_observer.h:5: #ifndef UI_GFX_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_ On 2015/06/03 07:04:48, tapted wrote: > UI_GFX_TEST ...
5 years, 6 months ago (2015-06-03 08:13:54 UTC) #17
tapted
lgtm! https://codereview.chromium.org/1146873002/diff/200001/ui/base/test/windowed_nsnotification_observer.h File ui/base/test/windowed_nsnotification_observer.h (right): https://codereview.chromium.org/1146873002/diff/200001/ui/base/test/windowed_nsnotification_observer.h#newcode15 ui/base/test/windowed_nsnotification_observer.h:15: @interface WindowedNSNotificationObserver : NSObject { On 2015/06/03 08:13:51, ...
5 years, 6 months ago (2015-06-03 09:12:57 UTC) #18
jackhou1
https://codereview.chromium.org/1146873002/diff/220001/ui/views/cocoa/bridged_content_view.h File ui/views/cocoa/bridged_content_view.h (right): https://codereview.chromium.org/1146873002/diff/220001/ui/views/cocoa/bridged_content_view.h#newcode53 ui/views/cocoa/bridged_content_view.h:53: @property(assign) BOOL mouseDownCanMoveWindow; On 2015/06/03 09:12:57, tapted wrote: > ...
5 years, 6 months ago (2015-06-03 09:32:48 UTC) #19
jackhou1
thakis, please review for OWNERS in: chrome/browser/ui/views/frame/ ui/base/
5 years, 6 months ago (2015-06-03 09:37:39 UTC) #21
jackhou1
Oops, that should be sky for chrome/browser/ui/views/frame/ thakis, for ui/base/
5 years, 6 months ago (2015-06-03 09:39:08 UTC) #23
sky
LGTM
5 years, 6 months ago (2015-06-03 16:00:36 UTC) #24
jackhou1
Hi Nico, could you take a quick look at ui/base/? It's based on WindowedNotificationObserver here: ...
5 years, 6 months ago (2015-06-05 01:25:55 UTC) #25
Nico
lgtm Sorry for the delay. (tapted, feel free to add yourself to any cocoa-y owners ...
5 years, 6 months ago (2015-06-08 23:56:31 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1146873002/280001
5 years, 6 months ago (2015-06-08 23:57:09 UTC) #29
commit-bot: I haz the power
Committed patchset #15 (id:280001)
5 years, 6 months ago (2015-06-09 00:57:08 UTC) #30
commit-bot: I haz the power
5 years, 6 months ago (2015-06-09 00:58:11 UTC) #31
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/dc783c7be84a2a8c5564736f4b17a4fbd03897d6
Cr-Commit-Position: refs/heads/master@{#333410}

Powered by Google App Engine
This is Rietveld 408576698