-
Notifications
You must be signed in to change notification settings - Fork 6k
Add mouse button support to the macOS shell #9054
Add mouse button support to the macOS shell #9054
Conversation
Uses the new embedding API support for device type and buttons to pass appropriate mouse button events, allowing for right click, middle click, etc. Also fixes some edge cases where macOS event delivery violated Flutter requirements by tracking more data about the mouse event stream and adjusting the sent events as necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for comments
shell/platform/darwin/macos/framework/Source/FLEViewController.mm
Outdated
Show resolved
Hide resolved
* is released. If it was released inside the view, mouseEntered: is sent the next time the mouse | ||
* moves. Flutter doesn't expect to receive events after a kRemove, so the kRemove for the exit | ||
* needs to be delayed until after the last mouse button is released. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if my understanding is correct:
- If a mouse is pressed in the tracking area, then dragged out (and keeps moving), Cocoa will keep sending drag events with out-of-area positions.
- If the mouse is then dragged back in without releasing buttons, it will send a mouseEntered while keeping sending drag events.
If the statements above are correct,
- Should we stop sending drag events with out-of-area positions to Flutter, since they should be considered illegal data? Also perhaps to accommodate shells that can not detect out-of-area moves.
- Should we set
_mouseState.has_pending_exit
tofalse
inmouseEntered:
, so that the "drag back in" action is considered a normal drag and does not triggerReset
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a mouse is pressed in the tracking area, then dragged out (and keeps moving), Cocoa will keep sending drag events with out-of-area positions.
Yes.
If the mouse is then dragged back in without releasing buttons, it will send a mouseEntered while keeping sending drag events.
No, there's no mouseEntered; it's weirdly asymmetrical. (In that scenario, you don't get the mouseEntered until the next time you move the mouse after releasing the button.)
Should we stop sending drag events with out-of-area positions to Flutter
Let's revisit this later, since the patch isn't changing that behavior and we'll need to carefully think about what exactly the right behavior is in the context of yet-to-be-designed functionality like drag-and-drop from Flutter to other apps. (It's not as simple as just not sending events, because we don't want to drop the pointer if Flutter knows a drag is happening in that scenario, but we also don't want, say, an in-window drop target at the edge of the window to stay highlighted.)
Should we set _mouseState.has_pending_exit to false in mouseEntered:
No (per answer 2 above)
…/engine into macos-mouse-buttons
flutter/engine@8dc3a4c...4c4c0f8 git log 8dc3a4c..4c4c0f8 --no-merges --oneline 4c4c0f8 Add plugin shim to facilitate old plugins in new embedding (#33478). (flutter/engine#9120) e8c2b17 Added support for transparent FlutterActivitys (#32740). (flutter/engine#9115) 19c5029 Roll src/third_party/skia 29e013deb476..1013ecfb3421 (3 commits) (flutter/engine#9130) 45d39e1 Revert "Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (#9127)" (flutter/engine#9135) 44f1b44 Revert "Use track-widget-creation transformer included in the sdk. (#9085)" (flutter/engine#9134) ae14c5a Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter/engine#9127) 3ea7ac8 Roll src/third_party/skia 633db4db7672..29e013deb476 (3 commits) (flutter/engine#9128) 8ad0e2f Roll src/third_party/skia 25b63f91b3b4..633db4db7672 (4 commits) (flutter/engine#9125) 37e6e0c Roll src/third_party/skia 8f88b2da05d5..25b63f91b3b4 (2 commits) (flutter/engine#9121) 37b367e Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter/engine#9113) 28f2c05 Roll src/third_party/skia 1f02e8488551..8f88b2da05d5 (3 commits) (flutter/engine#9116) 0932008 Remove outdated TODOs (flutter/engine#9114) c880ca2 Roll src/third_party/dart 50b0d85804..fee615c5a5 (4 commits) 6e51513 Removing unused imports (flutter/engine#9108) 9ee2697 Roll src/third_party/skia d04aaa3a841a..1f02e8488551 (8 commits) (flutter/engine#9109) fa2e2d9 Add checks to constructors and add missing constructor members (flutter/engine#9106) 7e1788a Fix unopt variants of profile and release builds. (flutter/engine#9107) 867120c Better help message. (flutter/engine#9097) e27c6e8 Forward custom IDE flags to GN. (flutter/engine#9023) 6b4ca8d Roll src/third_party/skia 176b214f91bc..d04aaa3a841a (7 commits) (flutter/engine#9105) a207318 Roll src/third_party/dart ec4d48e241..50b0d85804 (87 commits) 0a6aeb3 Roll src/third_party/skia 213aa46af167..176b214f91bc (2 commits) (flutter/engine#9100) f2e22aa Roll src/third_party/skia 7730d7cb8fb2..213aa46af167 (3 commits) (flutter/engine#9098) 557db42 Roll src/third_party/skia de7e074e8190..7730d7cb8fb2 (2 commits) (flutter/engine#9096) 64a4a0e Roll src/third_party/skia f06b6d5469a5..de7e074e8190 (1 commits) (flutter/engine#9094) fdee625 Roll src/third_party/skia 7e5a64f517e4..f06b6d5469a5 (2 commits) (flutter/engine#9093) daf47f0 Roll src/third_party/skia dc01a84ae098..7e5a64f517e4 (1 commits) (flutter/engine#9092) 41e10f0 Fix internal break since listing contents can return null (flutter/engine#9078) cf1b203 Roll src/third_party/skia f33c95cd6f55..dc01a84ae098 (3 commits) (flutter/engine#9091) 2404cdc Rename macOS FLEPlugin* to FlutterPlugin* (flutter/engine#9074) 509a43f Apply minor cleanups to Android embedding (flutter/engine#9088) 0a0f330 Removed outdated deprecation comments (flutter/engine#9087) a44cbbf Delete BSDiff sources (flutter/engine#9086) 0f1ff3b Correct typos, adopt US spellings (flutter/engine#9081) 651c904 Use track-widget-creation transformer included in the sdk. (flutter/engine#9085) cfa524f New Plugin API PR4: Adds Lifecycle support to the new plugin system. (flutter/engine#9049) 6b8ac18 Roll src/third_party/skia d9430297e74a..f33c95cd6f55 (5 commits) (flutter/engine#9082) 11408ef Update macOS podspec version requirement (flutter/engine#9077) 66c6ae4 Roll src/third_party/skia a4b837971c4b..d9430297e74a (30 commits) (flutter/engine#9080) 9151b37 Roll src/third_party/skia 9339a8a61af0..a4b837971c4b (34 commits) (flutter/engine#9076) ee6a9c4 Fix unchecked operation warnings in FlutterMain (flutter/engine#9073) 333042c Roll third_party/dart/tools/sdks to 2.3.0 (flutter/engine#9072) 01b8c07 Roll src/third_party/skia f77dbd04b926..9339a8a61af0 (12 commits) (flutter/engine#9065) 26b4fb5 Roll src/third_party/dart e3edfd36b2..ec4d48e241 (7 commits) 9d2d58a Add mouse button support to the macOS shell (flutter/engine#9054) ...
Uses the new embedding API support for device type and buttons to pass appropriate mouse button events, allowing for right click, middle click, etc. Also fixes some edge cases where macOS event delivery violated Flutter requirements by tracking more data about the mouse event stream and adjusting the sent events as necessary.
flutter/engine@8dc3a4c...4c4c0f8 git log 8dc3a4c..4c4c0f8 --no-merges --oneline 4c4c0f8 Add plugin shim to facilitate old plugins in new embedding (flutter#33478). (flutter/engine#9120) e8c2b17 Added support for transparent FlutterActivitys (flutter#32740). (flutter/engine#9115) 19c5029 Roll src/third_party/skia 29e013deb476..1013ecfb3421 (3 commits) (flutter/engine#9130) 45d39e1 Revert &flutter#34;Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter#9127)&flutter#34; (flutter/engine#9135) 44f1b44 Revert &flutter#34;Use track-widget-creation transformer included in the sdk. (flutter#9085)&flutter#34; (flutter/engine#9134) ae14c5a Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter/engine#9127) 3ea7ac8 Roll src/third_party/skia 633db4db7672..29e013deb476 (3 commits) (flutter/engine#9128) 8ad0e2f Roll src/third_party/skia 25b63f91b3b4..633db4db7672 (4 commits) (flutter/engine#9125) 37e6e0c Roll src/third_party/skia 8f88b2da05d5..25b63f91b3b4 (2 commits) (flutter/engine#9121) 37b367e Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter/engine#9113) 28f2c05 Roll src/third_party/skia 1f02e8488551..8f88b2da05d5 (3 commits) (flutter/engine#9116) 0932008 Remove outdated TODOs (flutter/engine#9114) c880ca2 Roll src/third_party/dart 50b0d85804..fee615c5a5 (4 commits) 6e51513 Removing unused imports (flutter/engine#9108) 9ee2697 Roll src/third_party/skia d04aaa3a841a..1f02e8488551 (8 commits) (flutter/engine#9109) fa2e2d9 Add checks to constructors and add missing constructor members (flutter/engine#9106) 7e1788a Fix unopt variants of profile and release builds. (flutter/engine#9107) 867120c Better help message. (flutter/engine#9097) e27c6e8 Forward custom IDE flags to GN. (flutter/engine#9023) 6b4ca8d Roll src/third_party/skia 176b214f91bc..d04aaa3a841a (7 commits) (flutter/engine#9105) a207318 Roll src/third_party/dart ec4d48e241..50b0d85804 (87 commits) 0a6aeb3 Roll src/third_party/skia 213aa46af167..176b214f91bc (2 commits) (flutter/engine#9100) f2e22aa Roll src/third_party/skia 7730d7cb8fb2..213aa46af167 (3 commits) (flutter/engine#9098) 557db42 Roll src/third_party/skia de7e074e8190..7730d7cb8fb2 (2 commits) (flutter/engine#9096) 64a4a0e Roll src/third_party/skia f06b6d5469a5..de7e074e8190 (1 commits) (flutter/engine#9094) fdee625 Roll src/third_party/skia 7e5a64f517e4..f06b6d5469a5 (2 commits) (flutter/engine#9093) daf47f0 Roll src/third_party/skia dc01a84ae098..7e5a64f517e4 (1 commits) (flutter/engine#9092) 41e10f0 Fix internal break since listing contents can return null (flutter/engine#9078) cf1b203 Roll src/third_party/skia f33c95cd6f55..dc01a84ae098 (3 commits) (flutter/engine#9091) 2404cdc Rename macOS FLEPlugin* to FlutterPlugin* (flutter/engine#9074) 509a43f Apply minor cleanups to Android embedding (flutter/engine#9088) 0a0f330 Removed outdated deprecation comments (flutter/engine#9087) a44cbbf Delete BSDiff sources (flutter/engine#9086) 0f1ff3b Correct typos, adopt US spellings (flutter/engine#9081) 651c904 Use track-widget-creation transformer included in the sdk. (flutter/engine#9085) cfa524f New Plugin API PR4: Adds Lifecycle support to the new plugin system. (flutter/engine#9049) 6b8ac18 Roll src/third_party/skia d9430297e74a..f33c95cd6f55 (5 commits) (flutter/engine#9082) 11408ef Update macOS podspec version requirement (flutter/engine#9077) 66c6ae4 Roll src/third_party/skia a4b837971c4b..d9430297e74a (30 commits) (flutter/engine#9080) 9151b37 Roll src/third_party/skia 9339a8a61af0..a4b837971c4b (34 commits) (flutter/engine#9076) ee6a9c4 Fix unchecked operation warnings in FlutterMain (flutter/engine#9073) 333042c Roll third_party/dart/tools/sdks to 2.3.0 (flutter/engine#9072) 01b8c07 Roll src/third_party/skia f77dbd04b926..9339a8a61af0 (12 commits) (flutter/engine#9065) 26b4fb5 Roll src/third_party/dart e3edfd36b2..ec4d48e241 (7 commits) 9d2d58a Add mouse button support to the macOS shell (flutter/engine#9054) ...
Uses the new embedding API support for device type and buttons to pass
appropriate mouse button events, allowing for right click, middle click,
etc.
Also fixes some edge cases where macOS event delivery violated Flutter
requirements by tracking more data about the mouse event stream and
adjusting the sent events as necessary.