mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
Compare commits
2 Commits
cf5b851cd3
...
4d268f5ce4
Author | SHA1 | Date | |
---|---|---|---|
|
4d268f5ce4 | ||
|
3136de4958 |
@ -1027,7 +1027,7 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window is shown after the first buffer swap.
|
// Window is shown after the first buffer swap (#2725).
|
||||||
if err := glfw.WindowHint(glfw.Visible, glfw.False); err != nil {
|
if err := glfw.WindowHint(glfw.Visible, glfw.False); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1294,6 +1294,40 @@ func (u *UserInterface) update() (float64, float64, error) {
|
|||||||
if err = u.window.Focus(); err != nil {
|
if err = u.window.Focus(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "darwin" || runtime.GOOS == "windows" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// On Linux or UNIX, there is a problematic desktop environment like i3wm
|
||||||
|
// where an invisible window size cannot be initialized correctly (#2951).
|
||||||
|
// Call SetSize explicitly after the window becomes visible.
|
||||||
|
|
||||||
|
fullscreen, e := u.isFullscreen()
|
||||||
|
if e != nil {
|
||||||
|
err = e
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if fullscreen {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m, e := u.currentMonitor()
|
||||||
|
if e != nil {
|
||||||
|
err = e
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s := m.DeviceScaleFactor()
|
||||||
|
newW := int(dipToGLFWPixel(float64(u.origWindowWidthInDIP), s))
|
||||||
|
newH := int(dipToGLFWPixel(float64(u.origWindowHeightInDIP), s))
|
||||||
|
|
||||||
|
// Even though a framebuffer callback is not called, waitForFramebufferSizeCallback returns by timeout,
|
||||||
|
// so it is safe to use this.
|
||||||
|
if err = u.waitForFramebufferSizeCallback(u.window, func() error {
|
||||||
|
return u.window.SetSize(newW, newH)
|
||||||
|
}); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
|
Loading…
Reference in New Issue
Block a user