internal/ui: bug fix: wrong monitor was detected on fullscreen

Updates #2225
Updates #2794
This commit is contained in:
Hajime Hoshi 2023-09-30 13:41:10 +09:00
parent 22118ba962
commit 8c7eb70635

View File

@ -1484,7 +1484,13 @@ func (u *userInterfaceImpl) currentMonitor() *Monitor {
} }
// As the fallback, detect the monitor from the window. // As the fallback, detect the monitor from the window.
if m := theMonitors.monitorFromPosition(u.window.GetPos()); m != nil { x, y := u.window.GetPos()
// On fullscreen, shift the position slightly. Otherwise, a wrong monitor could be detected, as the position is on the edge (#2794).
if u.isFullscreen() {
x++
y++
}
if m := theMonitors.monitorFromPosition(x, y); m != nil {
return m return m
} }