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

refactor ChangeClientSize() #1595

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MonoGame.Framework/Platform/Windows/WinFormsGameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,14 @@ public struct NativeMessage

internal void ChangeClientSize(int width, int height)
{
var clientBounds = new SysDrawing.Size(width, height);
Rectangle clientBounds = this.ClientBounds;

var prevIsResizing = Form.IsResizing;
bool prevIsResizing = Form.IsResizing;
// make sure we don't see the events from this as a user resize
Form.IsResizing = true;

if (this.Form.ClientSize != clientBounds)
this.Form.ClientSize = clientBounds;
if (clientBounds.Width != width || clientBounds.Height != height)
this.Form.ClientSize = new SysDrawing.Size(width, height);

// if the window wasn't moved manually and it's resized, it should be centered
if (!_wasMoved)
Expand Down
Loading