Skip to content

fix(windows): recover display layout after undocking - #298

Open
jdvmi00 wants to merge 4 commits into
LizardByte:masterfrom
jdvmi00:fix/laptop-undock
Open

fix(windows): recover display layout after undocking#298
jdvmi00 wants to merge 4 commits into
LizardByte:masterfrom
jdvmi00:fix/laptop-undock

Conversation

@jdvmi00

@jdvmi00 jdvmi00 commented Sep 6, 2026

Copy link
Copy Markdown

Description

I ran into this while using Sunshine with a docked Windows laptop, lid closed, and a virtual display selected with ensure_only_display. Unplugging the dock during a stream and then disconnecting leaves the original monitor unavailable. Opening the lid turns the panel on, but the virtual display stays enabled and the old recovery state keeps being retried.

This lets restoration fall back to surviving original displays, or a built-in panel if none remain. It checks that the replacement is active before removing displays enabled by the session, and only clears the recovery state after verifying the final layout. With the lid closed and no physical display available, recovery stays pending.

There was a second part to the same repro: the streaming layout became Windows' saved docked layout, so redocking brought back the virtual display instead of the external monitor. WinDisplayDevice now has an optional save_to_database argument so callers can make temporary CCD changes. The default stays unchanged. The companion Sunshine change is LizardByte/Sunshine#5625.

Testing:

  • 103 common tests pass on the current master base.
  • 431 tests pass on Windows with the current PR sources, including all 11 undock recovery tests and the saved/temporary display tests. The runner skips 10 hardware-only tests; two existing tests are disabled: build and report.
  • The release-based trial passed the Windows library and Sunshine suites, including the new regression tests. Hardware-only tests were skipped on the runner: build and reports.
  • The original recovery code fails the undock regression in that trial; the patched code passes.
  • Tested the full docked stream → unplug with lid closed → disconnect → open lid → redock sequence on the laptop. The panel recovered, the virtual display turned off, recovery state cleared, and redocking restored the external monitor. QDC_DATABASE_CURRENT also confirmed the saved docked layout stayed unchanged while streaming.

The hardware trial used Sunshine v2026.516.143833. This PR ports those changes to current master. The Windows run above is in my fork; upstream Actions still need maintainer approval to run.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@CLAassistant

CLAassistant commented Sep 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

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.

2 participants