internal/ui: remove a special logic for UNIX

The issue #1118 can no longer be reproduced.

Updates #1118
Updates #1982
This commit is contained in:
Hajime Hoshi 2022-02-08 01:29:20 +09:00
parent cb4085277b
commit 294ee43716

View File

@ -924,24 +924,12 @@ func (u *UserInterface) init() error {
u.setSizeCallbackEnabled = true u.setSizeCallbackEnabled = true
setSize := func() { // The position must be set before the size is set (#1982).
ww, wh := u.getInitWindowSizeInDIP() // setWindowSize refers the current monitor's device scale.
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).
wx, wy := u.getInitWindowPositionInDIP() wx, wy := u.getInitWindowPositionInDIP()
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { u.setWindowPositionInDIP(wx, wy, u.initMonitor)
u.setWindowPositionInDIP(wx, wy, u.initMonitor) ww, wh := u.getInitWindowSizeInDIP()
setSize() u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
} else {
setSize()
u.setWindowPositionInDIP(wx, wy, u.initMonitor)
}
u.updateWindowSizeLimits() u.updateWindowSizeLimits()