Fix display mode restoration for rotated monitors - #34
Open
Samuel-Georgiev wants to merge 1 commit into
Open
Samuel-Georgiev wants to merge 1 commit into
Samuel-Georgiev wants to merge 1 commit into
Conversation
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.
Summary
Fixes resolution and refresh rate not always being restored correctly after a display topology change.
Saved display modes are now reapplied after the topology is restored. Displays are matched using their adapter/target IDs, and 90°/270° rotations are accounted for when applying the resolution.
The rotation handling fixes a case where Windows expects the dimensions to be swapped after a display is rotated. For example, restoring
1920x1080@165on a 270° display returnedDISP_CHANGE_BADMODE (-2), while1080x1920@165applied successfully.This overlaps with #31, which restores the refresh rate for newly enabled displays during staged profile application. This approach restores the saved mode for all enabled displays after the topology change, while also handling rotated displays and avoiding reliance on
DISPLAY1/DISPLAY2numbering.Tested across repeated profile switches with multiple resolutions, refresh rates, and display orientations.