uidriver/glfw: Bug fix compilation failure on macOS and Windows

This commit is contained in:
Hajime Hoshi 2020-08-24 03:31:46 +09:00
parent a7d234e3c8
commit 932d599c98
4 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -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.

View File

@ -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
}

View File

@ -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 {