Skip to content

Stop the HDR toggle echoing a live change back as a request - #124

Merged
didriksg merged 1 commit into
mainfrom
fix-hdr-toggle-echo
Sep 6, 2026
Merged

Stop the HDR toggle echoing a live change back as a request#124
didriksg merged 1 commit into
mainfrom
fix-hdr-toggle-echo

Conversation

@didriksg

@didriksg didriksg commented Sep 6, 2026

Copy link
Copy Markdown
Owner

HDRToggleView resyncs its switch from the live state on every screen-parameters notification, and every HDR flip fires one. The programmatic-change guard around that write does not hold, because SwiftUI runs onChange after the view update, by which time the flag is already reset, so each resync re-sent the value it had just read as a fresh setHDRPreference. Harmless while the toggle was the only writer, but each echo replaces the request token, and a request from anywhere else waiting out its settle at that moment is refused. Measured with crispctl's hdr set from #116: an off 0.3 s after an on was refused 4 times in 16, and 0 in 16 with this guard, which sends a request only when the switch differs from the live state. The panel toggle itself was clicked on and off with the fix in and sent exactly one request each way.

HDRToggleView resyncs its switch from the live state on every screen-parameters notification, and every HDR flip fires one. The programmatic-change guard around that write does not hold, because SwiftUI runs onChange after the view update, by which time the flag is already reset, so each resync re-sent the value it had just read as a fresh setHDRPreference. Harmless while the toggle was the only writer, since the echo carries the same value, but each echo replaces the request token, and a request from anywhere else that is waiting out its settle at that moment is refused. Measured with crispctl's hdr set from #116: an off 0.3 s after an on was refused 4 times in 16, and 0 in 16 with this guard, which sends a request only when the switch differs from the live state.
@didriksg
didriksg merged commit fbfef88 into main Sep 6, 2026
1 check passed
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.

1 participant