Skip to content

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Nov 18, 2021

This PR changes RawKeyboard so that, if the current key is being pressed but does not exist in the modifier bit mask, add this key to keysPressed. This change effectively disables the assertion check immediately after _synchronizeModifiers (but it is still kept there.)

This change fixes a case on Linux where a very peculiar sequence of key presses result in an AltRight key down event being sent without the Alt modifier bit, breaking our assumption where the key being pressed must exist in the modifier bit. The approach of this PR adapts the keysPressed state to the event.

An alternative solution is to pretend this event didn't happen, adapting the event to the keysPressed state. I didn't choose this solution because it breaks RawKeyboard's design of one-to-one mapping from the native events to the Flutter events. After all, the modifier bits are used to assist synthesization, not to change event output overall.

It's a sad choice to disable this check that helped us for so long. Update: I've limited the check bypassing to Linux AltRight key.

This PR fixes one of the two symptoms of #93278.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Nov 18, 2021
@google-cla google-cla bot added the cla: yes label Nov 18, 2021
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

I think it's probably the right choice to disable it here, but would we be able to limit this change to just Linux? At least then we would be able to keep the check on other platforms.

},
),
);
}, skip: isBrowser); // [intended] This is a GLFW-specific test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it Gtk specific, not GLFW?

@dkwingsmt
Copy link
Contributor Author

Update: I've limited the check bypassing to Linux AltRight key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linux, Keyboard] Pressing AltRight-ShiftLeft repeatedly crashes the app

3 participants