Skip to content
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

Working around missing screen dimensions for Steam Deck #4995

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

andydotxyz
Copy link
Member

And maybe more?

Fixes #4896

Results in this (not the right DPI, but not unexpected given how other software looks)

Screenshot_20240709_095130

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@Jacalz Jacalz self-requested a review July 9, 2024 08:59
@coveralls
Copy link

coveralls commented Jul 9, 2024

Coverage Status

coverage: 66.054% (+0.01%) from 66.044%
when pulling 145674c on andydotxyz:fix/4896
into f465c52 on fyne-io:develop.

Copy link
Member

@toaster toaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small things:

  • consolidate scale fallback values
  • explain “failure screen dimensions”

widthMm, _ := monitor.GetPhysicalSize()
widthMm, heightMm := monitor.GetPhysicalSize()
if widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck
return 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think the return 1 statements should look all the same. Either with or without .0. Personally, I would leave it out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think the update should cover the feedback

@@ -314,7 +314,10 @@ func (w *window) detectScale() float32 {
return 1.0
}

widthMm, _ := monitor.GetPhysicalSize()
widthMm, heightMm := monitor.GetPhysicalSize()
if widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does these 60 come from? AFAIU the GLFW source, it would return 0 if the monitor did not provide a number.
If these values are based on experience, the comment should explain this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this might result in a wrong scale for real-life 60mmx60mm displays with a huge DPI 😁.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true. If there was ever a 6cm square screen that we had to support. If that ever happens I will update this for sure!

@@ -314,7 +314,10 @@ func (w *window) detectScale() float32 {
return 1.0
}

widthMm, _ := monitor.GetPhysicalSize()
widthMm, heightMm := monitor.GetPhysicalSize()
if widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be not be protected by a runtime.GOOS == "linux" check? Maybe even !build.IsWayland from what I understand of the issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Wayland check is above and it will exit early.
Linux specific... I guess so, updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point :)

@andydotxyz andydotxyz merged commit c69fd43 into fyne-io:develop Jul 9, 2024
12 checks passed
@andydotxyz andydotxyz deleted the fix/4896 branch July 9, 2024 13:11
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.

4 participants