aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac.m
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-12 17:09:05 -0400
committerDavid Robillard <d@drobilla.net>2023-05-12 17:16:24 -0400
commit049a7254beb94d33e315930f42b434ded6e29fa5 (patch)
tree7e0695bf93d8e1602067f6391f1e1c4c3ffe4526 /src/mac.m
parent70a01e11a5c7b6c47717eb4b324e30ee331a817a (diff)
downloadpugl-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.m7
1 files changed, 3 insertions, 4 deletions
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,