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

Viewports: Fix window having incorrect size after it is uncollapsed #2756

Closed

Conversation

rokups
Copy link
Contributor

@rokups rokups commented Aug 26, 2019

Issue manifests on linux when window is in it's own viewport.

Video

Why it happened

Event sets PlatformRequestResize = true which causes this line to execute and save size of collapsed window as full size.

SDL backend does not send window resize event when SDL_SetWindowSize() is called and everything works as expected.

On windows glfw still sends this event, but event is sent during glfwSetWindowSize() call which is invoked from here. Due to lucky accident PlatformRequestSize is cleared soon after imgui requests setting window size. It works on windows by chance.

On linux event is queued and sent to application on next frame during glfwPollEvents(). Then imgui gets a chance to react on PlatformRequestSize flag and save wrong window size.

…ests on linux when window is in it's own viewport.
@ocornut ocornut changed the title [Docking] Fix window having incorrect size after it is uncollapsed Viewports: Fix window having incorrect size after it is uncollapsed Aug 26, 2019
@rokups rokups changed the title Viewports: Fix window having incorrect size after it is uncollapsed [Docking] Fix window having incorrect size after it is uncollapsed Aug 26, 2019
@ocornut ocornut changed the title [Docking] Fix window having incorrect size after it is uncollapsed Viewports: Fix window having incorrect size after it is uncollapsed Aug 27, 2019
@ocornut
Copy link
Owner

ocornut commented Aug 29, 2019

Thanks Rokas!
The only change I would do is to move the bool inside the ImGuiViewportDataGlfw structure, so it would work if multiple viewports are resized in the same frame (which is bounds to happen if resized from code).

@rokups
Copy link
Contributor Author

rokups commented Aug 29, 2019

Done 👍

ocornut pushed a commit that referenced this pull request Aug 29, 2019
…ssue manifests on Linux when window is in it's own viewport. (#2756, #2117)
ocornut added a commit that referenced this pull request Aug 29, 2019
@ocornut
Copy link
Owner

ocornut commented Aug 29, 2019

Merged with subsequent fixes for Windows (a4af3cc) because we don't always receive a size event after glfwSetWindowSize().

I have a feeling we will have to come back to this at some point, and making the change already is the best way for us to notice other issues later.

Thanks @rokups !

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

Successfully merging this pull request may close these issues.

2 participants