Repository navigation
fix(displays): keep a monitor's rotation in the layout backup - #108
Merged
Merged
Conversation
The native layout code wrote DisplayOrientation=0 for every monitor and never applied the saved value, so a monitor turned to portrait (e.g. 1080x1920 at 90 degrees) came back in landscape after restoring the desk. MultiMonitorTool saved and restored it. - LayoutEntry gets Orientation (default 0); FormatLayout writes it. - SaveLayout reads DEVMODE.dmDisplayOrientation for active monitors. - LoadLayout passes the saved orientation to QueueMode, which sets DM_DISPLAYORIENTATION only when it differs from the current one, so setups that never rotate make the same call. - A backup without the key leaves the rotation alone. Found by running the alpha against the real 1.5 config and backup of a machine with a portrait monitor: a saved-and-rewritten backup differed in exactly that one line. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes The review covered the rotation backup/restore path, related docs and changelogs, and the new serialization tests.
- Persist display rotation Save and serialize each active monitor's orientation while preserving the existing
.cfglayout format. - Restore rotation Apply the saved orientation only when it differs from the current mode, and leave rotation unchanged when older backups omit the key.
- Add coverage and manual check Verify orientation serialization and legacy backup fidelity; document the rotated-monitor hardware check.
GPT Luna | 𝕏
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.

Problem
The native layout code (1.6 alpha, #91) wrote
DisplayOrientation=0for every monitor and never applied the saved value. A monitor turned to portrait (e.g. 1080×1920 at 90°) would come back in landscape after restoring the desk. MultiMonitorTool saved and restored it.How it was found
Ran the alpha's own code (
ConsoleMode.dll, by reflection) against the real 1.5 data of a machine with a portrait monitor:StableId(3/3).backup_monitores.cfgwritten by MultiMonitorTool → parsed fine, andRemapLayoutNamesmapped the renamed\.\DISPLAYncorrectly.FormatLayout(ParseLayout(backup))vs the original file: 1 of 36 lines differed,DisplayOrientation=1became0.QueryDisplayConfigreportsrotation=1(identity) for the inactive path of that monitor, so re-enabling it gives landscape; nothing put the rotation back.Fix
LayoutEntrygetsOrientation(default 0, so existing callers compile);FormatLayoutwrites it.DisplayBackend.SaveLayoutreadsDEVMODE.dmDisplayOrientation(newNativeWindows.GetCurrentOrientation) for active monitors.LoadLayoutpasses the saved orientation toNativeDisplays.QueueMode, which setsDM_DISPLAYORIENTATIONonly when it differs from the current one: setups that never rotate make exactly the same call as before. A backup without the key leaves the rotation alone.Tests
Expected "1" / Actual "0"), green after. 147 pass.SaveLayouton the dev machine: same output as before for an unrotated screen.Not verified on hardware
Applying a rotation needs a rotatable physical monitor and changes the desktop, which I couldn't do on this machine (only a virtual display is active). Added the check to
docs/TESTING.md: monitor girado volta girado, mesma posição e resolução.🤖 Generated with Claude Code