diff --git a/internal/ui/monitor_glfw.go b/internal/ui/monitor_glfw.go index a6ef7b57b..8a3546598 100644 --- a/internal/ui/monitor_glfw.go +++ b/internal/ui/monitor_glfw.go @@ -28,13 +28,11 @@ import ( type Monitor struct { m *glfw.Monitor vm *glfw.VidMode - // Pos of monitor in virtual coords - x int - y int - width int - height int - id int - name string + + id int + name string + x int + y int } // Name returns the monitor's name. @@ -91,16 +89,13 @@ func (m *monitors) update() { newMonitors := make([]*Monitor, 0, len(glfwMonitors)) for i, m := range glfwMonitors { x, y := m.GetPos() - vm := m.GetVideoMode() newMonitors = append(newMonitors, &Monitor{ - m: m, - vm: m.GetVideoMode(), - x: x, - y: y, - width: vm.Width, - height: vm.Height, - name: m.GetName(), - id: i, + m: m, + vm: m.GetVideoMode(), + id: i, + name: m.GetName(), + x: x, + y: y, }) } diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index d8438dd3a..21d173c62 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -307,8 +307,8 @@ func (u *userInterfaceImpl) setWindowMonitor(monitor *Monitor) { w := u.dipToGLFWPixel(float64(ww), monitor.m) h := u.dipToGLFWPixel(float64(wh), monitor.m) x, y := monitor.x, monitor.y - mw := u.dipFromGLFWMonitorPixel(float64(monitor.width), monitor.m) - mh := u.dipFromGLFWMonitorPixel(float64(monitor.height), monitor.m) + mw := u.dipFromGLFWMonitorPixel(float64(monitor.vm.Width), monitor.m) + mh := u.dipFromGLFWMonitorPixel(float64(monitor.vm.Height), monitor.m) mw = u.dipToGLFWPixel(mw, monitor.m) mh = u.dipToGLFWPixel(mh, monitor.m) px, py := InitialWindowPosition(int(mw), int(mh), int(w), int(h))