mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: bug fix: skip focus check for the first update
This commit is contained in:
parent
9a511fecb5
commit
99ffe09b63
@ -83,6 +83,7 @@ type userInterfaceImpl struct {
|
|||||||
|
|
||||||
// bufferOnceSwapped must be accessed from the main thread.
|
// bufferOnceSwapped must be accessed from the main thread.
|
||||||
bufferOnceSwapped bool
|
bufferOnceSwapped bool
|
||||||
|
updateOnceCalled bool
|
||||||
|
|
||||||
origWindowPosX int
|
origWindowPosX int
|
||||||
origWindowPosY int
|
origWindowPosY int
|
||||||
@ -1276,6 +1277,10 @@ func (u *UserInterface) setFPSMode(fpsMode FPSModeType) error {
|
|||||||
|
|
||||||
// update must be called from the main thread.
|
// update must be called from the main thread.
|
||||||
func (u *UserInterface) update() (float64, float64, error) {
|
func (u *UserInterface) update() (float64, float64, error) {
|
||||||
|
defer func() {
|
||||||
|
u.updateOnceCalled = true
|
||||||
|
}()
|
||||||
|
|
||||||
if err := u.error(); err != nil {
|
if err := u.error(); err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
@ -1383,7 +1388,9 @@ func (u *UserInterface) update() (float64, float64, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for !u.isRunnableOnUnfocused() {
|
// If isRunnableOnUnfocused is false and the window is not focused, wait here.
|
||||||
|
// For the first update, skip this check as the window might not be seen yet in some environments like ChromeOS (#3091).
|
||||||
|
for !u.isRunnableOnUnfocused() && u.updateOnceCalled {
|
||||||
// In the initial state on macOS, the window is not shown (#2620).
|
// In the initial state on macOS, the window is not shown (#2620).
|
||||||
visible, err := u.window.GetAttrib(glfw.Visible)
|
visible, err := u.window.GetAttrib(glfw.Visible)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user