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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions internal/driver/glfw/window_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,17 @@ func (w *window) getMonitorForWindow() *glfw.Monitor {

func (w *window) detectScale() float32 {
if build.IsWayland { // Wayland controls scale through content scaling
return 1.0
return 1
}
monitor := w.getMonitorForWindow()
if monitor == nil {
return 1.0
return 1
}

widthMm, _ := monitor.GetPhysicalSize()
widthMm, heightMm := monitor.GetPhysicalSize()
if runtime.GOOS == "linux" && widthMm == 60 && heightMm == 60 { // Steam Deck incorrectly reports 6cm square!
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

}
widthPx := monitor.GetVideoMode().Width

return calculateDetectedScale(widthMm, widthPx)
Expand Down