diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index 0832226f9..4405427e9 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -1103,7 +1103,7 @@ func currentMonitor(window *glfw.Window) *glfw.Monitor { // Getting a monitor from a window position is not reliable in general (e.g., when a window is put across // multiple monitors, or, before SetWindowPosition is called.). // Get the monitor which the current window belongs to. This requires OS API. - if m := currentMonitorByOS(); m != nil { + if m := currentMonitorByOS(window); m != nil { return m } diff --git a/internal/uidriver/glfw/ui_darwin.go b/internal/uidriver/glfw/ui_darwin.go index 7980a17e2..4366b90dd 100644 --- a/internal/uidriver/glfw/ui_darwin.go +++ b/internal/uidriver/glfw/ui_darwin.go @@ -55,7 +55,7 @@ func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) { return x, y } -func currentMonitorByOS() *glfw.Monitor { +func currentMonitorByOS(w *glfw.Window) *glfw.Monitor { x := C.int(0) y := C.int(0) // Note: [NSApp mainWindow] is nil when it doesn't have its border. Use w here. diff --git a/internal/uidriver/glfw/ui_unix.go b/internal/uidriver/glfw/ui_unix.go index 3eb365026..15d5d8788 100644 --- a/internal/uidriver/glfw/ui_unix.go +++ b/internal/uidriver/glfw/ui_unix.go @@ -32,7 +32,7 @@ func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) { return x, y } -func currentMonitorByOS() *glfw.Monitor { +func currentMonitorByOS(_ *glfw.Window) *glfw.Monitor { // TODO: Implement this correctly. (#1119). return nil } diff --git a/internal/uidriver/glfw/ui_windows.go b/internal/uidriver/glfw/ui_windows.go index 89f1b974d..f8fcd6b85 100644 --- a/internal/uidriver/glfw/ui_windows.go +++ b/internal/uidriver/glfw/ui_windows.go @@ -104,7 +104,7 @@ func (u *UserInterface) glfwScale() float64 { } func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) { - mx, my := u.currentMonitor().GetPos() + mx, my := currentMonitor(u.window).GetPos() // As the video width/height might be wrong, // adjust x/y at least to enable to handle the window (#328) if x < mx { @@ -120,7 +120,7 @@ func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) { return x, y } -func currentMonitorByOS() *glfw.Monitor { +func currentMonitorByOS(_ *glfw.Window) *glfw.Monitor { // TODO: Should we return nil here? w, err := getActiveWindow() if err != nil {