Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3d8289b

Browse files
committed
Address nits
1 parent 412c247 commit 3d8289b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ - (nonnull instancetype)initWithChannel:(nonnull FlutterBasicMessageChannel*)cha
4242

4343
/// Checks single modifier flag from event flags and sends appropriate key event
4444
/// if it is different from the previous state.
45-
- (void)checkModifierFlag:(NSUInteger)modifierFlag
46-
forEventFlags:(NSEventModifierFlags)modifierFlags
45+
- (void)checkModifierFlag:(NSUInteger)targetMask
46+
forEventFlags:(NSEventModifierFlags)eventFlags
4747
keyCode:(NSUInteger)keyCode
4848
timestamp:(NSTimeInterval)timestamp {
49-
if ((modifierFlags & modifierFlag) != (_previouslyPressedFlags & modifierFlag)) {
50-
uint64_t newFlags = (_previouslyPressedFlags & ~modifierFlag) | (modifierFlags & modifierFlag);
49+
NSAssert((targetMask & (targetMask - 1)) == 0, @"targetMask must only have one bit set");
50+
if ((eventFlags & targetMask) != (_previouslyPressedFlags & targetMask)) {
51+
uint64_t newFlags = (_previouslyPressedFlags & ~targetMask) | (eventFlags & targetMask);
5152

5253
// Sets combined flag if either left or right modifier is pressed, unsets otherwise.
5354
auto updateCombinedFlag = [&](uint64_t side1, uint64_t side2, NSEventModifierFlags flag) {

0 commit comments

Comments
 (0)