Apply suggestions from code review

Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
Eberhard Beilharz 2025-12-15 15:44:42 +01:00 • committed by GitHub
parent 1b04772bb9
commit 4d644cd00e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -172,7 +172,11 @@ export class InputProcessor {
// The default OSK layout for desktop devices does not include nextlayer info, relying on
// modifier detection here.
// It's the OSK equivalent to doModifierPress on 'desktop' form factors.
if ((formFactor == DeviceSpec.FormFactor.Desktop || !this.activeKeyboard || (this.activeKeyboard instanceof JSKeyboard && this.activeKeyboard.usesDesktopLayoutOnDevice(keyEvent.device))) && keyEvent.isSynthetic) {
if ((formFactor == DeviceSpec.FormFactor.Desktop || !this.activeKeyboard ||
(this.activeKeyboard instanceof JSKeyboard &&
this.activeKeyboard.usesDesktopLayoutOnDevice(keyEvent.device))) &&
keyEvent.isSynthetic
) {
// If it's a desktop OSK style and this triggers a layer change,
// a modifier key was clicked. No output expected, so it's safe to instantly exit.
if (this.keyboardProcessor.selectLayer(keyEvent)) {
@ -182,7 +186,8 @@ export class InputProcessor {
// Will handle keystroke-based non-layer change modifier & state keys, mapping them through
// the physical keyboard's version of state management. `doModifierPress` must always run.
if (this.keyboardProcessor.doModifierPress(keyEvent, textStore, !keyEvent.isSynthetic) && !keyEvent.isSynthetic) {
const wasModifierPress = this.keyboardProcessor.doModifierPress(keyEvent, textStore, !keyEvent.isSynthetic);
if (wasModifierPress && !keyEvent.isSynthetic) {
// If run on a desktop platform, we know that modifier & state key presses may not
// produce output, so we may make an immediate return safely.
return new ProcessorAction();