From 8b565dc371b8e939d0279689b7463e544d87f5b6 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 9 Jul 2024 09:53:37 +0100 Subject: [PATCH 1/3] Working around missing screen dimensions for Steam Deck And maybe more? Fixes #4896 --- internal/driver/glfw/window_desktop.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/driver/glfw/window_desktop.go b/internal/driver/glfw/window_desktop.go index 21452ee897..2bfc06c238 100644 --- a/internal/driver/glfw/window_desktop.go +++ b/internal/driver/glfw/window_desktop.go @@ -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 + return 1 + } widthPx := monitor.GetVideoMode().Width return calculateDetectedScale(widthMm, widthPx) From 2b570120b1e587d7c097c8f1f3fa13ba6970cbf8 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 9 Jul 2024 13:03:25 +0100 Subject: [PATCH 2/3] Only protect for bug on Linux --- internal/driver/glfw/window_desktop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/driver/glfw/window_desktop.go b/internal/driver/glfw/window_desktop.go index 2bfc06c238..bcdff5dded 100644 --- a/internal/driver/glfw/window_desktop.go +++ b/internal/driver/glfw/window_desktop.go @@ -315,7 +315,7 @@ func (w *window) detectScale() float32 { } widthMm, heightMm := monitor.GetPhysicalSize() - if widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck + if runtime.GOOS == "linux" && widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck return 1 } widthPx := monitor.GetVideoMode().Width From 145674c88fa91714d27ad0d748d4c743b1ae74a2 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 9 Jul 2024 13:05:20 +0100 Subject: [PATCH 3/3] Clarity from review feedback --- internal/driver/glfw/window_desktop.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/driver/glfw/window_desktop.go b/internal/driver/glfw/window_desktop.go index bcdff5dded..9e34404217 100644 --- a/internal/driver/glfw/window_desktop.go +++ b/internal/driver/glfw/window_desktop.go @@ -307,15 +307,15 @@ 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, heightMm := monitor.GetPhysicalSize() - if runtime.GOOS == "linux" && widthMm == 60 && heightMm == 60 { // some sort of failure - mostly on Steam Deck + if runtime.GOOS == "linux" && widthMm == 60 && heightMm == 60 { // Steam Deck incorrectly reports 6cm square! return 1 } widthPx := monitor.GetVideoMode().Width