diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 19fb2e488..73c42e42a 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -30,19 +30,20 @@ import ( ) type userInterface struct { - window *glfw.Window - width int - height int - scale float64 - deviceScale float64 - glfwScale float64 - fullscreen bool - funcs chan func() - running bool - sizeChanged bool - origPosX int - origPosY int - m sync.Mutex + window *glfw.Window + width int + height int + scale float64 + deviceScale float64 + glfwScale float64 + fullscreen bool + fullscreenScale float64 + funcs chan func() + running bool + sizeChanged bool + origPosX int + origPosY int + m sync.Mutex } var currentUI *userInterface @@ -243,6 +244,20 @@ func (u *userInterface) actualScreenScale() float64 { if u.deviceScale == 0 { u.deviceScale = deviceScale() } + if u.fullscreen { + if u.fullscreenScale == 0 { + m := glfw.GetPrimaryMonitor() + v := m.GetVideoMode() + sw := float64(v.Width) / float64(u.width) + sh := float64(v.Height) / float64(u.height) + s := sw + if s > sh { + s = sh + } + u.fullscreenScale = s + } + return u.fullscreenScale * u.deviceScale + } return u.scale * u.deviceScale }