mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: force to put the window in the initial monitor
To make things simple, let's not put the window outside the initial monitor. Updates #1351 Closes #1575
This commit is contained in:
parent
b2e0a7b267
commit
feb70963c6
@ -883,6 +883,19 @@ func (u *userInterfaceImpl) init() error {
|
||||
// setWindowSize refers the current monitor's device scale.
|
||||
// TODO: currentMonitor is very hard to use correctly. Refactor this.
|
||||
wx, wy := u.getInitWindowPositionInDIP()
|
||||
// Force to put the window in the initial monitor (#1575).
|
||||
if wx < 0 {
|
||||
wx = 0
|
||||
}
|
||||
if wy < 0 {
|
||||
wy = 0
|
||||
}
|
||||
if max := u.initFullscreenWidthInDIP - ww; wx >= max {
|
||||
wx = max
|
||||
}
|
||||
if max := u.initFullscreenHeightInDIP - wh; wy >= max {
|
||||
wy = max
|
||||
}
|
||||
u.setWindowPositionInDIP(wx, wy, u.initMonitor)
|
||||
u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user