Skip to content

Commit

Permalink
internal/ui: bug fix: the screen size must be initialized first even …
Browse files Browse the repository at this point in the history
…when the canvas is unfocused

Closes #3034
  • Loading branch information
hajimehoshi committed Jul 4, 2024
1 parent f6cdf40 commit 9988a0c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/ui/ui_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ func (u *UserInterface) updateImpl(force bool) error {
return err
}

if !u.onceUpdateCalled {
u.updateScreenSize()
}

// TODO: If DeviceScaleFactor changes, call updateScreenSize.
// Now there is not a good way to detect the change.
// See also https://crbug.com/123694.
Expand Down Expand Up @@ -373,6 +369,11 @@ func (u *UserInterface) needsUpdate() bool {
}

func (u *UserInterface) loopGame() error {
// Initialize the screen size first (#3033).
// If ebiten.SetRunnableOnUnfocused(false) and the canvas is not focused,
// suspended() returns true and the update routine cannot start.
u.updateScreenSize()

errCh := make(chan error, 1)
reqStopAudioCh := make(chan struct{})
resStopAudioCh := make(chan struct{})
Expand Down

1 comment on commit 9988a0c

@hajimehoshi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize the screen size first (#3033)

This is typo. The correct issue is #3034.

Please sign in to comment.