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

Remove spurious ControlLeft-key when AltRight is pressed under Windows #1144

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

chschnell
Copy link
Contributor

Remove ControlLeft from keyboard input sequence ControlLeft + AltRight if platform is Windows and AltRight is pressed.

See issue #1127 for more details.

Remove ControlLeft from keyboard input sequence ControlLeft + AltRight if platform is Windows and AltRight is pressed.
@chschnell chschnell changed the title Update keyboard.js Remove spurious ControlLeft-key when AltRight is pressed under Windows Aug 30, 2024
Replaced logical expression for better clairty.
deferred_timeout_id = setTimeout(() => {
send_to_controller(deferred_code);
deferred_code = 0;
}, 10);
Copy link
Owner

Choose a reason for hiding this comment

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

I think this logic should be moved earlier in the chain, into handler before translate. That way we don't have to pass through the event object, keys_pressed doesn't get infected, and we can use e.code === "AltLeft" directly.

Copy link
Contributor Author

@chschnell chschnell Sep 3, 2024

Choose a reason for hiding this comment

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

I changed it, much less intrusive now. I made sure that the remaining parts of the call chain are all reverted back to their current form in master.

Moved filter mechanics into function handler().
Split handler() into two function, the upper half up until translate() remained in handler(), the rest moved into new function handle_event().
Changed from scancode-based key detection to KeyboardEvent.code.
Made the global const WINDOWS_PLATFORM uppercase.
@copy copy merged commit 3c77b98 into copy:master Sep 3, 2024
3 checks passed
@copy
Copy link
Owner

copy commented Sep 3, 2024

Thanks!

@chschnell chschnell deleted the patch-keyboard-altgr-win branch September 3, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants