5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-17 01:19:29 +08:00

Fix for calculating new window size

This commit is contained in:
Lea Anthony 2021-01-28 19:26:26 +11:00
parent b81101414f
commit 5aeb68acb7
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -903,10 +903,11 @@ void setMinMaxSize(struct Application *app)
// Calculate if window needs resizing
int newWidth = app->width;
int newHeight = app->height;
if (app->width > app->maxWidth) newWidth = app->maxWidth;
if (app->width < app->minWidth) newWidth = app->minWidth;
if (app->height > app->maxHeight ) newHeight = app->maxHeight;
if (app->height < app->minHeight ) newHeight = app->minHeight;
if (app->maxWidth > 0 && app->width > app->maxWidth) newWidth = app->maxWidth;
if (app->minWidth > 0 && app->width < app->minWidth) newWidth = app->minWidth;
if (app->maxHeight > 0 && app->height > app->maxHeight ) newHeight = app->maxHeight;
if (app->minHeight > 0 && app->height < app->minHeight ) newHeight = app->minHeight;
// If we have any change, resize window
if ( newWidth != app->width || newHeight != app->height ) {