From 5aeb68acb74c76ec6e738d9e9ec1083de834b120 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 28 Jan 2021 19:26:26 +1100 Subject: [PATCH] Fix for calculating new window size --- v2/internal/ffenestri/ffenestri_darwin.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 601d7312..164d9e8d 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -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 ) {