[MacOS] Accept first mouse-down (flutter/engine#34093)

This commit is contained in:
Alex Wood
2022-06-23 13:21:04 -07:00
committed by GitHub
parent b2861bd9b7
commit 8269c91886
2 changed files with 14 additions and 0 deletions

View File

@@ -98,6 +98,14 @@
return YES;
}
/**
* Declares that the initial mouse-down when the view is not in focus will send an event to the
* view.
*/
- (BOOL)acceptsFirstMouse:(NSEvent*)event {
return YES;
}
- (BOOL)acceptsFirstResponder {
return YES;
}

View File

@@ -72,6 +72,12 @@ TEST(FlutterViewController, HasViewThatHidesOtherViewsInAccessibility) {
EXPECT_EQ(accessibilityChildren[0], viewControllerMock.flutterView);
}
TEST(FlutterViewController, FlutterViewAcceptsFirstMouse) {
FlutterViewController* viewControllerMock = CreateMockViewController();
[viewControllerMock loadView];
EXPECT_EQ([viewControllerMock.flutterView acceptsFirstMouse:nil], YES);
}
TEST(FlutterViewController, ReparentsPluginWhenAccessibilityDisabled) {
FlutterEngine* engine = CreateTestEngine();
NSString* fixtures = @(testing::GetFixturesPath());