From 8c7eb70635206a5082f71adf9813b38ce56d84a2 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 30 Sep 2023 13:41:10 +0900 Subject: [PATCH] internal/ui: bug fix: wrong monitor was detected on fullscreen Updates #2225 Updates #2794 --- internal/ui/ui_glfw.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index cae79f51d..2a17aa095 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -1484,7 +1484,13 @@ func (u *userInterfaceImpl) currentMonitor() *Monitor { } // 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 }