diff options
author | David Robillard <d@drobilla.net> | 2023-05-12 17:09:05 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-12 17:16:24 -0400 |
commit | 049a7254beb94d33e315930f42b434ded6e29fa5 (patch) | |
tree | 7e0695bf93d8e1602067f6391f1e1c4c3ffe4526 /src/mac.m | |
parent | 70a01e11a5c7b6c47717eb4b324e30ee331a817a (diff) | |
download | pugl-049a7254beb94d33e315930f42b434ded6e29fa5.tar.gz pugl-049a7254beb94d33e315930f42b434ded6e29fa5.tar.bz2 pugl-049a7254beb94d33e315930f42b434ded6e29fa5.zip |
Factor out puglIsValidSize() and use consistent rules everywhere
Diffstat (limited to 'src/mac.m')
-rw-r--r-- | src/mac.m | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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, |