From 294ee4371637d6f9ed635f39c0aecb868d28c8ec Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 8 Feb 2022 01:29:20 +0900 Subject: [PATCH] internal/ui: remove a special logic for UNIX The issue #1118 can no longer be reproduced. Updates #1118 Updates #1982 --- internal/ui/ui_glfw.go | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 5421ca749..70c38859f 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -924,24 +924,12 @@ func (u *UserInterface) init() error { u.setSizeCallbackEnabled = true - setSize := func() { - ww, wh := u.getInitWindowSizeInDIP() - u.setWindowSizeInDIP(ww, wh, u.isFullscreen()) - } - - // Set the window size and the window position in this order on Linux or other UNIX using X (#1118), - // but this should be inverted on Windows. This is very tricky, but there is no obvious way to solve - // this. This doesn't matter on macOS. - // TODO: Set the position first even on X. setWindowSizeInDIP uses the monitor of the window, and - // if the window position is not reliable, the device scale factor is also not reliable (#1118, #1982). + // The position must be set before the size is set (#1982). + // setWindowSize refers the current monitor's device scale. wx, wy := u.getInitWindowPositionInDIP() - if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { - u.setWindowPositionInDIP(wx, wy, u.initMonitor) - setSize() - } else { - setSize() - u.setWindowPositionInDIP(wx, wy, u.initMonitor) - } + u.setWindowPositionInDIP(wx, wy, u.initMonitor) + ww, wh := u.getInitWindowSizeInDIP() + u.setWindowSizeInDIP(ww, wh, u.isFullscreen()) u.updateWindowSizeLimits()