Skip to content

Commit 4b93be3

Browse files
tyvsmithclaude
authored andcommitted
docs(macos): clarify repeat-task cleanup releases the key
Address @feschber review feedback on PR #441. The repeat-task cleanup already releases the key with the correct CGKeyCode via the existing key_event call at the end of the closure — this commit just expands the surrounding comment to make that explicit and to document why update_modifiers is intentionally NOT called from this path (Mac CGKeyCode vs Linux evdev scancode collision). No behavioral change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c32d695 commit 4b93be3

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

input-emulation/src/macos.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,19 @@ impl MacOSEmulation {
106106
}
107107
}
108108
}
109-
// release key when cancelled.
109+
// Always release the key with the correct CGKeyCode, regardless of
110+
// whether the repeat loop ran. This matches @feschber's review
111+
// request: "still release the key repeat task but with the correct
112+
// code."
113+
//
110114
// Do NOT call update_modifiers here: `key` is a Mac CGKeyCode but
111115
// update_modifiers expects a Linux evdev scancode, and the two
112116
// codespaces collide (e.g. Mac LeftShift=56 == Linux KeyLeftAlt=56,
113117
// Mac Down=125 == Linux KeyLeftMeta=125), corrupting modifier
114118
// state for chords like Shift+Option+X or Cmd+Down. Modifier state
115-
// is owned by the main consume() loop, which calls update_modifiers
116-
// with the correct Linux scancode on the real release event.
119+
// is owned by the main consume() loop, which already calls
120+
// update_modifiers with the correct Linux scancode on the real key
121+
// release event from the client.
117122
key_event(event_source.clone(), key, 0, modifiers.get());
118123
});
119124
self.repeat_task = Some(repeat_task);

0 commit comments

Comments
 (0)