Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlutterMouse.* -> kFlutterMouse.*, so we can lint header files. #46056

Merged
merged 7 commits into from
Sep 19, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
*/
typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) {
// Hover events will never be sent to Flutter.
FlutterMouseTrackingModeNone = 0,
kFlutterMouseTrackingModeNone = 0,
matanlurey marked this conversation as resolved.
Show resolved Hide resolved
FlutterMouseTrackingModeNone __attribute__((deprecated)) = kFlutterMouseTrackingModeNone,
// Hover events will be sent to Flutter when the view is in the key window.
FlutterMouseTrackingModeInKeyWindow,
kFlutterMouseTrackingModeInKeyWindow = 1,
FlutterMouseTrackingModeInKeyWindow __attribute__((deprecated)) = kFlutterMouseTrackingModeInKeyWindow,
// Hover events will be sent to Flutter when the view is in the active app.
FlutterMouseTrackingModeInActiveApp,
kFlutterMouseTrackingModeInActiveApp = 2,
FlutterMouseTrackingModeInActiveApp __attribute__((deprecated)) = kFlutterMouseTrackingModeInActiveApp,
// Hover events will be sent to Flutter regardless of window and app focus.
FlutterMouseTrackingModeAlways,
kFlutterMouseTrackingModeAlways = 3,
FlutterMouseTrackingModeAlways __attribute__((deprecated)) = kFlutterMouseTrackingModeAlways,
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down