diff --git a/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h b/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h index b0d7a9f8bd86e..3a28e94a85631 100644 --- a/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h @@ -14,13 +14,26 @@ */ typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) { // Hover events will never be sent to Flutter. - FlutterMouseTrackingModeNone = 0, + kFlutterMouseTrackingModeNone = 0, + // NOLINTNEXTLINE(readability-identifier-naming) + FlutterMouseTrackingModeNone __attribute__((deprecated)) = kFlutterMouseTrackingModeNone, + // Hover events will be sent to Flutter when the view is in the key window. - FlutterMouseTrackingModeInKeyWindow, + kFlutterMouseTrackingModeInKeyWindow = 1, + // NOLINTNEXTLINE(readability-identifier-naming) + FlutterMouseTrackingModeInKeyWindow + __attribute__((deprecated)) = kFlutterMouseTrackingModeInKeyWindow, + // Hover events will be sent to Flutter when the view is in the active app. - FlutterMouseTrackingModeInActiveApp, + kFlutterMouseTrackingModeInActiveApp = 2, + // NOLINTNEXTLINE(readability-identifier-naming) + FlutterMouseTrackingModeInActiveApp + __attribute__((deprecated)) = kFlutterMouseTrackingModeInActiveApp, + // Hover events will be sent to Flutter regardless of window and app focus. - FlutterMouseTrackingModeAlways, + kFlutterMouseTrackingModeAlways = 3, + // NOLINTNEXTLINE(readability-identifier-naming) + FlutterMouseTrackingModeAlways __attribute__((deprecated)) = kFlutterMouseTrackingModeAlways, }; /** diff --git a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm index 62d81dbaa43bd..5c22fe6c01d71 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm @@ -400,7 +400,7 @@ static void CommonInit(FlutterViewController* controller, FlutterEngine* engine) @"In unit tests, this is likely because either the FlutterViewController or " @"the FlutterEngine is mocked. Please subclass these classes instead.", controller.engine, controller.viewId); - controller->_mouseTrackingMode = FlutterMouseTrackingModeInKeyWindow; + controller->_mouseTrackingMode = kFlutterMouseTrackingModeInKeyWindow; controller->_textInputPlugin = [[FlutterTextInputPlugin alloc] initWithViewController:controller]; [controller initializeKeyboard]; [controller notifySemanticsEnabledChanged]; @@ -642,17 +642,17 @@ - (void)configureTrackingArea { // the view is actually loaded. return; } - if (_mouseTrackingMode != FlutterMouseTrackingModeNone && self.flutterView) { + if (_mouseTrackingMode != kFlutterMouseTrackingModeNone && self.flutterView) { NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingEnabledDuringMouseDrag; switch (_mouseTrackingMode) { - case FlutterMouseTrackingModeInKeyWindow: + case kFlutterMouseTrackingModeInKeyWindow: options |= NSTrackingActiveInKeyWindow; break; - case FlutterMouseTrackingModeInActiveApp: + case kFlutterMouseTrackingModeInActiveApp: options |= NSTrackingActiveInActiveApp; break; - case FlutterMouseTrackingModeAlways: + case kFlutterMouseTrackingModeAlways: options |= NSTrackingActiveAlways; break; default: diff --git a/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm index 1628aa004ef4d..eb28a5b786ad5 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm @@ -195,8 +195,8 @@ id MockGestureEvent(NSEventType type, NSEventPhase phase, double magnification, initWithAssetsPath:fixtures ICUDataPath:[fixtures stringByAppendingString:@"/icudtl.dat"]]; FlutterViewController* viewController = [[FlutterViewController alloc] initWithProject:project]; - viewController.mouseTrackingMode = FlutterMouseTrackingModeInActiveApp; - ASSERT_EQ(viewController.mouseTrackingMode, FlutterMouseTrackingModeInActiveApp); + viewController.mouseTrackingMode = kFlutterMouseTrackingModeInActiveApp; + ASSERT_EQ(viewController.mouseTrackingMode, kFlutterMouseTrackingModeInActiveApp); } TEST(FlutterViewControllerTest, TestKeyEventsAreSentToFramework) {