fix(hotkey): never debounce a STOP, only a START#18
Merged
Conversation
The 500 ms toggle debounce was direction-agnostic: it dropped any edge
landing within 500 ms of the previous toggle. Because each Ctrl+F9 edge
toggles monitoring, the swallowed second edge of a rapid pair is ALWAYS the
STOP -- so a user who deliberately tapped START then STOP within half a
second had the STOP dropped, leaving the writers running and the CSVs growing
while they believed recording had stopped ("I stopped it and it kept
recording").
Make the debounce direction-aware: a STOP (target = OFF) is always honored;
only a START (target = ON) is debounced, which still stops a remapper / OBS /
ShadowPlay that fires Ctrl+F9 repeatedly from flapping the recording on. A
deliberate fast START->STOP now ends OFF as intended, and a spurious
double-fire nets to OFF -- its merge covers only the handful of frames in that
<500 ms window (cheap, not the 10-50 ms stall of a full session) -- rather
than leaving monitoring stuck ON.
The hotkey path lives in xrEndFrame (needs a live layer + simulated key
state), so like the rest of it it is covered by the build + review rather
than a unit test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding #7 (code review): the debounce swallows a deliberate STOP
The 500 ms toggle debounce was direction-agnostic — it dropped any Ctrl+F9 edge landing within 500 ms of the previous toggle. But each edge toggles monitoring, so the swallowed second edge of a rapid pair is always the STOP. A user who deliberately tapped START then STOP within half a second had the STOP dropped → the writers kept running and the CSVs kept growing while they believed recording had stopped ("I stopped it and it kept recording").
(There's no way to distinguish a deliberate fast double-tap from a spurious OBS double-fire by timing — they're identical inputs — so honoring the deliberate STOP necessarily means the spurious case nets to OFF too. That's the better outcome anyway.)
Fix
Make the debounce direction-aware:
target = OFF) → always honored.target = ON) → debounced (still stops a remapper/OBS/ShadowPlay firing Ctrl+F9 repeatedly from flapping the recording on).Results:
Verification
The hotkey path lives in
xrEndFrame(needs a live layer + simulated key state), so — likeMergeIntoOutputand the rest of it — it's covered by the build + review rather than a unit test. One file,layer.cpp(+33/−22); no lines >120 cols.🤖 Generated with Claude Code