Repository navigation
fix(windows): apply settings while all initial devices are unavailable #330
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
Open
MrRussLuther
wants to merge
3
commits into
LizardByte:master
Choose a base branch
from
MrRussLuther:fix/apply-without-initial-devices
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−3
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve the interim display layout while recovery is pending. With every original device absent and no built-in panel,
EnsureOnlyDisplaycan now split a temporary clone group. The savedm_initialstill describes the absent layout, so the failed revert falls back to extending every enumerated display. I reproduced this with[["stream","clone"]]and one inactive output. Apply succeeded, then disconnect left[["stream"],["clone"],["inactive"]]with the original recovery still pending.Add this at the start of
if (change_is_needed)inprepareTopology(), before reverting previous settings or switching topology.In
tests/unit/windows/test_settings_manager_undock.cpp, use the layout above to check that applyingEnsureOnlyDisplaytostreamleaves the clone group intact and recovery pending. The existing single-display regression verifies that the same request still applies the requested mode when the active topology already matches.Review completed by Codex | Model: gpt-6.2-sol | Thinking: xhigh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. The interim layout isn't recorded anywhere, so there's nothing to put it back from. Done in 8351756: a topology change is refused while all the original devices are away, and mode/HDR changes within the active topology still go through.
I put the check in a small helper (
isTopologyChangeBlocked) and call it just beforeif (change_is_needed)instead of inside it. Inline, it adds 3 toprepareTopology()(a nestedifplus the&&), which takes it from 24 to 27, over Sonar's cognitive complexity limit of 25. As a top-level call it adds 1.Added
UndockRecovery.TopologyIsNotSwitchedWhileRecoveryIsPendingwith your layout. It fails on the previous commit (apply returnsOkand leaves[["stream"]]) and passes now. 287 mocked and undock tests pass here.One thing I noticed while testing: with the guard the apply is refused and the clone group survives, but a
revertSettings()afterwards still ends at[["stream"],["clone"],["inactive"]]. The topology guard inrevertSettings()extends every enumerated display whenever the revert fails, and Sunshine (2026.914 at least) calls revert on disconnect even after a failed apply. This PR doesn't touch that path, so I left it alone, but I can look at it in the follow-up if you want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Russ. I checked the rebased head (
013e7f0): the apply guard and clone-group regression address the apply-side finding, and mode/HDR changes can still proceed when the topology already matches.Yes, please take the disconnect behavior in a separate follow-up.
revertSettings()can still use a fully extended topology when recovery fails, even if apply left the layout alone. A regression test could start with the original monitors absent, an active[["stream", "clone"]]group, and a third inactive output. After a refused apply and a call torevertSettings(), assert that the clone group stays intact, the third output stays inactive, and the saved recovery stays pending. Then reconnect the originals and check that the original layout is restored. Please compare the clone groups explicitly, not just the set of active IDs.I checked the source, not a live Windows setup. This follow-up doesn’t require changing whether Sunshine saves temporary layouts in #5942.
Review completed by Codex | Model: unavailable | Thinking: unavailable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking the rebased head. I'll leave the
revertSettings()disconnect behavior out of this PR. It comes from the same cause as #5942, a saved record that disagrees with the displays that are connected, so I'd rather fix it there than patch the revert path on its own. I'll use your scenario as the regression test: the originals absent, an active[["stream", "clone"]]group with a third output inactive, a refused apply, thenrevertSettings(). It will compare the clone groups explicitly and check that the originals' layout comes back when they return.