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

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Oct 27, 2022

Description

This PR adds a check to avoid Shift + AltLeft throwing an exception on Linux.
The issue occurs because Shift + AltLeft is usually configured to be MetaLeft key.
The exception is thrown because the GDK event received by the engine code has its keyval pointing to MetaLeft but its keycode pointing to either Shift or Alt (depending on which was last pressed). As engine code use keycode to lookup the physical key and keyval to lookup the logical key, this results in a FlutterKeyEvent with a mismatch between logical and physical keys which leads to wrong key event being sent.

Implementation

The fix here relies on two steps:

  • for each key event, check if the physical key (deduced from the keycode) is the same as one of the known modifier primary physical key.
  • if it is, use the logical key (deduced from the keyval) to get the right physical key.

Related Issue

Fixes flutter/flutter#96082

Tests

Adds 1 tests

Copy link
Contributor

@dkwingsmt dkwingsmt left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 29, 2022
@auto-submit auto-submit bot merged commit f24c687 into flutter:main Oct 29, 2022
@bleroux bleroux deleted the fix_linux_shift_alt_left_throws branch October 29, 2022 03:54
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 29, 2022
schwa423 pushed a commit to schwa423/engine that referenced this pull request Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-linux

Projects

None yet

2 participants