Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout is called with wrong height value on Mac OS after disabling fullscreen with green button #1884

Closed
hajimehoshi opened this issue Nov 23, 2021 Discussed in #1883 · 4 comments

Comments

@hajimehoshi
Copy link
Owner

Discussed in #1883

Originally posted by IlyaFloppy November 23, 2021
I am running a game in fullscreen using ebiten.SetFullscreen(true). Layout method is called with width=1919 and height=1200. Then I use green window button to exit fullscreen and Layout method keeps getting called with the same width and height. The game looks squeezed vertically. After I resize the window dragging the corner it looks normal and width and height change to 1920 and 1073 respectively.

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
	fmt.Println("LAYOUT", outsideWidth, outsideHeight)
	return outsideWidth, outsideHeight
}
// App starts
LAYOUT 1920 1073
// SetFullscreen is called
[1535] LAYOUT 1919 1200
// Green button is used to disable fullscreen
[2643] LAYOUT 1919 1200
// Start changing window size
LAYOUT 1907 1073
LAYOUT 1906 1073
LAYOUT 1905 1073
LAYOUT 1907 1073
LAYOUT 1908 1073
LAYOUT 1909 1073
[14105] LAYOUT 1920 1073
```</div>
@hajimehoshi
Copy link
Owner Author

480.mov

Video from @IlyaFloppy

@hajimehoshi hajimehoshi added this to the v2.2.3 milestone Nov 27, 2021
@hajimehoshi
Copy link
Owner Author

CC @IlyaFloppy

Confirmed. I reproduced this issue with these steps:

  1. Make the window resizable by SetWindowResizable
  2. Make the window fullscreen by SetWindowFullscreen
  3. Click the green button

hajimehoshi added a commit that referenced this issue Nov 27, 2021
…storing from fullscreen

u.toChangeSize affects the result of u.updateSize. When the callback
for WindowSetSize is invoked, toChangeSize should be true.

In order to simplify the logic, we have to remove toChangeSize later.

Closes #1884
@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Nov 27, 2021

@IlyaFloppy

OK this should be fixed at 2.2 branch 67d158b4517d6af379628227afff5172399dc92c and main branch 22e64c7df030d882951e4a33dd1e0c0b2b5dd99b. Could you test them (testing 2.2 is fine)?

@IlyaFloppy
Copy link

I can confirm this issue has been fixed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants