mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
uidriver/glfw: Bug fix compilation failure on macOS and Windows
This commit is contained in:
parent
a7d234e3c8
commit
932d599c98
@ -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
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user