Display: fixes scale calculation for displays rotated 90 or 270 degrees#2224
Closed
bnfour wants to merge 1 commit intofastfetch-cli:devfrom
Closed
Display: fixes scale calculation for displays rotated 90 or 270 degrees#2224bnfour wants to merge 1 commit intofastfetch-cli:devfrom
bnfour wants to merge 1 commit intofastfetch-cli:devfrom
Conversation
This makes the scale calculations swap display's width and height for rotated displays for correct results.
Member
|
Thanks for reporting! I'll come up with a better solution, I think. |
Author
|
Sure! Code in this pull is really more of a proof-of-concept, done in a few hours — I just searched the code for the issue source and tried to fix it myself, "tried" being the operative word here. Should I close this pull and open an issue instead? |
Member
|
Please test 37b8bb4 |
Author
This commit fixes the scale value in both cases I originally mentioned. |
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
This makes the scale calculations swap display's width and height for rotated displays for correct results.
The issue
The scale calculation always uses display's native height. This leads for issues for rotated displays. For example, my display setup is the following:

All displays are set to their native 1× scale, yet fastfetch reports the rotated one having 0.56×, as its scaled size is 1080×1920, and the scale is calculated as original height (1080) over scaled height (1920):
I've also tested this on my laptop's display 1920×1080 with 1.25× scaling enabled (scaled size 1536×864): if the screen is rotated, the reported scale is 0.7× (1080/1536).
The solution
Note: this change only applies to the default non-compact mode.
With my patch applied, the scale display is correct:
The resolution display is also changed to show the rotation (this part is probably optional, let me know what you think).
Related issue (required for new logos for new distros)
None, I went straight for a pull.
Changes
Checklist
I'm not really a C dev, so I'd be grateful for any feedback.