From 049a7254beb94d33e315930f42b434ded6e29fa5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 12 May 2023 17:09:05 -0400 Subject: Factor out puglIsValidSize() and use consistent rules everywhere --- src/mac.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mac.m') diff --git a/src/mac.m b/src/mac.m index ef0a730..1683a05 100644 --- a/src/mac.m +++ b/src/mac.m @@ -343,7 +343,7 @@ dispatchCurrentChildViewConfiguration(PuglView* const view) { const PuglViewSize defaultSize = puglview->sizeHints[PUGL_DEFAULT_SIZE]; - return (defaultSize.width && defaultSize.height) + return puglIsValidSize(defaultSize) ? sizePoints(puglview, defaultSize.width, defaultSize.height) : NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); } @@ -1083,7 +1083,7 @@ updateSizeHint(PuglView* const view, const PuglSizeHint hint) { const PuglSpan width = view->sizeHints[hint].width; const PuglSpan height = view->sizeHints[hint].height; - if (!width || !height) { + if (!puglIsValidSize(view->sizeHints[hint])) { return PUGL_FAILURE; } @@ -1238,8 +1238,7 @@ puglRealize(PuglView* view) NSLayoutRelationGreaterThanOrEqual, view->sizeHints[PUGL_MIN_SIZE].height)]; - if (view->sizeHints[PUGL_MAX_SIZE].width && - view->sizeHints[PUGL_MAX_SIZE].height) { + if (puglIsValidSize(view->sizeHints[PUGL_MAX_SIZE])) { [impl->wrapperView addConstraint:puglConstraint(impl->wrapperView, NSLayoutAttributeWidth, -- cgit v1.2.1