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

Issue 789763002: MacViews: Implement capture using NSEvent local+global monitors (Closed)

Created:
6 years ago by tapted
Modified:
6 years ago
Reviewers:
Robert Sesek, Andre, sadrul
CC:
chromium-reviews, tfarina, tdanderson+views_chromium.org, jdduke+watch_chromium.org, tdresser+watch_chromium.org, chrome-apps-syd-reviews_chromium.org, mac-views-reviews_chromium.org, Robert Sesek
Base URL:
https://chromium.googlesource.com/chromium/src.git@20140812-MacViews-LAYERS2-PRESQUASH
Project:
chromium
Visibility:
Public.

Description

MacViews: Implement capture using NSEvent local+global monitors This allows drag&drop to work, and Menus to dismiss themselves properly. Adds a CocoaMouseCapture to encapsulate the logic to simulate ::SetCapture() from Windows APIs. "Cocoa" because it uses the cocoa APIs on NSEvent rather than Quartz APIs from CoreGraphics to intercept mouse events. (Quartz allows events sent to other applications to be suppressed as well as monitored, but we don't want that). Allows the WidgetCaptureTests in widget_interactive_test.cc to pass. One test was failing because the widget could not activate, so the code in native_widget_mac_interactive_uitest.mm that was setting the activation policy is moved to views_test_helper_mac.mm. BUG=403679 Committed: https://crrev.com/20cd5d3a1e1ff560fff0edfc736bc1ce6cd895a7 Cr-Commit-Position: refs/heads/master@{#308886}

Patch Set 1 : some nits #

Patch Set 2 : NULL -> nullptr #

Patch Set 3 : 4xWidgetCaptureTest.* green #

Patch Set 4 : events_mac change not needed #

Patch Set 5 : selfnits #

Total comments: 4

Patch Set 6 : #ifdef -> MAYBE_ #

Patch Set 7 : whoops - remove stray GetContext() #

Total comments: 2

Patch Set 8 : fix sorting #

Unified diffs Side-by-side diffs Delta from patch set Stats (+421 lines, -21 lines) Patch
M ui/views/cocoa/bridged_content_view.h View 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 2 chunks +42 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.h View 6 chunks +14 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 4 chunks +32 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_mouse_capture.h View 1 2 3 4 1 chunk +46 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_mouse_capture.mm View 1 2 3 4 1 chunk +86 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_mouse_capture_delegate.h View 1 chunk +27 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_mouse_capture_unittest.mm View 1 2 3 4 1 chunk +127 lines, -0 lines 0 comments Download
M ui/views/test/views_test_helper_mac.mm View 1 2 2 chunks +7 lines, -0 lines 0 comments Download
M ui/views/views.gyp View 1 2 3 4 5 6 7 2 chunks +4 lines, -0 lines 0 comments Download
M ui/views/widget/native_widget_mac.mm View 1 chunk +5 lines, -4 lines 0 comments Download
M ui/views/widget/native_widget_mac_interactive_uitest.mm View 1 2 1 chunk +0 lines, -9 lines 0 comments Download
M ui/views/widget/widget_interactive_uitest.cc View 1 2 3 4 5 6 3 chunks +28 lines, -8 lines 0 comments Download

Messages

Total messages: 18 (8 generated)
tapted
Hi Andre - could you take a first look? That pressedMouseButtons change in event_generator_delegate_mac.mm change ...
6 years ago (2014-12-12 07:03:32 UTC) #5
Andre
lgtm https://codereview.chromium.org/789763002/diff/140001/ui/views/cocoa/cocoa_mouse_capture_unittest.mm File ui/views/cocoa/cocoa_mouse_capture_unittest.mm (right): https://codereview.chromium.org/789763002/diff/140001/ui/views/cocoa/cocoa_mouse_capture_unittest.mm#newcode17 ui/views/cocoa/cocoa_mouse_capture_unittest.mm:17: int mouseDownCount_; Objective-C style guide says that underscore ...
6 years ago (2014-12-12 22:57:38 UTC) #6
tapted
https://codereview.chromium.org/789763002/diff/140001/ui/views/cocoa/cocoa_mouse_capture_unittest.mm File ui/views/cocoa/cocoa_mouse_capture_unittest.mm (right): https://codereview.chromium.org/789763002/diff/140001/ui/views/cocoa/cocoa_mouse_capture_unittest.mm#newcode17 ui/views/cocoa/cocoa_mouse_capture_unittest.mm:17: int mouseDownCount_; On 2014/12/12 22:57:38, Andre wrote: > Objective-C ...
6 years ago (2014-12-17 03:20:51 UTC) #8
tapted
+sadrul for OWNERS also cc rsesek in case you want to jump in. I think ...
6 years ago (2014-12-17 03:27:36 UTC) #10
Robert Sesek
LGTM. Yes, the CGEvent taps are much lower level; NSEvent is certainly easier to work ...
6 years ago (2014-12-17 15:51:46 UTC) #12
sadrul
lgtm https://codereview.chromium.org/789763002/diff/200001/ui/views/views.gyp File ui/views/views.gyp (right): https://codereview.chromium.org/789763002/diff/200001/ui/views/views.gyp#newcode37 ui/views/views.gyp:37: 'cocoa/bridged_native_widget.mm', sort
6 years ago (2014-12-17 16:22:24 UTC) #13
tapted
Thanks all! https://codereview.chromium.org/789763002/diff/200001/ui/views/views.gyp File ui/views/views.gyp (right): https://codereview.chromium.org/789763002/diff/200001/ui/views/views.gyp#newcode37 ui/views/views.gyp:37: 'cocoa/bridged_native_widget.mm', On 2014/12/17 16:22:24, sadrul wrote: > ...
6 years ago (2014-12-17 22:03:28 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/789763002/210001
6 years ago (2014-12-17 22:03:52 UTC) #16
commit-bot: I haz the power
Committed patchset #8 (id:210001)
6 years ago (2014-12-18 00:02:31 UTC) #17
commit-bot: I haz the power
6 years ago (2014-12-18 00:03:25 UTC) #18
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/20cd5d3a1e1ff560fff0edfc736bc1ce6cd895a7
Cr-Commit-Position: refs/heads/master@{#308886}

Powered by Google App Engine
This is Rietveld 408576698